Re: [Asterisk-java-devel] B2BUA Fastagi
Brought to you by:
srt
From: Yves A. <yv...@gm...> - 2010-01-20 21:59:53
|
please read my last post. you have to get the channels, that are used for each call. these channel(id)s have to be passed to bridgeaction in order to work as expected. I still don`t see the dialplan you´re using (context [from-sip])... so I can´t see if the originate itself will work as expected... you have to keep in mind, that asterisk always needs two ends for a call... think of it as source and destination and from what I see below... even the originate can not work... (the response may say ok, because originating was ok, but the call gets hungup immediately...) you cannot make a call to an extension keeping the other end of the connection somewhere "in the air"... you must specify the extension to which the originateaction should connect the channel, if it could successfully build it... maybe you have some magic in your dialplan to handle this (e.g. some lines with s-priority holding the channel), but without posting the dialplan I cant see this.. take a look in the (verbose >=3) output of the cli when you execute your code... i am quite sure that your asterisk behaves like I write... If I go back to your original question, all you wanted was to connect to sip agents.., right? If so, you should simply add the highlighted line into your code... this would call 111 and connect it with 222 : [...] OriginateAction originateAction; ManagerResponse originateResponse; originateAction = new OriginateAction(); originateAction.setChannel("SIP/111"); * originateAction.setExten("222"); * originateAction.setContext("from-sip"); originateAction.setPriority(new Integer(1)); // connect to Asterisk and log in managerConnection.login(); originateResponse = managerConnection.sendAction(originateAction, 30000); // print out whether the originate succeeded or not System.out.println(originateResponse.getResponse()); [...] yves ahmed magdy schrieb: > i am using asterisk-java-1.0.0.CI-20091213.204518-75.jar. > Thanks > > On Wed, Jan 20, 2010 at 4:03 PM, ahmed magdy <ama...@gm... > <mailto:ama...@gm...>> wrote: > > I wrote this code to run the two channels > > OriginateAction originateAction; > ManagerResponse originateResponse; > originateAction = new OriginateAction(); > originateAction.setChannel("SIP/111"); > originateAction.setContext("from-sip"); > originateAction.setPriority(new Integer(1)); > > > // connect to Asterisk and log in > > > > managerConnection.login(); > > > originateResponse = > managerConnection.sendAction(originateAction, 30000); > > // print out whether the originate succeeded or not > System.out.println(originateResponse.getResponse()); > > > > originateAction.setChannel("SIP/222"); > > originateAction.setContext("from-sip"); > originateAction.setPriority(new Integer(1)); > originateResponse = > managerConnection.sendAction(originateAction, 30000); > > BridgeAction bridge; > bridge=new BridgeAction("SIP/111","SIP/222" ); > > On Wed, Jan 20, 2010 at 2:49 PM, Yves Arikoglu <yv...@gm... > <mailto:yv...@gm...>> wrote: > > Hi, > > whats missing: > - the dialplan (your context from-sip) > - the asterisk-java-version you use > > The code you gave does not show how you dial your extension > "222" or how > you try to bridge them. > The bridge-Action expects "channels" to bridge, not an > extension... the > command does not work that way! > So after you originate the calls to your sip-extensions, you > know the > channels, that are used and these channels > must be used for bridgeaction.... > > yves > > ahmed magdy schrieb: > > i am working on asterisk 1.6,2.0 > > when i initiate call to (111,222) ,it is working,the issue > now ,when i > > want to bridge the 2 calls, > > when i wrote > > BridgeAction bridge; > > bridge=new BridgeAction("SIP/111","SIP/222" ); > > > > Terminating reader thread:no lines available scanner closed > > > > On Wed, Jan 20, 2010 at 1:47 PM, David Fire > <dd...@gm... <mailto:dd...@gm...> > > <mailto:dd...@gm... <mailto:dd...@gm...>>> wrote: > > > > you forgot your question.... > > David > > > > 2010/1/20 ahmed magdy <ama...@gm... > <mailto:ama...@gm...> > > <mailto:ama...@gm... > <mailto:ama...@gm...>>> > > > > Asterisk 1.6.2.0 > > Java Code here > > import java.io.IOException; > > > > import org.asteriskjava.fastagi. > > AgiException; > > 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 b2bua { > > private ManagerConnection managerConnection; > > public b2bua() throws IOException > > { > > ManagerConnectionFactory factory = new > > ManagerConnectionFactory("192.168.50.132", "admin", > "secret5"); > > this.managerConnection = > > factory.createManagerConnection(); > > } > > > > public void run() throws IOException, > > AuthenticationFailedException, TimeoutException > > { > > > > OriginateAction originateAction; > > ManagerResponse originateResponse; > > originateAction = new OriginateAction(); > > originateAction.setChannel("SIP/111"); > > originateAction.setContext("from-sip"); > > originateAction.setPriority(new Integer(1)); > > > > 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 { > > // TODO code application logic here > > > > > > b2bua b; > > > > b = new b2bua(); > > b.run(); > > > > > > } > > > > sip.conf > > > > [general] > > port = 5060 ; Port to bind to (SIP is 5060) > > bindaddr = 192.168.1.x ; x = Asterisk server IP address > > allow = ulaw ; Allow all codecs > > context = bogon-calls ; Send SIP callers that we > don't know > > about here > > > > [111] > > type=friend > > username=111 > > secret=1234 > > host=dynamic > > context=from-sip > > mailbox=111 > > nat=yes > > canreinvite=no > > qualify=yes > > > > [222] > > type=friend > > username=222 > > secret=1234 > > host=dynamic > > context=from-sip > > mailbox=222 > > nat=yes > > canreinvite=no > > qualify=yes > > > > > > [1300] > > type=friend > > username=1300 > > secret=1234 > > host=dynamic > > context=from-sip > > mailbox=1300 > > nat=yes > > canreinvite=no > > qualify=yes > > > > > > [444] > > type=friend > > username=444 > > secret=1234 > > host=dynamic > > context=from-sip > > mailbox=444 > > nat=yes > > canreinvite=no > > qualify=yes > > > > I am running the program from netbeans. > > Thanks > > - Show quoted text - > > > > > > -- > > Ahmed Magdy Mahmoud > > > > > > > ------------------------------------------------------------------------------ > > Throughout its 18-year history, RSA Conference > consistently > > attracts the > > world's best and brightest in the field, creating > > opportunities for Conference > > attendees to learn about information security's most > important > > issues through > > interactions with peers, luminaries and emerging and > > established companies. > > http://p.sf.net/sfu/rsaconf-dev2dev > > _______________________________________________ > > Asterisk-java-devel mailing list > > Ast...@li... > <mailto:Ast...@li...> > > <mailto:Ast...@li... > <mailto:Ast...@li...>> > > > https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel > > > > > > > > > > -- > > (\__/) > > (='.'=)This is Bunny. Copy and paste bunny into your > > (")_(")signature to help him gain world domination. > > > > > > > ------------------------------------------------------------------------------ > > Throughout its 18-year history, RSA Conference consistently > > attracts the > > world's best and brightest in the field, creating > opportunities > > for Conference > > attendees to learn about information security's most > important > > issues through > > interactions with peers, luminaries and emerging and > established > > companies. > > http://p.sf.net/sfu/rsaconf-dev2dev > > _______________________________________________ > > Asterisk-java-devel mailing list > > Ast...@li... > <mailto:Ast...@li...> > > <mailto:Ast...@li... > <mailto:Ast...@li...>> > > > https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel > > > > > > > > > > -- > > Ahmed Magdy Mahmoud > > > > > ------------------------------------------------------------------------ > > > > > ------------------------------------------------------------------------------ > > Throughout its 18-year history, RSA Conference consistently > attracts the > > world's best and brightest in the field, creating > opportunities for Conference > > attendees to learn about information security's most > important issues through > > interactions with peers, luminaries and emerging and > established companies. > > http://p.sf.net/sfu/rsaconf-dev2dev > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Asterisk-java-devel mailing list > > Ast...@li... > <mailto:Ast...@li...> > > https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel > > > > > ------------------------------------------------------------------------------ > Throughout its 18-year history, RSA Conference consistently > attracts the > world's best and brightest in the field, creating > opportunities for Conference > attendees to learn about information security's most important > issues through > interactions with peers, luminaries and emerging and > established companies. > http://p.sf.net/sfu/rsaconf-dev2dev > _______________________________________________ > Asterisk-java-devel mailing list > Ast...@li... > <mailto:Ast...@li...> > https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel > > > > > -- > Ahmed Magdy Mahmoud > > > > > -- > Ahmed Magdy Mahmoud > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Throughout its 18-year history, RSA Conference consistently attracts the > world's best and brightest in the field, creating opportunities for Conference > attendees to learn about information security's most important issues through > interactions with peers, luminaries and emerging and established companies. > http://p.sf.net/sfu/rsaconf-dev2dev > ------------------------------------------------------------------------ > > _______________________________________________ > Asterisk-java-devel mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel > |