Solved

Asterisk how to monitor database

Posted on 2011-09-14
8
661 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
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
 
LVL 25

Expert Comment

by:Ron M
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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

910 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now