Hi guys, i want setup call back if busy on asterisk, i got toturial form voip-info.org/wiki/index.php … nts_page=1, but it didn’t work.
Here my config in extension.conf :
[voip_trial]
exten => _5XXX,1,Dial(SIP/${EXTEN},10,t)
exten => _5XXX,2,ChanIsAvail(SIP/${EXTEN},s)
exten => _5XXX,3(s-BUSY),GotoIf($["${AVAILSTATUS}"<=“1”]?s-NOANSWER,1)
exten => _5XXX,n,Read(digit,callback,1)
exten => _5XXX,n,Gotoif($["${digit}"=“5”]?callback,1:5)
exten => _5XXX,n,Voicemail(${EXTEN},b)
exten => _5XXX,n,Hangup
exten => callback,1,AGI(callback,${EXTEN})
exten => callback,2,Hangup
exten => _cbXXXXXX,1,Set(FROM=${EXTEN}:2:3})
exten => _cbXXXXXX,2,Set(TO=${EXTEN}:5:3})
exten => _cbXXXXXX,3,ChanIsAvail(SIP/${TO},s)
exten => _cbXXXXXX,4,GotoIf($["${AVAILSTATUS}" <= “1”]?5:7)
exten => _cbXXXXXX,5,Set(CALLERID(all)=“CB ${TO} <${TO}>”)
exten => _cbXXXXXX,6,Dial(SIP/${FROM},10)
exten => _cbXXXXXX,n,Hangup
When i press 5 i got this error on my log CLI :
– Executing [5101@voip-trial:1] Dial(“SIP/5102-0000000c”, “SIP/5101,10,t”) in new stack
== Using SIP RTP CoS mark 5
– Called 5101
– Got SIP response 486 “Busy Here” back from 192.168.1.236
– SIP/5101-0000000d is busy
== Everyone is busy/congested at this time (1:1/0/0)
– Executing [5101@voip-trial:2] ChanIsAvail(“SIP/5102-0000000c”, “SIP/5101,s”) in new stack
– Executing [5101@voip-trial:3] GotoIf(“SIP/5102-0000000c”, “0?s-NOANSWER,1”) in new stack
– Executing [5101@voip-trial:4] Read(“SIP/5102-0000000c”, “digit,callback,1”) in new stack
– Accepting a maximum of 1 digits.
– <SIP/5102-0000000c> Playing ‘callback.gsm’ (language ‘en’)
– User entered ‘5’
– Executing [5101@voip-trial:5] GotoIf(“SIP/5102-0000000c”, “1?callback,1:5”) in new stack
– Goto (voip-trial,callback,1)
– Executing [callback@voip-trial:1] AGI(“SIP/5102-0000000c”, “callback,5101”) in new stack
– Launched AGI Script /usr/share/asterisk/agi-bin/callback
– <SIP/5102-0000000c>AGI Script callback completed, returning 0
– Executing [callback@voip-trial:2] Hangup(“SIP/5102-0000000c”, “”) in new stack
== Spawn extension (voip-trial, callback, 2) exited non-zero on ‘SIP/5102-0000000c’
– Attempting call on LOCAL/cb51025101 for 5101@voip-trial:1 (Retry 1)
[Dec 13 09:58:07] NOTICE[5146]: chan_local.c:534 local_call: No such extension/context cb51025101@default while calling Local channel
[Dec 13 09:58:07] NOTICE[5146]: channel.c:4042 __ast_request_and_dial: Unable to call channel LOCAL/cb51025101
[Dec 13 09:58:07] NOTICE[5146]: pbx_spool.c:339 attempt_thread: Call failed to go through, reason (0) C
And this is my call back file :
#!/usr/bin/php -q
<?php ob_implicit_flush(true); set_time_limit(0); $to = $argv[1]; $err=fopen("php://stderr","w"); $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("/var/spool/asterisk/outgoing/cb" . $agi["callerid"] . $to,"w+"); fputs($cf,"Channel: LOCAL/cb".$agi["callerid"].$to."\n"); fputs($cf,"Context: voip-trial\n"); fputs($cf,"Extension: ".$to."\n"); fputs($cf,"CallerID: CB ".$agi["callerid"]."<".$agi["callerid"]."> \n"); fputs($cf,"MaxRetries: 100\n"); fputs($cf,"RetryTime: 30\n"); fclose($cf); fclose($in); fclose($err); ?>Where is the wrong in my script , please any suggest and advice, Thanks