Re: [Asterisk-java-users] asteriskServer.getChannelByName Timeout waiting for events from StatusAct
Brought to you by:
srt
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 |