Thread: [Asterisk-java-users] OriginateAction.setVariable
Brought to you by:
srt
From: Tobias W. <tob...@ev...> - 2005-09-06 15:57:05
|
Hi, first of all i am still using asterisk-java-0.1 because i didn't want to disturb the AGIs presently in use :-S I wanted to set a Variable while i am originating a call. Here is what i wrote: OriginateAction originateAction = new OriginateAction(); originateAction.setChannel("Local/5000@test"); originateAction.setVariable("var1=TEST"); originateAction.setApplication("MeetMe"); originateAction.setData(number); originateAction.setTimeout(new Integer(30000)); ManagerResponse originateResponse = managerConnection.sendAction(originateAction, 30000); Here is the extension: exten => 5000,1,Answer() exten => 5000,2,NoOp(Our var should be printed here : ${var1}) exten => 5000,3,Playback(demo-abouttotry) exten => 5000,4,Hangup() The call is executed correctly and the sound is streamed into the conference, but the channel variable is not. I also have tried out an call file: Channel: Local/5000@test SetVar: var1=100 Application: MeetMe Data: 333 With the same result. Can anybody point me to my fault ?? Greetings, tobias |
From: Stefan R. <sr...@re...> - 2005-09-07 00:21:49
|
On Tue, 2005-09-06 at 17:56 +0200, Tobias Wolf wrote: > first of all i am still using asterisk-java-0.1 because i didn't want to=20 > disturb the AGIs presently in use :-S You can still use your "old" AGIs with Asterisk-Java 0.2-rc1 though you will get a compile time warning about using a deprecated API. > The call is executed correctly and the sound is streamed into the=20 > conference, but the channel variable is not. When originating a call two channels are involved. Let's asume you originate a call from A to B then what happens looks like: A channel is created to A: ----> A A is ringing When A is answered the second channel is created: ----> A ----> B The channel variables are set on the channel from A to B only. So when you change your example to OriginateAction originateAction =3D new OriginateAction(); originateAction.setChannel("Local/5000@test"); originateAction.setVariable("var1=3DTEST"); originateAction.setExten("5001"); originateAction.setContext("test"); originateAction.setPriority(new Integer(1)); originateAction.setTimeout(new Integer(30000)); and your extensions.conf to [test] exten =3D> 5000,1,Answer() exten =3D> 5000,2,NoOp(Our var is not printed here: ${var1}) exten =3D> 5000,3,Playback(demo-abouttotry) exten =3D> 5000,4,Hangup() exten =3D> 5001,1,NoOp(Our var is printed here: ${var1}) exten =3D> 5001,2,MeetMe(1) you will see that your channel variable is actually set on the channel to the MeetMe room. Does that help in your case? =3DStefan |
From: Tobias W. <tob...@ev...> - 2005-09-07 09:55:23
|
Stefan Reuter schrieb: > On Tue, 2005-09-06 at 17:56 +0200, Tobias Wolf wrote: > > You can still use your "old" AGIs with Asterisk-Java 0.2-rc1 though you > will get a compile time warning about using a deprecated API. > ok, thx for the info. i will keep that in mind ... > > > When originating a call two channels are involved. Let's asume you > originate a call from A to B then what happens looks like: > > A channel is created to A: > ----> A > A is ringing > When A is answered the second channel is created: > ----> A ----> B > The channel variables are set on the channel from A to B only. > > Does that help in your case? > thx for you explanation, it helps to improve my overall understanding of the concept, although i am not really happy with it, but this is something a have to live with, i guess :) the main idea of what i want to do is the following: stream an audio file (which is variable) into a conf room (which is also variable, of course). the problem is that i have to set something in 'A' and in 'B'. Since variables only appear in the called channel (B) it is only useful to send the conf room number per variable and the problem stucks with the file to stream, which has to be set in A. so i switched to use originateAction.setChannel("Local/"+number+"@confannounce"); originateAction.setApplication("Playback"); originateAction.setData(file); [confannounce] exten => _X.,1,NoOp(This is the conf room number in which to stream: ${EXTEN}) exten => _X.,2,MeetMe(${EXTEN}) exten => _X.,3,Hangup This approach connects to the Local Channel. I tried even to set variables in this szenario, but they does not apppear accordingly to the valuable information of Stefan. After the Channel is answered, wich is done by the MeetMe-Application, the Application is executed which is defined in the Originating-Action. so, in the end i think i have reached the behavior i wanted. thx for the help :) tobias |
From: Stefan R. <sr...@re...> - 2005-09-07 13:08:56
|
> so, in the end i think i have reached the behavior i wanted. ok. For more complex scenarios i like to join AGIs into a MeetMe conference. You basically use the OriginateAction to create a channel that executes a FastAGI and pass some kind of id via the AGI URL. Then its up to your application to provide a script for the AGI and look up what to do based on the id. =3DStefan |