0
votes

I have been assigned a task to Log all outgoing calls from all extensions to Salesforce through an API, I an very new to Asterisk and FreePBX after searching Google I found out that I can create a custom module and can install it on the FreePBX but that will not solve the problem, what I want is to send the source and destination number to a custom webservice which search some databases for the numbers and after some logic and conditions it logs the call on the Salesforce, I don't have issues with creating web service or Salesforce API logging, I just want to know a way to intercept the call after Hang-up and post the numbers(source/destination) to a web service, I Googled a lot but could not found any example or sample to get me going.

3

3 Answers

2
votes

Just for log you have use asterisk cdr module or CEL.

http://www.voip-info.org/wiki/view/Asterisk+cdr+mysql

http://www.voip-info.org/wiki/view/Asterisk+config+cel.conf

For control you need AGI(FASTAGI) or AMI application or control using asterisk dialplan. For example you can use h-extension to fire event and log event using AMI.

For starting i recommend you read Orelly's Asterisk The Fute of Telephony book or hire consultant if you not willing read books. Without understanding of asterisk internals your application can be really buggy/not scalable.

1
votes

You should take a look into AGI (or FastAGI if you can deal with a TCP socket) to connect to the web service. That way, you can have your own code written in whatever language you like doing whatever you need. It's not clear how you'd define the source and destination number, but you could store those values into variables when you know them (by using the Set application on your dialplan) and then use GET FULL VARIABLE to retrieve those values from your AGI program before dialing out.

1
votes

You can handle this moment at the end of dialplan:

  exten = h,1,AGI(your-script.pl)

And write your logic in your-script.pl file (you can use almost any programming language). You can find description of AGI interface in the official book, "Asterisk. Future of Telephony".