Re: [Asterisk-java-devel] How to Cancel a Dial command
Brought to you by:
srt
From: Jeryes . <je...@vo...> - 2012-01-04 21:23:23
|
Hi Yves, Happy new year and thanks for your quick reply!! Actually, I fixed the problem, sorry it was my fault... I'm working on an application based on fast-agi, and I've created an AsteriskServer that implements the interface BaseAgiScript, to receive and process calls from Asterisk. After receive a new call, the application dial to some destination (e.g. user1), and in some situation, like timeout of dialing, the application must cancel that Dial and create a new one to other destination, but I was doing in a wrong way, I was looking for a way to Cancel the Dial, and I guess that I can't do it, so I fixed the problem adding the timeout value in the Dial command, now the Asterisk is sending that Cancel when the timeout expires, and it's working: Example code of implementation: public class AsteriskServer extends BaseAgiScript { /** * The service method is called whenever AgiAsteriskServer receive a new * incoming AgiRequest. */ public void service(AgiRequest request, AgiChannel channel) throws AgiException { //Some code try { channel.exec("Dial", "SIP/user1, *20*"); } catch (Exception e) { //do something } finally { //do something } //Some code } } and *20* is the timeout to that destination. Now I'm facing another problem, the command Dial is not running on background, it keeps the Thread that executed the command in wait until the Dial sufers some dinconnection event (4xx, 5xx or 6xx) So do I need to create a new Thread to execute the command Dial? And is there another way besides the CLI to originate a new Call using fast-agi? Thank you!! Best regards Jeryes 2012/1/3 Yves A. <yv...@gm...> > Hi, > > happy new year, welcome to the list and congrats... you´re the first in > 2012! > reason enough for me to flood you with solutions, but.... > > you gave too little info...at least for me...: > - a few more lines of code would be helpful... full code would be best + > part of the dialplan where you call the agi.. > - what is your objective? > - any exceptions / interesting logs? > - how do you define timeout? I don´t see any at your dial command. > - what did you try so far and what was the result? > > regards, > yves > > > Am 03.01.2012 21:55, schrieb Jeryes .: > > Hi All, > > I'm using java fast-agi protocol, > and I'm dialing to new destinations based on the existing channel: > * > channel.exec("Dial","SIP/extension1")* > > and I'm facing a problem to cancel that dial if the call sufers a timeout, > and originate new call to other destination. Do someone have faced that > problem or have any idea to implement this scenario? > > I'm working with the versions below: > asterisk 1.6.2.22 > asterisk-java 1.0.0 > > Thanks in advance! > > Jeryes > > > ------------------------------------------------------------------------------ > Write once. Port to many. > Get the SDK and tools to simplify cross-platform app development. Create > new or port existing apps to sell to consumers worldwide. Explore the > Intel AppUpSM program developer opportunity. appdeveloper.intel.com/joinhttp://p.sf.net/sfu/intel-appdev > > > > _______________________________________________ > Asterisk-java-devel mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel > > > > > ------------------------------------------------------------------------------ > Write once. Port to many. > Get the SDK and tools to simplify cross-platform app development. Create > new or port existing apps to sell to consumers worldwide. Explore the > Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join > http://p.sf.net/sfu/intel-appdev > _______________________________________________ > Asterisk-java-devel mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel > > |