Re: [Asterisk-java-users] Channel extraction.
Brought to you by:
srt
From: Jan du T. <jan...@de...> - 2005-12-12 11:15:16
|
The call.toString() yields: net.sf.asterisk.manager.Call: uniqueId=1134386044.15; reason=4; startTime=Mon Dec 12 13:07:58 GMT+02:00 2005; endTime=null; systemHashcode=8546123 Asterisk version: It is a CVS build, the show version command yields this: "Asterisk CVS HEAD built by root @ localhost.localdomain on a i686 running Linux on 2005-11-09 07:26:18 UTC" Stefan Reuter wrote: >please show me what call.toString() returns and which version of >asterisk you use. > >thx >stefan > > >Jan du Toit schrieb: > > >> Stefan Reuter wrote: >> >> >> >>>>My question is how do you extract this generated random number, so that >>>>one can succesfully hangup a channel using HangupAction? >>>> >>>> >>>> >>>> >>>The easy solution is to use DefaultAsteriskManager to originate the >>>call. Its originateCall method returns a Call object that contains the >>>channel name. >>>An other option is to listen for OriginateSuccess events (see the >>>HelloEvents example on how to do that) and extract the channel name from >>>that event. >>> >>>=Stefan >>> >>> >>> >>> >>I have the following piece of code: >> .... >> Originate org; >> Call call; >> managerConnection.login(); >> >> org = new Originate(); >> org.setChannel("SIP/Jan"); >> org.setContext("sgs"); >> org.setExten(getExtensionNumber()); >> org.setPriority(new Integer(1)); >> //set time before call must be picked up. >> org.setTimeout(new Long(30000)); >> >> call = this.asteriskManager.originateCall(org); >> str += "CALL:"+call.getChannel()+"\n"; //this method returns >>null. >> >> managerConnection.logoff(); >> .... >> >>The originateCall method is passed an Originate object configured with >>all the needed info. The DefaultAsteriskManager's originateCall method >>returns a Call object from which you can extract the channel name from >>the call, but this method when executed returns null. >> >>The call is succesfully made and answered. >> >>I'm still not getting to the channel name of the form >>"SIP/Jan-uniquerandom#" in order to sucesfully hangup. >> >> >> >>-- >>============================ >>Jan Gerryt du Toit >>Software Developer >>DecisionWorx >>Cell : +27721769536 >>============================ >> >> >> > > > -- ============================ Jan Gerryt du Toit Software Developer DecisionWorx Cell : +27721769536 ============================ |