Integration with external applications using AGI

Recently we had a customer that requested for integration with their CRM web application (based on .NET framework and MSSQL). They wanted to get the caller id of the caller and the number which they have called. Here is a simple approach to get this done. In this example, I have used AGI to get the CLID and channel number and then I use the cURL method of PHP to POST the 2 parameters to the URL on the other side.

Continue reading

AGI sample – currency converter using web service

Bellow is an AGI sample to convert currency using a web service:

Step 1) create an extension in /etc/asterisk/extensions_custom.conf

exten => *777,1,AGI(currency.php)
exten => *777,n,hangup()

Step 2) Create currency.php in /var/lib/asterisk/agi-bin

#!/usr/bin/php -q

//fetch the web service and store the result into $curr
$xml = new SimpleXMLElement($res);

$agi->text2wav("Currency rate from $fromCurrency to $toCurrency is");
$agi->text2wav("Thank you");