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 <dcaescu at eqnet.us>:> 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") { > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 my @enums =3D get_enums($phone, $resolver); > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 foreach my $enum (@enums) { > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 $dialstring =3D $enum . "|90|HL(" . > ($maxtime * 60 * 1000) . ":60000:30000)"; > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 $res =3D $AGI->exec("DIAL $dialstring"); > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 $answeredtime =3D > $AGI->get_variable("ANSWEREDTIME"); > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 $dialstatus =3D > $AGI->get_variable("DIALSTATUS"); > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 print LOGFILE "Dialstring: $dialstr > DIALSTATUS: $dialstatus\n"; > > > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 $callstart =3D time(); > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if ($dialstatus eq "ANSWERED") { last; } > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 } > > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 } > > } > > > > Here=92s 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 =96 through sip-happens, call 2, > through voipmich). > > Problem is that after I hang up , it doesn=92t return a status, so it cycles > through the loop and dials the rest of the entries. The last one gets > dialstatus. > > > > I believe it=92s 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: > =A0 http://lists.digium.com/mailman/listinfo/asterisk-users >