Forget the typo (s/ANSWERED/ANSWER/g)
_____ From: [email protected] [mailto:[email protected]] 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/[email protected]|90|HL(5760000:60000:30000) DIALSTATUS: Dialstring: sip/[email protected]|90|HL(5760000:60000:30000) DIALSTATUS: Dialstring: sip/[email protected]|90|HL(5760000:60000:30000) DIALSTATUS: ANSWER Call 2: Dialstring: sip/[email protected]|90|HL(5760000:60000:30000) DIALSTATUS: Dialstring: sip/[email protected]|90|HL(5760000:60000:30000) DIALSTATUS: Dialstring: sip/[email protected]|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
_______________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
