Thread: [Asterisk-java-users] asteriskServer.getChannelByName Timeout waiting for events from StatusAction
Brought to you by:
srt
From: Jorge <gus...@gm...> - 2014-03-11 14:03:37
|
Hi: I have the next scenario. I am triying to call from pstn to a conference in Asterisk server. I have set up the dial plan so the main telephone number is the the conference so calling for example 555-555555 you get into the conference. My objective is capturing this channel from java to send tones from Asterisk to the phone. What I am triying to do is the next thing : managerEventListener = new ManagerEventListener(){ public void onManagerEvent(ManagerEvent event) { if(event instanceof MeetMeJoinEvent ){ MeetMeJoinEvent meetMeJoinEvent = (MeetMeJoinEvent) event; String server = meetMeJoinEvent.getServer(); meetMeJoinEvent.getCallerIdNum(); System.out.println(meetMeJoinEvent.getChannel()); try{ AsteriskChannel asteriskChannel = asteriskServer.getChannelByName(meetMeJoinEvent.getChannel()); System.out.println(asteriskChannel); //asteriskChannel.playDtmf("1"); System.out.println("terminado"); }catch(ManagerCommunicationException e){ logger.error("Error al obtener el canal " + e); System.out.println("Error " + e); } } } }; That is to say I am capturing the MeetMeJoinEvent to see when this phone has been connected to the conference. With this event I am able to get the channel name and with the instruction the channel structure but I get : "org.asteriskjava.live.ManagerCommunicationException: Timeout waiting for events from StatusAction" The great thing is that when I originate the call from Asterisk with "asteriskChannel = asteriskServer.originateToExtension("DAHDI/g0/" + numero, contexto , conferenciaNumeroSip, 1, 10000);" it is able to get the channel. Could you let me know what I am doing wrong? Thank you very much for your help. |
From: Yves A. <yv...@gm...> - 2014-03-11 15:49:57
|
Hi, Just to make sure I understand you right...: 1.) Phone x calls into your conference via pstn 2.) you want to "hijack" the channel or superimpose DTMF ? If you use asterisk 11.x you could do some specials like this, but to call via java into the conference and send the tones would be easier... or is it a constraint, that other users in the conference must not hear the tones? regards, yves Am 11.03.2014 15:03, schrieb Jorge: > Hi: > > I have the next scenario. I am triying to call from pstn to a > conference in Asterisk server. I have set up the dial plan so the main > telephone number is the the conference so calling for example > 555-555555 you get into the conference. > > My objective is capturing this channel from java to send tones from > Asterisk to the phone. What I am triying to do is the next thing : > > managerEventListener = new ManagerEventListener(){ > public void onManagerEvent(ManagerEvent event) { > if(event instanceof MeetMeJoinEvent ){ > MeetMeJoinEvent meetMeJoinEvent = > (MeetMeJoinEvent) event; > String server = meetMeJoinEvent.getServer(); > meetMeJoinEvent.getCallerIdNum(); > System.out.println(meetMeJoinEvent.getChannel()); > try{ > AsteriskChannel asteriskChannel = > asteriskServer.getChannelByName(meetMeJoinEvent.getChannel()); > System.out.println(asteriskChannel); > //asteriskChannel.playDtmf("1"); > System.out.println("terminado"); > }catch(ManagerCommunicationException e){ > logger.error("Error al obtener el canal " + e); > System.out.println("Error " + e); > } > } > } > }; > > That is to say I am capturing the MeetMeJoinEvent to see when this > phone has been connected to the conference. With this event I am able > to get the channel name and with the instruction the channel structure > but I get : "org.asteriskjava.live.ManagerCommunicationException: > Timeout waiting for events from StatusAction" > > The great thing is that when I originate the call from Asterisk with > "asteriskChannel = asteriskServer.originateToExtension("DAHDI/g0/" + > numero, contexto , conferenciaNumeroSip, 1, 10000);" it is able to get > the channel. > > Could you let me know what I am doing wrong? > > Thank you very much for your help. > > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and their > applications. Written by three acclaimed leaders in the field, > this first edition is now available. Download your free book today! > http://p.sf.net/sfu/13534_NeoTech > > > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users |
From: Jorge <gus...@gm...> - 2014-03-11 16:03:33
|
Hi : Thank you very much for your answer. What I would like to do is to send and receive dtmf tones when Asterisk call to a telephone o receive a call from a telephone. The problem I had I don´t know how to manage the call connection so I decided to call to a conference. On this way the call is not hung up while I am sending the tones. The idea is the other won´t listen the tones so I can manage n connections using only one conference room. I think 2) really dosen´t matter because no other data will flow throught this call only DTMF tones. I am not sure if I understood this point properly. You said "call via java into the conference and send the tones would be easier." I think this is right but I need to handle incoming calls, this why I need the channel. Do you need more information? Thank you for your answer. Jorge ---------------------------------------------------------------------------------------------------------------------------------------------- <https://twitter.com/#%21/correderajorge> <http://www.correderajorge.es/> En función de la *Ley Orgánica 15/1999*, este mensaje de correo electrónico y sus documentos adjuntos están dirigidos *exclusivamente* a los destinatarios especificados y su información es de uso *estrictamente privado* salvo que se especifique lo contrario. La información contenida puede ser *confidencial* y/o estar *legalmente protegida*. Si usted recibe este mensaje por *error*, por favor comuníqueselo inmediatamente al remitente y *elimínelo* ya que carece de autorización de todo tipo. *Se prohíbe expresamente* la revelación, distribución, impresión o copia de toda o alguna parte de la información contenida en este mensaje 2014-03-11 16:49 GMT+01:00 Yves A. <yv...@gm...>: > Hi, > > Just to make sure I understand you right...: > > 1.) Phone x calls into your conference via pstn > 2.) you want to "hijack" the channel or superimpose DTMF ? > > If you use asterisk 11.x you could do some specials like this, but to call > via java into the conference and send the tones would be easier... or > is it a constraint, that other users in the conference must not hear the > tones? > > regards, > yves > > > Am 11.03.2014 15:03, schrieb Jorge: > > Hi: > > I have the next scenario. I am triying to call from pstn to a conference > in Asterisk server. I have set up the dial plan so the main telephone > number is the the conference so calling for example 555-555555 you get into > the conference. > > My objective is capturing this channel from java to send tones from > Asterisk to the phone. What I am triying to do is the next thing : > > managerEventListener = new ManagerEventListener(){ > public void onManagerEvent(ManagerEvent event) { > if(event instanceof MeetMeJoinEvent ){ > MeetMeJoinEvent meetMeJoinEvent = (MeetMeJoinEvent) > event; > String server = meetMeJoinEvent.getServer(); > meetMeJoinEvent.getCallerIdNum(); > System.out.println(meetMeJoinEvent.getChannel()); > > try{ > AsteriskChannel asteriskChannel = > asteriskServer.getChannelByName(meetMeJoinEvent.getChannel()); > System.out.println(asteriskChannel); > //asteriskChannel.playDtmf("1"); > System.out.println("terminado"); > }catch(ManagerCommunicationException e){ > logger.error("Error al obtener el canal " + e); > System.out.println("Error " + e); > } > } > } > }; > > That is to say I am capturing the MeetMeJoinEvent to see when this phone > has been connected to the conference. With this event I am able to get the > channel name and with the instruction the channel structure but I get : > "org.asteriskjava.live.ManagerCommunicationException: Timeout waiting for > events from StatusAction" > > The great thing is that when I originate the call from Asterisk with > "asteriskChannel = asteriskServer.originateToExtension("DAHDI/g0/" + > numero, contexto , conferenciaNumeroSip, 1, 10000);" it is able to get the > channel. > > Could you let me know what I am doing wrong? > > Thank you very much for your help. > > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and their > applications. Written by three acclaimed leaders in the field, > this first edition is now available. Download your free book today!http://p.sf.net/sfu/13534_NeoTech > > > > _______________________________________________ > Asterisk-java-users mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > > > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and their > applications. Written by three acclaimed leaders in the field, > this first edition is now available. Download your free book today! > http://p.sf.net/sfu/13534_NeoTech > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > |
From: Yves A. <yv...@gm...> - 2014-03-12 07:21:16
|
hi, well... now I am more confused than before... would be helpful to read your scenario and objective from the beginning... Dont save words, the more you explain, the better... What is the purpose of sending DTMF into a conversation? Incoming calls can be handled either by hooking on events or routing the call to a (java-)agi. But again, as long as I do not exactly understand your objective / problem / scenario these are only common tips... yves Am 11.03.2014 17:03, schrieb Jorge: > Hi : > > Thank you very much for your answer. What I would like to do is to > send and receive dtmf tones when Asterisk call to a telephone o > receive a call from a telephone. The problem I had I don´t know how to > manage the call connection so I decided to call to a conference. On > this way the call is not hung up while I am sending the tones. > > The idea is the other won´t listen the tones so I can manage n > connections using only one conference room. > > I think 2) really dosen´t matter because no other data will flow > throught this call only DTMF tones. I am not sure if I understood this > point properly. > > You said "call via java into the conference and send the tones would > be easier." I think this is right but I need to handle incoming > calls, this why I need the channel. > > Do you need more information? > > Thank you for your answer. > > > > Jorge > > ---------------------------------------------------------------------------------------------------------------------------------------------- > > > <https://twitter.com/#%21/correderajorge> <http://www.correderajorge.es/> > > En función de la /Ley Orgánica 15/1999/, este mensaje de correo > electrónico y sus documentos adjuntos están dirigidos > /exclusivamente/ a los destinatarios especificados y su información es > de uso /estrictamente privado/ salvo que se especifique lo contrario. > La información contenida puede ser /confidencial/ y/o estar > /legalmente protegida/. Si usted recibe este mensaje por /error/, por > favor comuníqueselo inmediatamente al remitente y /elimínelo/ ya que > carece de autorización de todo tipo. /Se prohíbe expresamente/ la > revelación, distribución, impresión o copia de toda o alguna parte de > la información contenida en este mensaje > > > > 2014-03-11 16:49 GMT+01:00 Yves A. <yv...@gm... > <mailto:yv...@gm...>>: > > Hi, > > Just to make sure I understand you right...: > > 1.) Phone x calls into your conference via pstn > 2.) you want to "hijack" the channel or superimpose DTMF ? > > If you use asterisk 11.x you could do some specials like this, but > to call via java into the conference and send the tones would be > easier... or > is it a constraint, that other users in the conference must not > hear the tones? > > regards, > yves > > > Am 11.03.2014 15:03, schrieb Jorge: >> Hi: >> >> I have the next scenario. I am triying to call from pstn to a >> conference in Asterisk server. I have set up the dial plan so the >> main telephone number is the the conference so calling for >> example 555-555555 you get into the conference. >> >> My objective is capturing this channel from java to send tones >> from Asterisk to the phone. What I am triying to do is the next >> thing : >> >> managerEventListener = new ManagerEventListener(){ >> public void onManagerEvent(ManagerEvent event) { >> if(event instanceof MeetMeJoinEvent ){ >> MeetMeJoinEvent meetMeJoinEvent = >> (MeetMeJoinEvent) event; >> String server = meetMeJoinEvent.getServer(); >> meetMeJoinEvent.getCallerIdNum(); >> System.out.println(meetMeJoinEvent.getChannel()); >> try{ >> AsteriskChannel asteriskChannel = >> asteriskServer.getChannelByName(meetMeJoinEvent.getChannel()); >> System.out.println(asteriskChannel); >> //asteriskChannel.playDtmf("1"); >> System.out.println("terminado"); >> }catch(ManagerCommunicationException e){ >> logger.error("Error al obtener el canal " + e); >> System.out.println("Error " + e); >> } >> } >> } >> }; >> >> That is to say I am capturing the MeetMeJoinEvent to see when >> this phone has been connected to the conference. With this event >> I am able to get the channel name and with the instruction the >> channel structure but I get : >> "org.asteriskjava.live.ManagerCommunicationException: Timeout >> waiting for events from StatusAction" >> >> The great thing is that when I originate the call from Asterisk >> with "asteriskChannel = >> asteriskServer.originateToExtension("DAHDI/g0/" + numero, >> contexto , conferenciaNumeroSip, 1, 10000);" it is able to get >> the channel. >> >> Could you let me know what I am doing wrong? >> >> Thank you very much for your help. >> >> >> ------------------------------------------------------------------------------ >> Learn Graph Databases - Download FREE O'Reilly Book >> "Graph Databases" is the definitive new guide to graph databases and their >> applications. Written by three acclaimed leaders in the field, >> this first edition is now available. Download your free book today! >> http://p.sf.net/sfu/13534_NeoTech >> >> >> _______________________________________________ >> Asterisk-java-users mailing list >> Ast...@li... <mailto:Ast...@li...> >> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases > and their > applications. Written by three acclaimed leaders in the field, > this first edition is now available. Download your free book today! > http://p.sf.net/sfu/13534_NeoTech > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > <mailto:Ast...@li...> > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > > > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and their > applications. Written by three acclaimed leaders in the field, > this first edition is now available. Download your free book today! > http://p.sf.net/sfu/13534_NeoTech > > > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users |
From: Jorge <gus...@gm...> - 2014-03-13 14:09:37
|
Hi, Sorry :( . Let´s start again, I will try to clarify a bit the scenario. I am really new to Asterisk I will try to do my best. I want to talk to a device using DTMF tones using Asterisk. The main problem is that the device can call o receive a call to/from Asterisk. The main problem is that if the device is not connected to an extension (SIP extension) or to a conference, the device hang up the call so it is finished. My idea taken from here ( http://blogtech.cardosi.net/2014/01/15/tutorial-on-lamj-part-4/) is connecting the device to a conference. And sending the DTMF tones using the channel that has been created. Is it right? Do you have a better solution? First case, If Asterisk calls I use (from http://blogtech.cardosi.net/2014/01/15/tutorial-on-lamj-part-4) : AsteriskChannel asteriskChannel = asteriskServer.originateToExtension(channelName, "default", "8600", 1, 10000); asteriskChannel.playDtmf("1"); And a listener that detects the DTMF event that arrives. Like this (more or less, it is not the exact code I am using) : ManagerConnectionFactory factory = new ManagerConnectionFactory( ip, user, password); managerConnection = factory.createManagerConnection(); // login to Asterisk managerConnection.login(); // Instantiate a new AsteriskServer asteriskServer = new AsteriskServerImpl(managerConnection); managerConnection.addEventListener(new ManagerEventListener(){ public void onManagerEvent(ManagerEvent event) { if (event instanceof DtmfEvent) { ... Second case and here is the problem. What I have done is setting up the incoming calls to the conference. So when the device calls the input is directed to the conference and starts sending DTMF tones. With the DTMF tone I get the channel name (DtmfEvent.getChannel()) but when I try to get the channel object from the channel name (asteriskServer.getChannelByName(mensaje.getCanal());) is where I have the error. "org.asteriskjava.live.ManagerCommunicationException: Timeout waiting for events from StatusAction" Please, let me know what is not explained and done properly. Kind regards and thank you for your help. |
From: Yves A. <yv...@gm...> - 2014-03-13 17:52:15
|
Hi, so... if this is not a human call and all you need is call to or receive a call from such a device and kind of control it via dtmf, then I would recommend to use an (java-) agi-script. For an incoming call you route the call to your script and the device is connected to the channel you control with your agi... as long as your script or the device hangs up. For an outgoing call just initiate a call between your extension that routes to the agi-script and the extension / number you have to dial to reach your device. within the agi you have access to the channel and can directly send or receive dtmf-tones. if you want to use java agi scripts, take a look at the docs for asterisk-java. there is a tutorial. java-agi is really great... see it as some kind of a java-dialplan. the only annoying thing is that you have to reload the agi-server each time you modify your agi-classes, as they are cached... I wrote a wrapper that allows me to write java-agi in a text-file that are executed in realtime... so i dont have to compile and deploy them anytime... just change the script and without reloading the server the changes immediately become applied in the next run... yves Am 13.03.2014 15:09, schrieb Jorge: > Hi, > Sorry :( . Let´s start again, I will try to clarify a bit the > scenario. I am really new to Asterisk I will try to do my best. > > I want to talk to a device using DTMF tones using Asterisk. The main > problem is that the device can call o receive a call to/from Asterisk. > The main problem is that if the device is not connected to an > extension (SIP extension) or to a conference, the device hang up the > call so it is finished. > > My idea taken from here > (http://blogtech.cardosi.net/2014/01/15/tutorial-on-lamj-part-4/) is > connecting the device to a conference. And sending the DTMF tones > using the channel that has been created. Is it right? Do you have a > better solution? > > First case, If Asterisk calls I use (from > http://blogtech.cardosi.net/2014/01/15/tutorial-on-lamj-part-4) : > AsteriskChannel asteriskChannel = asteriskServer.originateToExtension(channelName, "default", "8600", 1, 10000); > asteriskChannel.playDtmf("1"); > And a listener that detects the DTMF event that arrives. Like this > (more or less, it is not the exact code I am using) : > ManagerConnectionFactory factory = new ManagerConnectionFactory( > ip, user, password); > managerConnection = factory.createManagerConnection(); > // login to Asterisk > managerConnection.login(); > // Instantiate a new AsteriskServer > asteriskServer = new AsteriskServerImpl(managerConnection); > managerConnection.addEventListener(new ManagerEventListener(){ > public void onManagerEvent(ManagerEvent event) { > if (event instanceof DtmfEvent) { ... > > Second case and here is the problem. What I have done is setting up > the incoming calls to the conference. So when the device calls the > input is directed to the conference and starts sending DTMF tones. > With the DTMF tone I get the channel name (DtmfEvent.getChannel()) > but when I try to get the channel object from the channel name > (asteriskServer.getChannelByName(mensaje.getCanal());) is where I have > the error. > > "org.asteriskjava.live.ManagerCommunicationException: Timeout waiting > for events from StatusAction" > > Please, let me know what is not explained and done properly. > > Kind regards and thank you for your help. > > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and their > applications. Written by three acclaimed leaders in the field, > this first edition is now available. Download your free book today! > http://p.sf.net/sfu/13534_NeoTech > > > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users |