Re: [Asterisk-java-users] Call is not initiating between two extensions through Asterisk-Java progr
Brought to you by:
srt
From: Miguel S. <m.s...@gm...> - 2013-11-06 18:49:58
|
The example should work. Try introducing some messages into your java-code (System.out.Println) or use jog4j jnstead El 06/11/2013 13:02, "Chandramouli P" <mou...@gm...> escribió: > Hi, > > I am completely new to Asterisk-Java and following *http://www.asterisk-java.org/development/tutorial.html > <http://www.asterisk-java.org/development/tutorial.html>* link. I am able > to execute basic "Hello AGI" example. > > Now, I am trying to execute "Hello Manager" example. But, nothing is > happening. > > I have two extensions (121, 115) and connected to my Asterisk server > through two soft phones (Xlite). I am able to make call between two > extensions directly. Now, I want to initiate a call from 121 to extension > 115 using Asterisk-Java program. > > *Please find my below configuration step by step:* > > 1) /etc/asterisk/manager.conf > [general] > enabled = yes > port = 5038 > bindaddr = 0.0.0.0 > > [manager] > secret=password > permit=0.0.0.0/0.0.0.0 > read=all > write=all > > 2) /etc/asterisk/sip.conf > > [121] > type=friend > username=121 > secret=cmp1 > callerid="cmp121" > host=dynamic > context=abcd > > [115] > type=friend > username=115 > secret=cmp2 > callerid="cmp115" > host=dynamic > context=abcd > > 3) /etc/asterisk/extensions.conf > > [abcd] > exten => 121,1,Dial(SIP/121,15) > exten => 121,2,Hangup > > exten => 115,1,Dial(SIP/115,15) > exten => 115,2,Hangup > > 4) HelloManager.java > > import java.io.IOException; > > import org.asteriskjava.manager.AuthenticationFailedException; > import org.asteriskjava.manager.ManagerConnection; > import org.asteriskjava.manager.ManagerConnectionFactory; > import org.asteriskjava.manager.TimeoutException; > import org.asteriskjava.manager.action.OriginateAction; > import org.asteriskjava.manager.response.ManagerResponse; > > public class HelloManager > { > private ManagerConnection managerConnection; > > public HelloManager() throws IOException > { > ManagerConnectionFactory factory = new ManagerConnectionFactory( > "localhost", "manager", "password"); > this.managerConnection = factory.createManagerConnection(); > } > > public void run() throws IOException, AuthenticationFailedException, > TimeoutException > { > OriginateAction originateAction; > ManagerResponse originateResponse; > > originateAction = new OriginateAction(); > originateAction.setChannel("SIP/121"); > originateAction.setContext("abcd"); > originateAction.setExten("115"); > originateAction.setPriority(new Integer(1)); > //originateAction.setTimeout(new Integer(30000)); > > managerConnection.login(); > originateResponse = managerConnection.sendAction(originateAction, > 30000); > > // print out whether the originate succeeded or not > System.out.println(originateResponse.getResponse()); > > managerConnection.logoff(); > } > > public static void main(String[] args) throws Exception > { > HelloManager helloManager; > > helloManager = new HelloManager(); > helloManager.run(); > } > } > > 5) Connected to Asterisk server (asterisk -rvvvvv) > 6) Start Asterisk-Java ( java -jar asterisk-java.jar) > 7) Compiled the program (javac -cp asterisk-java.jar HelloManager.java) > 8) HelloManager.class file is created. > > I executed the above 8 steps and not seeing any messages on Asterisk-Java > server console (on *:4573) and also not seeing any messages on Asterisk > server console. Call is also not forming between the extensions. After Step > 8 (I mean after creating the .class file), Do I need to execute any command? > > I tested AMI through Telnet and it connected successfully. Please find the > below output: > > # telnet 127.0.0.1 5038 > Trying 127.0.0.1... > Connected to 127.0.0.1. > Escape character is '^]'. > Asterisk Call Manager/1.3 > > Action: Login > UserName: manager > Secret: password > > I pressed "Enter" key two times and got the below output: > > Response: Success > Message: Authentication accepted > > What I need to do in addition? Any update would be appreciated. > > Thanks in advance. > > Regards, > Chandra. > > > ------------------------------------------------------------------------------ > November Webinars for C, C++, Fortran Developers > Accelerate application performance with scalable programming models. > Explore > techniques for threading, error checking, porting, and tuning. Get the most > from the latest Intel processors and coprocessors. See abstracts and > register > http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > |