<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><DIV>Thank you for the reply.</DIV>
<DIV> </DIV>
<DIV>1- yes i need to call my agi script; because i have to process some tasks with my DBMS on the caller.</DIV>
<DIV>2- yes it is my first script, "While very simple, the AGI protocol is easy to violate" i did not get your meaning.</DIV>
<DIV>So do you have a perfect solution?</DIV>
<DIV> </DIV>
<DIV>Best regards<BR><BR></DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt"><BR>
<DIV style="FONT-FAMILY: arial, helvetica, sans-serif; FONT-SIZE: 13px"><FONT size=2 face=Tahoma>
<HR SIZE=1>
<B><SPAN style="FONT-WEIGHT: bold">De :</SPAN></B> Steve Edwards <asterisk.org@sedwards.com><BR><B><SPAN style="FONT-WEIGHT: bold">À :</SPAN></B> Asterisk Users Mailing List - Non-Commercial Discussion <asterisk-users@lists.digium.com><BR><B><SPAN style="FONT-WEIGHT: bold">Envoyé le :</SPAN></B> Dim 6 juin 2010, 4h 47min 59s<BR><B><SPAN style="FONT-WEIGHT: bold">Objet :</SPAN></B> Re: [asterisk-users] Controlling calls<BR></FONT><BR>On Sat, 5 Jun 2010, Adil Zaaraoui wrote:<BR><BR>> I want to write an AGI script doing this:<BR>> <BR>> 1-user call a number.<BR>> 2-asterisk call the agi script<BR>> 3-the script dial the peer<BR>> 4-if the call is answered, let the call up for 1min<BR>> 5-then the script hangs up the channel.<BR>> <BR>> I tried either in php or in java but no success.<BR>> <BR>> In java i did this:<BR>> <BR>> //////////////<BR>> exec("Dial", "IAX2/400");<BR>> boolean
t=true;<BR>> while(t){<BR>> if(getChannel().getChannelStatus()==6)t=false;<BR>> }<BR>> wait(60000);<BR>> hangup();<BR>> //////////<BR>> in my extension.conf:<BR>> exten =>777,1,AGI(agi://localhost/sc.agi)<BR>> the script is running but it does not hangup.<BR>> <BR>> Second solution,i tried this :<BR>> exten => 777,1,Dial(IAX2/400,G(myscript))<BR>> exten =>777,n(myscript),AGI(agi://localhost/sc.agi)<BR>> <BR>> in sc.agi in this time i do not call exec("Dial","IAX2/400") statment; <BR>> but the audio stops, no ringing.<BR>> <BR>> Do you have any solution.<BR><BR>0) Please post requests with a more meaningful subject. There are lots of <BR>ways to control calls.<BR><BR>1) Do you need to call an AGI? Can you use an absolute timeout of 1 <BR>minute?<BR><BR>2) Is this your first AGI? While very simple, the AGI protocol is easy to <BR>violate.<BR><BR>3) You are executing
"FastAGI." Is this required by the Java package you <BR>are using?<BR><BR>4) I'm just a 1.2 weenie and I've never used "G," but won't the "G" option <BR>transfer the calling party to "myscript" and the called party to <BR>"myscript+1?"<BR><BR>5) Not related to your issue, but "spinning" on the channel status doesn't <BR>look like a good idea. Adding a "wait(x)" to your while loop may help with <BR>CPU resource consumption.<BR><BR>6) More detail like what version of Asterisk and some console output with <BR>AGI debugging enabled may help.<BR><BR>-- <BR>Thanks in advance,<BR>-------------------------------------------------------------------------<BR>Steve Edwards <A href="mailto:sedwards@sedwards.com" ymailto="mailto:sedwards@sedwards.com">sedwards@sedwards.com</A> Voice: +1-760-468-3867 PST<BR>Newline
Fax: +1-760-731-3000<BR><BR>-- <BR>_____________________________________________________________________<BR>-- Bandwidth and Colocation Provided by <A href="http://www.api-digital.com/" target=_blank>http://www.api-digital.com</A> --<BR>New to Asterisk? Join us for a live introductory webinar every Thurs:<BR> <A href="http://www.asterisk.org/hello" target=_blank>http://www.asterisk.org/hello</A><BR><BR>asterisk-users mailing list<BR>To UNSUBSCRIBE or update options visit:<BR> <A href="http://lists.digium.com/mailman/listinfo/asterisk-users" target=_blank>http://lists.digium.com/mailman/listinfo/asterisk-users</A><BR></DIV></DIV></div><br>
</body></html>