Re: [Asterisk-java-users] "MonitorAction" always 'Exceeds TimeOut'
Brought to you by:
srt
From: Jose B. <pe...@gm...> - 2014-01-09 18:16:39
|
OK. I found the problem. If I use "managerconnection" as Eventlistener I cannot sendAction with it. I had to create a second "managerconnection without EventListener ManagerConnectionFactory factory = new ManagerConnectionFactory(...) this.managerConnection = factory.createManagerConnection(); ManagerConnectionFactory factory_2 = new ManagerConnectionFactory(...) this.managerConnection_2 = factory_2.createManagerConnection(); Should I create a second 'factory' as well or would it be enough with: ManagerConnectionFactory factory = new ManagerConnectionFactory(...) this.managerConnection = factory.createManagerConnection(); this.managerConnection_2 = factory.createManagerConnection(); On 3 January 2014 11:05, Jose Baez <pe...@gm...> wrote: > Oops! I receive "timeout exceed" exception for every Action. :((( > > Maybe my code is not properly written to handle Actions and their > responsess..... > > When I receive a specfic event I want to send an Action, but everytime I > "sendAction" it is a "timeout" exception. > > I'm running my program as: > > public void run() throws IOException, AuthenticationFailedException, > TimeoutException, InterruptedException { > > managerConnection.addEventListener(this); > managerConnection.login(); > > while (running) { > Thread.sleep(5000); > } > > managerConnection.logoff(); > } > > @Override > public void *onManagerEvent(ManagerEvent event)* { > > // If event is NewExtenEvent... > if (event.getClass() == NewExtenEvent.class) { > handleEvent((NewExtenEvent) event); > } > // If event is NewChannel... > else if ((event.getClass() == NewChannelEvent.class)) { > handleEvent((NewChannelEvent) event); > } > } > > Sometimes I "sendAction" in NewExtenEvent (with the code sent in the > previous email). > > > > > On 2 January 2014 17:01, Jose Baez <pe...@gm...> wrote: > >> Hi! >> >> I've been struggling a bit with >> asterisk-java-1.0.0.CI-20140101.jar (January 1st, 2014) and Asterisk v11.5 >> >> Whenever I run *"MonitorAction"* Asterisk-java replies with "TimeOut >> Exceed" exception, but Asterisk is recording OK. >> Same exception happens with "StopMonitor". >> >> try { >> managerConnection.sendAction(*new MonitorAction*(channel, >> filename, "WAV", true)); >> >> // Forcing a timeout still pops exception. >> //managerConnection.sendAction(*new MonitorAction*(channel, >> filename, "WAV", true), 1000); >> >> } catch (IOException ex) { >> System.out.println(ex); >> } catch (TimeoutException ex) { >> System.out.println(ex); >> } catch (IllegalArgumentException ex) { >> System.out.println(ex); >> } catch (IllegalStateException ex) { >> System.out.println(ex); >> } >> >> >> Any idea? >> > > |