<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;color:#000000;"><div>Hello folks,<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; but the audio stops, no ringing.<br><br>Do you have any solution.<br><br>thanks for your help <br><br></div>
</div><br>
</body></html>