[asterisk-users] Asterisk perl AGI confusing variables

Sammy Govind govoiper at gmail.com
Sat Feb 11 07:22:41 CST 2012


Hello all,

I'm struck with a very strange problem today. I've an AGI with some code
subroutine snippet as follows:


sub enable_sbc($) {
        my $carrier = shift;
        my $tmp = substr($carrier,1);
        my $jkh = $tmp;
        $server_port = $ast_agi->get_variable("SIPPEER($jkh,port)");
        $ser_ip = $ast_agi->get_variable("SIPPEER($tmp,ip)");
        $ast_agi->exec("SIPAddHeader","P-PORT: $server_port");
        $ast_agi->exec("SIPAddHeader","P-IPADDRESS: $ser_ip");
        return 0;
}


Where $carrier resolves to "@my-carrier"

Strangely and very weird get variable is returning correct values on
console as given below but the variables containing the values gets lost or
confused with each other !

<SIP/sipproxy3.32-00000000>AGI Rx << GET VARIABLE SIPPEER(my-carrier,port)
<SIP/sipproxy3.32-00000000>AGI Tx >> 200 result=1 (5060)
<SIP/sipproxy3.32-00000000>AGI Rx << GET VARIABLE SIPPEER(my-carrier,ip)
<SIP/sipproxy3.32-00000000>AGI Tx >> 200 result=1 (192.168.2.19)
<SIP/sipproxy3.32-00000000>AGI Rx << EXEC SIPAddHeader "P-PORT: "
    -- AGI Script Executing Application: (SIPAddHeader) Options: (P-PORT: )
<SIP/sipproxy3.32-00000000>AGI Tx >> 200 result=0
<SIP/sipproxy3.32-00000000>AGI Rx << EXEC SIPAddHeader "P-IPADDRESS: 5060"
    -- AGI Script Executing Application: (SIPAddHeader) Options:
(P-IPADDRESS: 5060)
<SIP/sipproxy3.32-00000000>AGI Tx >> 200 result=0


Anyone please help. Am I doing anything wrong ?


Regards,
Sammy.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20120211/b1ab3e67/attachment.htm>


More information about the asterisk-users mailing list