RE: [Asterisk-java-users] asterisk manager can't get variable values
Brought to you by:
srt
From: Jason W. <jas...@be...> - 2006-02-04 18:10:58
|
Thanks for the help, I know I'm close, and just missing something minor. Perhaps I'm not in full understanding of how actions and responses work... I used ethereal to quickly look at the individual packets moving between my client and the asterisk server. I see that asterisk responds to my action with the value that I'm looking for. ManagerResponse actionResponse; GetVarAction getVarAction; getVarAction = new GetVarAction(); getVarAction.setVariable("CONSOLE"); actionResponse = managerConnection.sendAction(getVarAction,10000); System.out.println(actionResponse.toString()); //Why isn't the variable listed in here??? /* this is what I get from actionResponse.toSTring() net.sf.asterisk.manager.response.ManagerResponse: actionId='null'; message='null'; response='Success'; uniqueId='null'; */ String myVar = new String(); myVar = actionResponse.getVariable("CONSOLE"); // System.out.println("myVar=" + myVar); //myVar is null??? Well, if the problem isn't obvious from the code above then I guess I'm heading to the sourcecode to try and pinpoint my misunderstanding. Jason -----Original Message----- From: ast...@li... [mailto:ast...@li...]On Behalf Of María Chóliz Sent: Saturday, February 04, 2006 4:46 AM To: ast...@li... Subject: Re: [Asterisk-java-users] asterisk manager can't get variable values Hi, Jason, I have worked more with the manager_java, not with fastagi, but I think I might try to help you, or I hope so. The code you have just sent does what it should.Visit this page: http://asterisk-java.sourceforge.net/apidocs/net/sf/asterisk/fastagi/command /GetVariableCommand.html see: getVariable() Returns the name of the variable to retrieve. Have you tried witth actions of Manager. If you arer using a version of Asterisk under 1.2...you can set a local variable in the dialplan by using the action SetVarAction, and then getting the value with GetVarAction. Or setting the value in the dialplan and getting it with getvaraction. Getvarction only works with local variables under version 1.2 asterisk , from 1.2 it works also with global variables. I hope this helped you, good luck! |