Solved

Asterisk how to monitor database

Posted on 2011-09-14
8
673 Views
Last Modified: 2012-08-13
Hello,

My customer has an Asterisk 1.4. for Voip with X-Lite client.

He wants me to develop a Windows based Crm so as when there is an incoming call on a Pc, the Crm would find the customer automatically (by finding the incoming telephone number in the database of the Crm).

I can see 2 ways to solve this:

1.to constantly monitor the Asterisk database and get the actual phone number from it
in this case I need some guidance about the database structure and what tables to check

2.To get the information from X-Lite somehow

Maybe there are other ways I haven't thought about.
Please help me with this

Thank you


0
Comment
Question by:starhu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 40

Expert Comment

by:noci
ID: 36540083
Hm. asterisk can write the call detail records to any database / flat file you like.
So that is more or less up to you. to decide how:

cdr engines are there for: postgresql, mysql, syslog, sqlite, odbc, flatfile.

This might be usefull too.
http://www.loudhush.ro/tools/AsteriskCDRInspector.html

0
 

Author Comment

by:starhu
ID: 36544013
How can I check what database uses the existing Asterix? I am a newbie in Linux
0
 
LVL 40

Expert Comment

by:noci
ID: 36544397
First asterisk != linux.
In general config files in linux are kept /etc/..  but that may be different.
Most configuration files are normal ascii files that can be read.

In the asterisk configuration (mostly /etc/asterisk ) you have a number of cdr*.conf files.
and in modules.conf one of the modules is enabled.
(or rather no disabled).

Tools to read ascii files are 'less' or 'more'...
0
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
LVL 25

Expert Comment

by:Ron Malmstead
ID: 36549845
There are several ways to do this...but having agent software poll the DB is going to be very costly the more users you have.

Essentially you need to get ..either the phone number to the client, the complete record, or a path to get to the customer record.

I already do something similar to this on my system, so i'll give you a basic run down of how it works on my end.   Then i'll give you a much simpler.."quick and dirty" method.

Agent -
1.  Agent logs into agent software with user/pass, the extension for their machine is already prefilled from settings.
2.  Agent software sends a "timestamp" update to an agent table (mysql) on the Asterisk server every 6 seconds, while they are in "ready" mode.
3.  Agent software has a TcpClientListener running that only accepts connections from the Asterisk server on port 5039.
4.  Agent recieves "INCOMING:${tableid}/${recordid}" so that it can pull a record immediately upon recieving a call.
5.  Agent goes into status "not ready" until record is released.

Customer -
1.  Customer calls in.
2.  Asterisk attempts to lookup the customer record by phone number storing the table ID and record ID to variables if it finds it.
    2a.  If it's not found, the customer is prompted to enter the phone associated with their account and another lookup is attmpted.
    2b.  If not found after two tries they go to operators group
3.  If the customer record is found, Asterisk polls the agent table for all agents who's timestamp is greater than the current time plus (-) negative 6 seconds and whose "timeinstatus" is the oldest.
    3a.  If Agent is not available customer remains in queue looping until an Agent is free.
4.  Asterisk uses the Extension retrieved from the agent table to get the IPaddress ....using ${SIPPEER(${agentexten}:ip)})
5.  Asterisk runs netcat to send the information to the listening client app  ...System(nc ${AGENTIPADDRESS} 5039 <<< "INCOMING:${tableid}/${recordid}")



If all that is too tough for you, then try this method...
1. Asterisk recieves a call....
2. Asterisk chooses agent...(for example agent 3002)
3. Asterisk writes a file to a Samba share...    \\server\share\3002.txt   ..inside the file is the customer phone number
4. Each agent client is polling the samba share for a file that matches their own extension.  When they find it, they read the number inside of it, then delete the file,  and then search the db for the number.  
5. When they release the record they update the agent table to be "ready" again.

There other methods to acheive the same results... I suppose it depends on your expertise and resources and development time allowed.

Another method is to poll the AMI (Asterisk Manager Interface), service running on Asterisk...there are even .Net classes you can use to communicate with it.
0
 

Author Comment

by:starhu
ID: 36552130
xuserx2000: My customer uses a Linux Server for Asterix and Windows clients for X-Lite.

Can I get the incoming information directly from X-Lite?
0
 
LVL 40

Accepted Solution

by:
noci earned 250 total points
ID: 36552190
How about running an jabber server and have asterisk log the message in a jabber group.
(Jabber is the core for many messaging systems, googles, facebook etc.).

http://www.voipphreak.ca/2008/01/29/asterisk-jabber-xmpp-basic-setup-tutorial/
https://wiki.asterisk.org/wiki/display/AST/Jabber+in+Asterisk

And for some inspiration:
http://www.youtube.com/watch?v=PrAlikkTu9M


As jabber server ejabberd is quite easy to setup & manage.
0
 
LVL 12

Assisted Solution

by:hfraser
hfraser earned 250 total points
ID: 36555389
Asterisk has an api (called AMI) that allows you to manager the system from external apps, and this might provide you with the interface you need. You can also configure it to notify your CRM application using the inbound call plans. This page has lots of examples of how to do this:

http://www.voip-info.org/wiki/view/Asterisk+call+notification

Finally, have a look at applications like AtserCC and AsterCRM for PHP-based complete solutions that you could tweak to meet your requirements, rather than re-inventing the wheel from scratch.
0
 

Author Closing Comment

by:starhu
ID: 36576675
it didn't completely solve my problem
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Almost all Internet protocol telephones have built-in switches at the back that allow you to connect your personal computer to one port and use the other port to connect your phone to to a Cisco switch.   Why we need to connect the PC to the pho…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question