Thread: [Asterisk-java-users] Channel extraction.
Brought to you by:
srt
From: Jan du T. <jan...@de...> - 2005-12-09 14:46:58
|
Hi all. I used the OriginateAction to generate a call from the asterisk server on a channel to a certain extension. (Like the example on the tutorial page of the Asteriks-Java webpage@sourceforge.) The call is successfully generated. Now I want to hangup the call. I assume you want to use HangupAction. But hangupAction needs the exact channel id. A channel id for SIP for example will looks like this: "SIP/Jan-324bf". The first part of the channel id a person obviously know, because one configured OriginateAction with it. But Asterisks automatically generates a random number which is appended to the channel id to uniquley identify it. My question is how do you extract this generated random number, so that one can succesfully hangup a channel using HangupAction? Thank you. |
From: Stefan R. <sr...@re...> - 2005-12-09 14:55:56
|
> My question is how do you extract this generated random number, so that=20 > 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. =3DStefan |
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 ============================ |
From: Stefan R. <sr...@re...> - 2005-12-12 10:42:51
Attachments:
signature.asc
|
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 > ============================ > |
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 ============================ |
From: Stefan R. <sr...@re...> - 2005-12-12 11:28:23
Attachments:
signature.asc
|
ok, at least the unique id seems to be set. you can try to retrieve the channel like this: asteriskManager.getChannelById(call.getUniqueId()); and then extract the name there. plz tell me if that works for you =Stefan Jan du Toit schrieb: > 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 > ============================ > |
From: Jan du T. <jan...@de...> - 2005-12-12 11:54:43
|
asteriskManager.getChannelById(call.getUniqueId()); The asteriskManger must be cast to the DefaultAsteriskManager. This too returns null:( This is so weird because the call is being made. Stefan Reuter wrote: >ok, at least the unique id seems to be set. >you can try to retrieve the channel like this: > >asteriskManager.getChannelById(call.getUniqueId()); >and then extract the name there. > >plz tell me if that works for you > >=Stefan > >Jan du Toit schrieb: > > >> 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 >>============================ >> >> >> > > > -- ============================ Jan Gerryt du Toit Software Developer DecisionWorx Cell : +27721769536 ============================ |
From: Stefan R. <sr...@re...> - 2005-12-12 12:00:31
Attachments:
signature.asc
|
Jan du Toit schrieb: > The asteriskManger must be cast to the DefaultAsteriskManager. This too returns null:( > This is so weird because the call is being made. yes thats really strange... is the channel available if you call getChannels() on the DefaultAsteriskManager? if not can you send me a trace (using ngrep or sth. similar) of the events that your asterisk server sends? =Stefan |
From: Jan du T. <jan...@de...> - 2005-12-12 12:14:53
|
>Is the channel available if you callgetChannels() on the DefaultAsteriskManager? > > No the channel is not available. Trace of events: Dec 12, 2005 2:10:35 PM net.sf.asterisk.util.impl.JavaLoggingLog info INFO: Connecting to 196.0.0.195 port 5038 net.sf.asterisk.manager.event.ConnectEvent: dateReceived=Mon Dec 12 14:10:40 GMT+02:00 2005; systemHashcode=9042915 Dec 12, 2005 2:10:40 PM net.sf.asterisk.util.impl.JavaLoggingLog info INFO: Connected via Asterisk Call Manager/1.0 Dec 12, 2005 2:10:40 PM net.sf.asterisk.util.impl.JavaLoggingLog info INFO: Successfully logged in Dec 12, 2005 2:10:40 PM net.sf.asterisk.util.impl.JavaLoggingLog info INFO: Determined Asterisk version: Asterisk 1.2 net.sf.asterisk.manager.event.NewChannelEvent: dateReceived=Mon Dec 12 14:10:42 GMT+02:00 2005; privilege=call,all; systemHashcode=24212267 net.sf.asterisk.manager.event.NewCallerIdEvent: dateReceived=Mon Dec 12 14:10:42 GMT+02:00 2005; privilege=call,all; systemHashcode=20989238 net.sf.asterisk.manager.event.NewChannelEvent: dateReceived=Mon Dec 12 14:10:42 GMT+02:00 2005; privilege=call,all; systemHashcode=8379614 net.sf.asterisk.manager.event.NewStateEvent: dateReceived=Mon Dec 12 14:10:42 GMT+02:00 2005; privilege=call,all; systemHashcode=8225923 net.sf.asterisk.manager.event.NewExtenEvent: dateReceived=Mon Dec 12 14:10:42 GMT+02:00 2005; privilege=call,all; systemHashcode=8843841 net.sf.asterisk.manager.event.NewExtenEvent: dateReceived=Mon Dec 12 14:10:42 GMT+02:00 2005; privilege=call,all; systemHashcode=25872184 Is this the sort of trace you are looking for? >if not can you send me a trace (using ngrep or sth. similar) of the >events that your asterisk server sends? > >=Stefan > > -- ============================ Jan Gerryt du Toit Software Developer DecisionWorx Cell : +27721769536 ============================ |
From: Jan du T. <jan...@de...> - 2005-12-12 12:19:22
|
Sorry the previous trace is incorrect (it was generated running old code): Look at this one: net.sf.asterisk.manager.event.NewChannelEvent: dateReceived=Mon Dec 12 14:16:34 GMT+02:00 2005; privilege=call,all; systemHashcode=25872184 net.sf.asterisk.manager.event.NewCallerIdEvent: dateReceived=Mon Dec 12 14:16:34 GMT+02:00 2005; privilege=call,all; systemHashcode=1925270 net.sf.asterisk.manager.event.NewCallerIdEvent: dateReceived=Mon Dec 12 14:16:34 GMT+02:00 2005; privilege=call,all; systemHashcode=11546234 net.sf.asterisk.manager.event.NewChannelEvent: dateReceived=Mon Dec 12 14:16:34 GMT+02:00 2005; privilege=call,all; systemHashcode=12282550 net.sf.asterisk.manager.event.NewStateEvent: dateReceived=Mon Dec 12 14:16:39 GMT+02:00 2005; privilege=call,all; systemHashcode=5963049 net.sf.asterisk.manager.event.OriginateSuccessEvent: dateReceived=Mon Dec 12 14:16:39 GMT+02:00 2005; privilege=call,all; systemHashcode=27432475 net.sf.asterisk.manager.event.NewExtenEvent: dateReceived=Mon Dec 12 14:16:39 GMT+02:00 2005; privilege=call,all; systemHashcode=22936951 net.sf.asterisk.manager.event.NewExtenEvent: dateReceived=Mon Dec 12 14:16:39 GMT+02:00 2005; privilege=call,all; systemHashcode=28035001 net.sf.asterisk.manager.event.NewExtenEvent: dateReceived=Mon Dec 12 14:16:51 GMT+02:00 2005; privilege=call,all; systemHashcode=12934710 |
From: Jan du T. <jan...@de...> - 2005-12-12 12:43:00
|
The asteriskManager.getChannels(), is it suppose to show all the active channels on the asterisk server or just those that we originated using Asterisk-Java? asteriskManager.getChannels() is empty even if their is active channels open on the relevant asterisk server at the time of qeuring. Jan du Toit wrote: > Sorry the previous trace is incorrect (it was generated running old > code): > > Look at this one: > > net.sf.asterisk.manager.event.NewChannelEvent: dateReceived=Mon Dec 12 > 14:16:34 GMT+02:00 2005; privilege=call,all; systemHashcode=25872184 > net.sf.asterisk.manager.event.NewCallerIdEvent: dateReceived=Mon Dec > 12 14:16:34 GMT+02:00 2005; privilege=call,all; systemHashcode=1925270 > net.sf.asterisk.manager.event.NewCallerIdEvent: dateReceived=Mon Dec > 12 14:16:34 GMT+02:00 2005; privilege=call,all; systemHashcode=11546234 > net.sf.asterisk.manager.event.NewChannelEvent: dateReceived=Mon Dec 12 > 14:16:34 GMT+02:00 2005; privilege=call,all; systemHashcode=12282550 > net.sf.asterisk.manager.event.NewStateEvent: dateReceived=Mon Dec 12 > 14:16:39 GMT+02:00 2005; privilege=call,all; systemHashcode=5963049 > net.sf.asterisk.manager.event.OriginateSuccessEvent: dateReceived=Mon > Dec 12 14:16:39 GMT+02:00 2005; privilege=call,all; > systemHashcode=27432475 > net.sf.asterisk.manager.event.NewExtenEvent: dateReceived=Mon Dec 12 > 14:16:39 GMT+02:00 2005; privilege=call,all; systemHashcode=22936951 > net.sf.asterisk.manager.event.NewExtenEvent: dateReceived=Mon Dec 12 > 14:16:39 GMT+02:00 2005; privilege=call,all; systemHashcode=28035001 > net.sf.asterisk.manager.event.NewExtenEvent: dateReceived=Mon Dec 12 > 14:16:51 GMT+02:00 2005; privilege=call,all; systemHashcode=12934710 > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log > files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > -- ============================ Jan Gerryt du Toit Software Developer DecisionWorx Cell : +27721769536 ============================ |
From: Stefan R. <sr...@re...> - 2005-12-12 13:14:58
Attachments:
signature.asc
|
Jan du Toit schrieb: > The asteriskManager.getChannels(), is it suppose to show all the active > channels on the asterisk server or just those that we originated using > Asterisk-Java? it is supposed to return all active calls regardless who created them. i must try to reproduce this problem... does it happen with other versions of asterisk, too? (i.e. 1.0.x or 1.2.0) > asteriskManager.getChannels() is empty even if their is active channels > open on the relevant asterisk server at the time of qeuring. this is certainly not correct. |
From: Jan du T. <jan...@de...> - 2005-12-12 11:59:34
|
The Map collection result from asteriskManager.getChannels() is empty! But if I go through Asterik's command line and type show channels it is their. Stefan Reuter wrote: >ok, at least the unique id seems to be set. >you can try to retrieve the channel like this: > >asteriskManager.getChannelById(call.getUniqueId()); >and then extract the name there. > >plz tell me if that works for you > >=Stefan > >Jan du Toit schrieb: > > >> 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 >>============================ >> >> >> > > > -- ============================ Jan Gerryt du Toit Software Developer DecisionWorx Cell : +27721769536 ============================ |
From: Jan du T. <jan...@de...> - 2005-12-12 13:29:01
|
To reproduce the problem, here is the relevant code snippet: Originate org; Call call; //login... managerConnection.login(); org = new Originate(); org.setCallerId("JanDT"); org.setChannel("SIP/Jan"); org.setContext("sgs"); org.setExten(getExtensionNumber()); //this is just the number which we want to dial. org.setPriority(new Integer(1)); org.setTimeout(new Long(30000)); call = this.asteriskManager.originateCall(org); str += "CALL:"+call.getChannel()+"\n"; //this returns null str += "ID:"+call.getUniqueId()+"\n"; //this seems to return the ID correctly. Channel ch = (this.asteriskManager).getChannelById(call.getUniqueId()); if(ch != null) str += ch.toString(); else str += "Channel is NULL"; //it is null //try to see all the active channels... str += "Channels mappings\n"; Map c = this.asteriskManager.getChannels(); Collection channels = c.values(); str += "# of active channels:"+channels.size()+"\n"; //this is always 0, showing it is empty. for(Object cc : channels) { str += "channel:"+cc.toString()+"\n"; } //logoff managerConnection.logoff(); ... It is a 1.2 version. I have now quick way to check if this problem occurs on 1.0x vesrions either than by installing one:( Too give you some good news if you inject the HangupAction with a correct channel id (eg SIP\Jan-random#), which I got from the asterisk show channels command, it works correctly. Stefan Reuter wrote: >Jan du Toit schrieb: > > >>The asteriskManager.getChannels(), is it suppose to show all the active >>channels on the asterisk server or just those that we originated using >>Asterisk-Java? >> >> > >it is supposed to return all active calls regardless who created them. >i must try to reproduce this problem... does it happen with other >versions of asterisk, too? (i.e. 1.0.x or 1.2.0) > > > >>asteriskManager.getChannels() is empty even if their is active channels >>open on the relevant asterisk server at the time of qeuring. >> >> > >this is certainly not correct. > > -- ============================ Jan Gerryt du Toit Software Developer DecisionWorx Cell : +27721769536 ============================ |
From: Stefan R. <sr...@re...> - 2005-12-12 22:30:26
|
hmm here this stuff works. did you call initialize() in AsteriskManager? what i do is sth like: managerConnection =3D new DefaultManagerConnection(); managerConnection.setHostname("10.13.0.55"); managerConnection.setUsername("manager"); managerConnection.setPassword("pa55w0rd"); manager =3D new DefaultAsteriskManager(); manager.setManagerConnection(managerConnection); manager.initialize(); ... =3DStefan On Mon, 2005-12-12 at 15:27 +0200, Jan du Toit wrote: > To reproduce the problem, here is the relevant code snippet: > Originate org; > Call call; > //login... > managerConnection.login(); >=20 > org =3D new Originate(); > org.setCallerId("JanDT"); > org.setChannel("SIP/Jan"); > org.setContext("sgs"); > org.setExten(getExtensionNumber()); //this is just the > number which we want to dial. > org.setPriority(new Integer(1)); > org.setTimeout(new Long(30000)); =20 > =20 > call =3D this.asteriskManager.originateCall(org); > str +=3D "CALL:"+call.getChannel()+"\n"; //this returns null > str +=3D "ID:"+call.getUniqueId()+"\n"; //this seems to return > the ID correctly. > =20 > Channel ch =3D > (this.asteriskManager).getChannelById(call.getUniqueId()); > if(ch !=3D null) > str +=3D ch.toString(); > else > str +=3D "Channel is NULL"; //it is null > =20 > //try to see all the active channels... > str +=3D "Channels mappings\n"; > Map c =3D this.asteriskManager.getChannels(); > Collection channels =3D c.values(); > str +=3D "# of active channels:"+channels.size()+"\n"; > //this is always 0, showing it is empty. > for(Object cc : channels) { > str +=3D "channel:"+cc.toString()+"\n"; > } =20 >=20 > //logoff =20 > managerConnection.logoff(); > ... >=20 > It is a 1.2 version. I have now quick way to check if this problem > occurs on 1.0x vesrions either than by installing one:( >=20 > Too give you some good news if you inject the HangupAction with a > correct channel id (eg SIP\Jan-random#), which I got from the asterisk > show channels command, it works correctly. >=20 >=20 > Stefan Reuter wrote:=20 > > Jan du Toit schrieb: > > =20 > > > The asteriskManager.getChannels(), is it suppose to show all the acti= ve > > > channels on the asterisk server or just those that we originated usin= g > > > Asterisk-Java? > > > =20 > >=20 > > it is supposed to return all active calls regardless who created them. > > i must try to reproduce this problem... does it happen with other > > versions of asterisk, too? (i.e. 1.0.x or 1.2.0) > >=20 > > =20 > > > asteriskManager.getChannels() is empty even if their is active channe= ls > > > open on the relevant asterisk server at the time of qeuring. > > > =20 > >=20 > > this is certainly not correct. > > =20 >=20 >=20 > --=20 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > Jan Gerryt du Toit > Software Developer > DecisionWorx > Cell : +27721769536 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D |
From: Jan du T. <jan...@de...> - 2005-12-12 14:38:46
|
Hi. (Sorry for bombing the mailing list today). For the MonitorAction. Lets say we construct it as follows: = new MonitorAction("SIP\Jan-05gd","test"); Were exactly is the file test.wav saved? Is it on the server or on the machine were the java code is executed? I can't seem to find it:( Their is something in the JavaDocs that says the default is as the channel name in the CLI only with "-" replaced by "\" is the recorded file then in a directory structure as follows: SIP\Jan\05gd\test.wav? Can someone please tell me. Thank you. -- ============================ Jan Gerryt du Toit Software Developer DecisionWorx Cell : +27721769536 ============================ |
From: Stefan R. <sr...@re...> - 2005-12-13 00:01:33
|
the monitor files usually end up in /var/spool/asterisk/monitor on the asterisk box =3DStefan On Mon, 2005-12-12 at 16:36 +0200, Jan du Toit wrote: > Hi. >=20 > (Sorry for bombing the mailing list today). >=20 > For the MonitorAction. Lets say we construct it as follows: > =3D new MonitorAction("SIP\Jan-05gd","test"); >=20 > Were exactly is the file test.wav saved? Is it on the server or on the=20 > machine were the java code is executed? > I can't seem to find it:( >=20 > Their is something in the JavaDocs that says the default is as the=20 > channel name in the CLI only with "-" replaced by "\" is the recorded=20 > file then > in a directory structure as follows: SIP\Jan\05gd\test.wav? >=20 > Can someone please tell me. >=20 > Thank you. >=20 |