<div dir="ltr"><div><div><div><div><div><div>Hi all,<br><br></div>Hopefully, I just need a second set of eyes on this one, but I just can't figure out what I'm doing wrong. I'm using an agi script to dial a number, check the dial result, and act accordingly.<br>
<br></div>The problem is that I'm not getting anything back from DIALSTATUS, or HANGUPCAUSE.<br><br></div>Here is the relevant perl code:<br><br>===============================================================<br><br>$main::agi->verbose("==================================================================================== ", 1);<br>
$main::agi->exec("dial", "sip/$t->{trunk}/$t->{prefix}$o->{number},240,KrTWX");<br> $result = $main::agi->get_variable("DIALSTATUS");<br> $cause = $main::agi->get_variable("HANGUPCAUSE");<br>
<br> $o->{DIALSTATUS} = $result;<br> $o->{HANGUPCAUSE} = $cause;<br> $main::agi->verbose("============================= The result of the last call was ($o->{DIALSTATUS}) ($o->{HANGUPCAUSE})", 1);<br>
$main::agi->verbose("==================================================================================== ", 1);<br><br>===============================================================<br><br></div>Here is the relevant output with agi debug turned on:<br>
<br>===============================================================<br><br>[Apr 1 15:01:55] <SIP/CCEF485BC606-2-00007787>AGI Tx >> 200 result=0<br>[Apr 1 15:01:55] <SIP/CCEF485BC606-2-00007787>AGI Rx << VERBOSE "==================================================================================== " 1<br>
[Apr 1 15:01:55] <a href="http://magic_switch.pl">magic_switch.pl</a>: ==================================================================================== <br>[Apr 1 15:01:55] <SIP/CCEF485BC606-2-00007787>AGI Tx >> 200 result=1<br>
[Apr 1 15:01:55] <SIP/CCEF485BC606-2-00007787>AGI Rx << EXEC dial "sip/didlogic/15058457900,240,KrTWX"<br>[Apr 1 15:01:55] -- AGI Script Executing Application: (dial) Options: (sip/didlogic/15058457900,240,KrTWX)<br>
[Apr 1 15:01:55] == Using SIP RTP TOS bits 24<br>[Apr 1 15:01:55] == Using SIP RTP CoS mark 5<br>[Apr 1 15:01:55] -- Called sip/didlogic/15058457900<br>[Apr 1 15:01:55] -- Got SIP response 603 "Declined" back from <a href="http://178.63.143.236:5060">178.63.143.236:5060</a><br>
[Apr 1 15:01:55] -- SIP/didlogic-00007788 is busy<br>[Apr 1 15:01:55] == Everyone is busy/congested at this time (1:1/0/0)<br>[Apr 1 15:01:55] <SIP/CCEF485BC606-2-00007787>AGI Tx >> 200 result=0<br>[Apr 1 15:01:55] <SIP/CCEF485BC606-2-00007787>AGI Rx << GET VARIABLE DIALSTATUS<br>
[Apr 1 15:01:55] <SIP/CCEF485BC606-2-00007787>AGI Tx >> 200 result=1 (BUSY)<br>[Apr 1 15:01:55] <SIP/CCEF485BC606-2-00007787>AGI Rx << GET VARIABLE HANGUPCAUSE<br>[Apr 1 15:01:55] <SIP/CCEF485BC606-2-00007787>AGI Tx >> 200 result=1 (21)<br>
[Apr 1 15:01:55] <SIP/CCEF485BC606-2-00007787>AGI Rx << VERBOSE "============================= The result of the last call was () ()" 1<br>[Apr 1 15:01:55] <a href="http://magic_switch.pl">magic_switch.pl</a>: ============================= The result of the last call was () ()<br>
[Apr 1 15:01:55] <SIP/CCEF485BC606-2-00007787>AGI Tx >> 200 result=1<br>[Apr 1 15:01:55] <SIP/CCEF485BC606-2-00007787>AGI Rx << VERBOSE "==================================================================================== " 1<br>
[Apr 1 15:01:55] <a href="http://magic_switch.pl">magic_switch.pl</a>: ==================================================================================== <br><br>===============================================================<br>
<br><br><br></div>So, the result of my previous AGI command was 200. Then I can clearly see that the result of this dial is BUSY/21, which I understand. But, my perl script isn't getting this value. I do the assignment to/from $result and $cause because I use those values later in the script, but have to pass them back to a global routine, as well.<br>
<br></div>Can anyone see what I'm doing wrong?<br><br>Mike Diehl.<br><div><div><br></div></div></div>