Re: [Asterisk-java-users] Channel extraction.
Brought to you by:
srt
From: Jan du T. <jan...@de...> - 2005-12-12 09:53:04
|
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 ============================ |