Tuesday, April 3, 2007

Asterisk callme back

Fro CallMe Back Just call your asterisk box with your mobile, let it ring and hang up. Asterisk will call you back at once and provide you with a normal dial tone. after that can Make call.......

simply copy and past on extensions.conf file.......

exten => 1234/016066666,1,Wait,1
exten => 1234/016066666,2,AGI,callback.agi
exten => 1234/016066666,3,Hangup
exten => s,1,Dial,CAPI/@1234:b
exten => s,2,Hangup

And make agi file...

< ? p h p
$in = fopen("php://stdin","r");
while (!feof($in)) { $temp = str_replace("\n","",fgets($in,4096));
$s = split(":",$temp);
$agi[str_replace("agi_","",$s[0])] = trim($s[1]);
if (($temp == "") || ($temp == "\n")) { break;
$cf = fopen("/home/var/spool/asterisk/outgoing/cb".$agi["callerid"],"w+"); fputs($cf,"Channel: CAPI/".$agi["extension"].":".$agi["callerid"]."\n");
fputs($cf,"Context: capidialtone\n");
fputs($cf,"Extension: s\n");
fputs($cf,"SetVar: CALLERIDNUM=".$agi["extension"]."\n");
fputs($cf,"MaxRetries: 2\n");
fputs($cf,"RetryTime: 10\n");
fclose($cf); fclose($in);
? >

In this example 1234 is the incoming/outgoing MSN and 016066666 the callerid of a mobile phone.

No comments: