Maybe it is something to do with AGI - Dial command. IFAIK you can't control Dial via AGI script.
>From http://www.voip-info.org/wiki/view/Asterisk+AGI : Dialing out If the AGI application dials outward by executing Dial, control over the call returns to the dialplan and the script loses contact with the Asterisk server. The script continues to run in the background by itself and is free to clean up and do post-dial processing. If you want your application to initiate a call out without being started through the dialplan: * Asterisk auto-dial out Move (not copy) a file into an Asterisk spool directory and a call will be placed * Asterisk Manager API Use the Originate command Regards, Chris 2009/5/13 Dan Caescu <[email protected]>: > 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 > _______________________________________________ -- 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
