Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 688
  • Last Modified:

Asterisk how to monitor database

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
starhu
Asked:
starhu
2 Solutions
 
nociSoftware EngineerCommented:
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
 
starhuAuthor Commented:
How can I check what database uses the existing Asterix? I am a newbie in Linux
0
 
nociSoftware EngineerCommented:
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
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

 
Ron MalmsteadInformation Services ManagerCommented:
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
 
starhuAuthor Commented:
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
 
nociSoftware EngineerCommented:
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
 
Hugh FraserConsultantCommented:
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
 
starhuAuthor Commented:
it didn't completely solve my problem
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now