Thread: [Asterisk-java-users] setVarAction Issue
Brought to you by:
srt
|
From: Rounak S. <rou...@gm...> - 2013-06-13 06:30:38
|
Hi,
I am using setVarAction command in my Hello manager(given in tutorial)
class to set variable in a context(incoming-call)
variable="context,extension,priority"
i.e number="incoming-call,301,1"
*
*
*Extensions.conf*
[incoming-call]
exten=>300,1,Answer()
same=>n,Goto(${number})
exten=>301,1,Playback(/home/atul/Desktop/b)
same=>n,Hangup()
*Sip.conf*
[1000abc]
type=peer
nat=yes
qualify=no
allow=all
udpbindaddr=0.0.0.0
bindaddr=0.0.0.0
secret=mysecret
host=dynamic
context=incoming-call
*Java Program*
{
OriginateAction originateAction;
SetVarAction setVarAction=new SetVarAction();
ManagerResponse originateResponse;
managerConnection.login();
String sip="SIP/1000abc";String context="incoming-call";
s*etVarAction.setChannel("SIP/1000abc");*
* setVarAction.setVariable("number");*
* setVarAction.setValue("incoming-call,301,1");*
* *
originateAction = new OriginateAction();
originateAction.setChannel(sip);
originateAction.setContext(context);
originateAction.setExten("300");
originateAction.setPriority(new Integer(1));
originateAction.setTimeout(Long.valueOf(30000));
originateAction.setAsync(true);
originateResponse =
managerConnection.sendAction(originateAction,10000);
managerConnection.logoff();
}
Error:WARNING[5345]: pbx.c:10560 pbx_parseable_goto: Goto requires an
argument ([[context,]extension,]priority)
== Spawn extension (incoming-call, 300, 2) exited non-zero on
'SIP/1000abc-00000000'
|
|
From: Yves A. <yv...@gm...> - 2013-06-13 07:01:03
|
Hi,
it seems, you are at the very beginning of your AJ-experiments have some
misunderstandings concerning asterisk and asterisk-java.
Jumping in in the dialplan just cannot be done this way... instantiating
a SetVarAction Object only does not help at all... the action has
to be "fired" anyhow... but even if you would have done, it would not
have the desired result.
- If you want your call to move from ext. 300 to ext. 301 you have to
make a transfer.
- The "Channel" asterisk uses during a call is not equal to the name of
the registered SIP device... if may be a part of it though... so
addressing the channel "1000abc" makes no sense, because this channel
will never exist...
- instead using "Long.valueOf(30000)" you can optimize your code and
just write "30000l" (a small letter L after the numbers)
- for these kind of experiments I´d recommend using an AGI...
yves
Am 13.06.2013 08:30, schrieb Rounak Saha:
> Hi,
> I am using setVarAction command in my Hello manager(given in tutorial)
> class to set variable in a context(incoming-call)
> variable="context,extension,priority"
> i.e number="incoming-call,301,1"
> *
> *
> *Extensions.conf*
> [incoming-call]
> exten=>300,1,Answer()
> same=>n,Goto(${number})
>
> exten=>301,1,Playback(/home/atul/Desktop/b)
> same=>n,Hangup()
>
> *Sip.conf*
> [1000abc]
> type=peer
> nat=yes
> qualify=no
> allow=all
> udpbindaddr=0.0.0.0
> bindaddr=0.0.0.0
> secret=mysecret
> host=dynamic
> context=incoming-call
>
> *Java Program*
> {
> OriginateAction originateAction;
> SetVarAction setVarAction=new SetVarAction();
> ManagerResponse originateResponse;
> managerConnection.login();
> String sip="SIP/1000abc";String context="incoming-call";
> s*etVarAction.setChannel("SIP/1000abc");*
> * setVarAction.setVariable("number");*
> *setVarAction.setValue("incoming-call,301,1");*
> **
> originateAction = new OriginateAction();
> originateAction.setChannel(sip);
> originateAction.setContext(context);
> originateAction.setExten("300");
> originateAction.setPriority(new Integer(1));
> originateAction.setTimeout(Long.valueOf(30000));
> originateAction.setAsync(true);
> originateResponse =
> managerConnection.sendAction(originateAction,10000);
> managerConnection.logoff();
> }
> Error:WARNING[5345]: pbx.c:10560 pbx_parseable_goto: Goto requires an
> argument ([[context,]extension,]priority)
> == Spawn extension (incoming-call, 300, 2) exited non-zero on
> 'SIP/1000abc-00000000'
>
>
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
>
>
> _______________________________________________
> Asterisk-java-users mailing list
> Ast...@li...
> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users
|
|
From: Rounak S. <rou...@gm...> - 2013-06-13 08:44:10
|
Hii yves,
Sorry am new to Asterisk and Asterisk-java.
just after posting I realised that I havenot set the channel correct and
have not send it through manager connection.
I guessed it should be setChannel("incoming-call").But now it seems its
incorrect.
Actually I am working under a software for Hospital where I have to call
patients(as max as possible at a time) and remind them to take
medicine.Numbers and medicine to take will be extracted from hospital
Database
If you can suggest a good way to do it,then it will be great
What I though of doing was:
[incoming-call]
exten,300,1,Answer()
same=>n,Dial(DAHDI/GO/${number}) where number will be set using AMI under
a for loop,each time changing the number value.
Now I am just testing the various commands in Asterisk-Java.
This works fine in asterisk though.
*[incoming-call]*
exten=>300,1,Answer()
same=>n,Set(number="incoming-call,301,1")
same=>n,Goto(${number})
exten=>301,1,Playback(b)
So is there not a way to set variable in context?
I tried originateAction.setvariable("number",""value") but it didnot work
also.Whats the use of originateAction.setVariable command then?
- for these kind of experiments I´d recommend using an AGI...
As directed from my mentor(am doing GSOC http://www.google-melange.com/) I
can use AMI only.
Please help.
>
|
|
From: Yves A. <yv...@gm...> - 2013-06-13 09:14:32
|
pls. see inline.
regards,
yves
Am 13.06.2013 10:44, schrieb Rounak Saha:
> Hii yves,
> Sorry am new to Asterisk and Asterisk-java.
dont worry, we all have been beginners someday..
>
> just after posting I realised that I havenot set the channel correct
> and have not send it through manager connection.
> I guessed it should be setChannel("incoming-call").But now it seems
> its incorrect.
unfortunately not... "incoming-call" is one of your contexts.
>
> Actually I am working under a software for Hospital where I have to
> call patients(as max as possible at a time) and remind them to take
> medicine.Numbers and medicine to take will be extracted from hospital
> Database
> If you can suggest a good way to do it,then it will be great
this is too little info to make a qualified suggestion... If you want to
make all fully automagic system... you have to create some kind of
dialer, use TTS and some other enhanced techniques.
Not to hard to do, but maybe to difficult for a novice...
>
> What I though of doing was:
>
> [incoming-call]
> exten,300,1,Answer()
> same=>n,Dial(DAHDI/GO/${number}) where number will be set using AMI
> under a for loop,each time changing the number value.
>
> Now I am just testing the various commands in Asterisk-Java.
>
> This works fine in asterisk though.
>
> *[incoming-call]*
> exten=>300,1,Answer()
> same=>n,Set(number="incoming-call,301,1")
> same=>n,Goto(${number})
> exten=>301,1,Playback(b)
>
> So is there not a way to set variable in context?
> I tried originateAction.setvariable("number",""value") but it didnot
> work also.Whats the use of originateAction.setVariable command then?
A call usually has two channels involved... with setVariable you set the
variable on the first (initiating) channel. If you need to access these
variables
on the second channel, you must go another way. But again... you´re
trying the wrong approach. This way you would connect the extension 300 with
the dialled party, but as far as I understood, you want to call the
party and play a soundfile...?
Lets say you want to call 01-234567 and play the voicefile after
pickup... try this:
originateAction = new OriginateAction();
originateAction.setChannel("dahdi/g0/01234567");
originateAction.setContext("medicine");
originateAction.setExten("s");
originateAction.setPriority(1);
originateAction.setTimeout(30000l);
originateAction.setAsync(true);
and have the following context in your asterisk:
[medicine]
exten => s,1,Answer()
exten => s,n,Playback(your voicefile goes here)
exten => s,n,Hangup()
>
> - for these kind of experiments I´d recommend using an AGI...
> As directed from my mentor(am doing GSOC
> http://www.google-melange.com/) I can use AMI only.
>
> Please help.
>
>
>
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
>
>
> _______________________________________________
> Asterisk-java-users mailing list
> Ast...@li...
> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users
|
|
From: Rounak S. <rou...@gm...> - 2013-06-13 10:03:40
|
Hii,
yes I want to call the party and play a sound but the sound varies for
different party.
-If you want to make all fully automagic system... you have to create
some kind of dialer, use TTS and some other enhanced techniques.
Not to hard to do, but maybe to difficult for a novice...
yes I am aware that I will have to use TTS and other enhanced technique.I
could not get that "you have to create a dialer"?
In my system patient can call system and get redirected to java program
using agi , get information about health,bills etc (this will be conveyed
using tts).
Moreover I am creating another program using java manager AMI(my mentor
suggested me to use this) where hospital can call every patient from
database and play voice file which is different for different patients.
originateAction = new OriginateAction();
originateAction.setChannel("dahdi/g0/01234567");
As I have to dial 01234567 I doubt if setting channel to dahdi/go/01234567
will call 01234567.Will it?
originateAction.setContext("medicine");
originateAction.setExten("s");
originateAction.setPriority(1);
originateAction.setTimeout(30000l);
originateAction.setAsync(true);
and have the following context in your asterisk:
[medicine]
exten => s,1,Answer()
exten => s,n,*Playback(your voicefile goes here)*
exten => s,n,Hangup()
How will I change the filename under Playback?.Therefore I need some
variable that can be used through manager AMI.
As I want to call many patients at a time I also cant replace the file to
other each time but under same name.
This idea come to my mind.Is it good?Is there any better way?
[medicine]
exten=>_XX,1,Answer()
same=>n,Playback(${EXTEN})
same=>n,Hangup();
And I will store file name in that format from java accordingly.
Please let me know if there is any better way.
Moreover how many call can I make together in asterisk?
Thanks fro helping me.
On Thu, Jun 13, 2013 at 2:43 PM, Yves A. <yv...@gm...> wrote:
>
>
> pls. see inline.
>
> regards,
> yves
>
> Am 13.06.2013 10:44, schrieb Rounak Saha:
>
> Hii yves,
> Sorry am new to Asterisk and Asterisk-java.
>
>
> dont worry, we all have been beginners someday..
>
>
>
> just after posting I realised that I havenot set the channel correct and
> have not send it through manager connection.
> I guessed it should be setChannel("incoming-call").But now it seems its
> incorrect.
>
>
> unfortunately not... "incoming-call" is one of your contexts.
>
>
>
> Actually I am working under a software for Hospital where I have to call
> patients(as max as possible at a time) and remind them to take
> medicine.Numbers and medicine to take will be extracted from hospital
> Database
> If you can suggest a good way to do it,then it will be great
>
>
> this is too little info to make a qualified suggestion... If you want to
> make all fully automagic system... you have to create some kind of dialer,
> use TTS and some other enhanced techniques.
> Not to hard to do, but maybe to difficult for a novice...
>
>
> What I though of doing was:
>
> [incoming-call]
> exten,300,1,Answer()
> same=>n,Dial(DAHDI/GO/${number}) where number will be set using AMI
> under a for loop,each time changing the number value.
>
>
>
> Now I am just testing the various commands in Asterisk-Java.
>
> This works fine in asterisk though.
>
> *[incoming-call]*
> exten=>300,1,Answer()
> same=>n,Set(number="incoming-call,301,1")
> same=>n,Goto(${number})
>
> exten=>301,1,Playback(b)
>
> So is there not a way to set variable in context?
> I tried originateAction.setvariable("number",""value") but it didnot work
> also.Whats the use of originateAction.setVariable command then?
>
>
> A call usually has two channels involved... with setVariable you set the
> variable on the first (initiating) channel. If you need to access these
> variables
> on the second channel, you must go another way. But again... you´re trying
> the wrong approach. This way you would connect the extension 300 with
> the dialled party, but as far as I understood, you want to call the party
> and play a soundfile...?
> Lets say you want to call 01-234567 and play the voicefile after pickup...
> try this:
>
> originateAction = new OriginateAction();
> originateAction.setChannel("dahdi/g0/01234567");
> originateAction.setContext("medicine");
> originateAction.setExten("s");
> originateAction.setPriority(1);
> originateAction.setTimeout(30000l);
> originateAction.setAsync(true);
>
> and have the following context in your asterisk:
>
> [medicine]
> exten => s,1,Answer()
> exten => s,n,Playback(your voicefile goes here)
> exten => s,n,Hangup()
>
>
>
>
> - for these kind of experiments I´d recommend using an AGI...
> As directed from my mentor(am doing GSOC http://www.google-melange.com/)
> I can use AMI only.
>
> Please help.
>
>
>>
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
> http://p.sf.net/sfu/windows-dev2dev
>
>
>
> _______________________________________________
> Asterisk-java-users mailing lis...@li...://lists.sourceforge.net/lists/listinfo/asterisk-java-users
>
>
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> Asterisk-java-users mailing list
> Ast...@li...
> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users
>
>
|