[asterisk-users] enum agi interesting problem

Dan Caescu dcaescu at eqnet.us
Tue May 12 18:07:22 CDT 2009


Hi,

 

I am having a strange problem with enum and AGI.

 

Here is what happens: 

 

I have in my agi something like that:

 

foreach my $resolver ("e164.arpa", "e164.info", "e164.org") {

            my @enums = get_enums($phone, $resolver);

                        foreach my $enum (@enums) {

                                    $dialstring = $enum . "|90|HL(" .
($maxtime * 60 * 1000) . ":60000:30000)";

                                    $res = $AGI->exec("DIAL $dialstring");

                                    $answeredtime =
$AGI->get_variable("ANSWEREDTIME");

 

                                    $dialstatus =
$AGI->get_variable("DIALSTATUS");

                                    print LOGFILE "Dialstring: $dialstr
DIALSTATUS: $dialstatus\n";

                                    

                                    $callstart = time();

                                    if ($dialstatus eq "ANSWERED") { last; }

                        }

            }

}

                                    

Here's the output from my logfile:

 

Call 1:

 

Dialstring:
sip/16416418003569377 at tollfree.sip-happens.com|90|HL(5760000:60000:30000)
DIALSTATUS:

Dialstring:
sip/16416418003569377 at sip.tollfreegateway.com|90|HL(5760000:60000:30000)
DIALSTATUS:

Dialstring: sip/18003569377 at tf.voipmich.com|90|HL(5760000:60000:30000)
DIALSTATUS: ANSWER

 

Call 2:

 

Dialstring: sip/18002662278 at tf.voipmich.com|90|HL(5760000:60000:30000)
DIALSTATUS:

Dialstring:
sip/16416418002662278 at sip.tollfreegateway.com|90|HL(5760000:60000:30000)
DIALSTATUS:

Dialstring:
sip/16416418002662278 at tollfree.sip-happens.com|90|HL(5760000:60000:30000)
DIALSTATUS: ANSWER

 

And so on.

The call gets answered the first time (call 1 - through sip-happens, call 2,
through voipmich).

Problem is that after I hang up , it doesn't return a status, so it cycles
through the loop and dials the rest of the entries. The last one gets
dialstatus.

 

I believe it's a stupid mistake but I cannot think of anything right now. 

 

Any ideas?

 

Thanks,

Dan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20090512/6e5dcee8/attachment.htm 


More information about the asterisk-users mailing list