By Leonard Wells,2014-04-14 10:08
18 views 0
SMS Callback for Asterisk PBX

SMS Callback for Asterisk PBX

    SMS callback allows you to eliminate dtmf detection problems and inconvenience when using a callback solution. In this section I will show a generic example for accepting

    SMS messages and using them as a trigger for asterisk callback call. For the integration of the sms gateway with asterisk server we will use Hypermedia SMS Server module to accept the SMS messages and open url in which the asterisk manager

    originate command will reside.

    Hypermedia SMS Server Configuration

    edit smsgw.ini:






Hypermedia SMS server will open the url for each

    incoming SMS. Do not forget to select allow SMS triggers for the modules in HMC. Web page code

    edit receivesms.php:

include "phpagi.php";

    $callback_number = $_REQUEST['number'];

    $destination_number = trim($_REQUEST['message']," ");

    $unicode = $_REQUEST['unicode'];



    if ($unicode=="8"){





     if (substr($str,0,3)=="003"){







$agiManager = new AGI_AsteriskManager();

    $manager = $agiManager->connect("","user","pasword"); if (!$manager) {

     syslog(LOG_ERR, "Connection to Asterisk Manager Failed");

     die("Connection to Asterisk Manager Failed"); } else {

    $astVariable=array (





     $eventData['Channel']="sip/hmgw/$callback_number"; $eventData['Context']="hm_callback";

    $eventData['Exten']="$destination_number"; $eventData['Account']="$callback_number"; $eventData['Callerid']="";




    $eventData['Variable']="dummyvariable=null\r\n"; foreach ($astVariable as $variable) {

    $eventData['Variable'].="Variable: ".$variable."\r\n"; }

    $agiManager->send_request($eventName,$eventData); }

Asterisk Dialplan

    edit extensions.conf and add the following:


    exten => _X.,1,answer

    exten => _X.,n,dial(sip/hmgw/${destination_number})

    edit sip.conf and add the following for using HG trunk:









Report this document

For any questions or suggestions please email