Forget the typo (s/ANSWERED/ANSWER/g)
_____
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Dan Caescu
Sent: Tuesday, May 12, 2009 7:07 PM
To: 'Asterisk Users Mailing List - Non-Commercial Discussion'
Subject: [asterisk-users] enum agi interesting problem
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/6712445e/attachment.htm