RE: [Asterisk-java-users] Manager.originateAction tutorial and 'error'
Brought to you by:
srt
From: Darren H. <dha...@gh...> - 2006-02-21 17:24:05
|
fixed - nothing to do with the library, the softphone wasn't registered with the server (could call out, but not call too). =20 Thanks, I will definately used the information you provided for future debugging :-) =20 -D ________________________________ From: ast...@li... [mailto:ast...@li...] On Behalf Of Jason Wolfe Sent: Tuesday, February 21, 2006 11:58 AM To: ast...@li... Subject: RE: [Asterisk-java-users] Manager.originateAction tutorial and 'error' =09 =09 I always recomend the following to new users, it's very helpful in the learning curve. =20 =09 this is cut from a previous post****************************************************** =20 I did a couple of things to make sure I was making the most of events... You might find it useful to try the following... =20 1. Use a program like Ethereal to sniff packets being recieved by your server running Manager. This way you see exactly what you're getting. You can filter to only show packets from the asterisk machine, and then you can do a test of the situation that you want to capture and see if asterisk is telling you what you need. 2. Look into 'user defined events' http://www.voip-info.org/wiki/view/Asterisk+cmd+UserEvent 3. grep on the entire asterisk directory for the currently generated events, I'm sure what your looking for would be in in channel.c if it exists, or trust the list at http://www.voip-info.org/wiki/view/asterisk+manager+events 4. if you look at the source for asterisk, you'll see that it's not hard to add events right in the source code and recompile if it's mission critical. 5. as well, Stefan did a great job of laying out Asterisk-java, so you could download the source and add a class for your handler if you create one. =20 =09 ************************************************************************ * use System.out.println(originateResponse.toString()); // to see the entire list sent back by asterisk =20 having said that, and taking a look at your code, I don't see an obvious problem, so I recomend the following... backup and divide the problem into smaller steps...=20 1. Are you able to use the dial() applicaiton successfully in the extensions.conf file? if so move to step 2 2. don't dial directly into an app if it's not necessary... dial into an extension, then execute the app, this way Asterisk creates the default CDR's. 3. start asterisk with 'asterisk -cvvvvvvvvvv' (10 v's or so) then check out what it's reporting when you run the java app. 4. check out the asterisk log files. =20 Jason Wolfe, CTO Click For A Call, Inc. ja...@cl... c (770) 561-6956 =09 This e-mail transmission may contain information that is proprietary, privileged and/or confidential and is intended exclusively for the person(s) to whom it is addressed. Any use, copying, retention or disclosure by any person other than the intended recipient or the intended recipient's designees is strictly prohibited. If you are not the intended recipient or their designee, please notify the sender immediately by return e-mail and delete all copies. -----Original Message----- From: ast...@li... [mailto:ast...@li...]On Behalf Of Darren Hartford Sent: Tuesday, February 21, 2006 11:26 AM To: ast...@li... Subject: RE: [Asterisk-java-users] Manager.originateAction tutorial and 'error' =09 =09 Thanks Jason! It's not that different from http://asterisk-java.sourceforge.net/tutorial.html, just more sysouts to verify assumptions and trying setApplication/setData versions from a previous thread on the mailing list. The phones are SIP softphones (x-lite) if that makes a difference (and they are calling back and forth fine). =20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3Dcode from run() = =3D=3D=3D=3D=3D=3D=3D=3D OriginateAction originateAction; ManagerResponse originateResponse; =20 originateAction =3D new OriginateAction(); originateAction.setChannel("SIP/201"); //my phone =09 /* * Below are various attempts to make the call */ =20 originateAction.setApplication("Dial"); originateAction.setData("SIP/200"); // originateAction.setData("200"); =20 =20 // originateAction.setContext("default"); // originateAction.setContext("external"); // originateAction.setExten("SIP/200"); // originateAction.setExten("200"); =20 originateAction.setPriority(new Integer(1)); =09 originateAction.setActionId("originateActionCallfromManagerAPI"); =09 // connect to Asterisk and log in System.out.println("logging in"); managerConnection.login(); System.out.println("connected. Attempting action"); =20 //verify for testing AsteriskServer as =3D managerConnection.getAsteriskServer(); managerConnection.sendAction(new StatusAction()); //this seems to be fine System.out.println(as.getHostname()); =20 // send the originate action and wait for a maximum of 30 seconds for Asterisk // to send a reply originateResponse =3D managerConnection.sendAction(originateAction, 30000); =20 // print out whether the originate succeeded or not //here, response is always 'Error', the actionId is the actionId above, and uniqueId is null System.out.println("The actionId is: " + originateResponse.getActionId()); System.out.println("The response Status is: " + originateResponse.getResponse()); System.out.println("The uniqueID is: " + originateResponse.getUniqueId()); =09 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3Dend code from run() = =3D=3D=3D=3D=3D=3D=3D=3D ________________________________ From: ast...@li... [mailto:ast...@li...] On Behalf Of Jason Wolfe Sent: Tuesday, February 21, 2006 11:14 AM To: ast...@li... Subject: RE: [Asterisk-java-users] Manager.originateAction tutorial and 'error' =09 =09 please post the relevant code and I'll try to help you out. =20 Jason -----Original Message----- From: ast...@li... [mailto:ast...@li...]On Behalf Of Darren Hartford Sent: Tuesday, February 21, 2006 10:57 AM To: ast...@li... Subject: [Asterisk-java-users] Manager.originateAction tutorial and 'error' =09 =09 Hey all,=20 N00b trying to learn this. Running Asterisk 1.2 and using binary lib distribution of asterisk-java-0.2.=20 Following the Tutorial, I've used the HelloManager class to connect to the server (and I can get the AsteriskServer and verify that information is correct). When I try to use the example to originate a call from my SIP/201 to a default Context/local 200 extension (or the setApp/SetData SIP/200 way from the mailing list), I keep getting back in the originateResponse.getResponse of 'Error'. Unfortunately, not very helpful in learning where the problem is. How should I debug to figure out what I should correct? Just trying to follow the tutorial to originate a call. Thanks,=20 -D=20 |