Thread: [Asterisk-java-devel] Error to process new calls on AsyncAgiServer
Brought to you by:
srt
From: Jeryes . <je...@vo...> - 2012-10-15 22:18:40
|
Hi All! I'm working with asterisk 1.6.3 and asterisk-java 1.0.0.M3, and I have an implementation of BaseAgiScript, that connects to Asterisk with AsyncAgiServer. After some calls, between 100 ou 200 , the agiscript stops to receive the *service* events, this error log is thrown instead: 16:19:33,040 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) [STDERR] 137706502 [Asterisk-Java ManagerConnection-1-Reader-0] WARN org.asteriskjava.fastagi.AsyncAgiServer - Unable to execute org.asteriskjava.fastagi.internal.AsyncAgiConnectionHandler 16:19:33,040 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) [STDERR] java.util.concurrent.RejectedExecutionException 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) [STDERR] at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:1768) 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) [STDERR] at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:767) 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) [STDERR] at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:658) 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) [STDERR] at org.asteriskjava.fastagi.AbstractAgiServer.execute(AbstractAgiServer.java:137) 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) [STDERR] at org.asteriskjava.fastagi.AsyncAgiServer.handleAsyncAgiEvent(AsyncAgiServer.java:89) 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) [STDERR] at org.asteriskjava.fastagi.AsyncAgiServer.onManagerEvent(AsyncAgiServer.java:68) 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) [STDERR] at org.asteriskjava.manager.internal.ManagerConnectionImpl.fireEvent(ManagerConnectionImpl.java:1245) 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) [STDERR] at org.asteriskjava.manager.internal.ManagerConnectionImpl.dispatchEvent(ManagerConnectionImpl.java:1229) 16:19:33,042 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) [STDERR] at org.asteriskjava.manager.internal.ManagerReaderImpl.run(ManagerReaderImpl.java:220) 16:19:33,042 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) [STDERR] at java.lang.Thread.run(Thread.java:619) The pool size is 1000, configured on file fastagi.properties: poolSize=1000 Can it be stuck threads, that should be released? Is there any way to check how many threads of the pool are in use? Thanks in advance! Regards Jeryes |
From: Brett S. <bs...@no...> - 2012-10-15 23:10:28
|
I would suggest that you get something like Visual VM which will give you and good idea of what your application is doing. Of course any decent dev environment like eclipse will tell you what threads a running and you can then pause them to see if and where they are stuck. Also reduce the pool to a really small number (10) and see if it gets stuck sooner. Brett On 16/10/12 09:18, Jeryes . wrote: > Hi All! > > I'm working with asterisk 1.6.3 and asterisk-java 1.0.0.M3, and I have > an implementation of BaseAgiScript, that connects to Asterisk with > AsyncAgiServer. After some calls, between 100 ou 200 , the agiscript > stops to receive the */service/* events, this error log is thrown instead: > > 16:19:33,040 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) > [STDERR] 137706502 [Asterisk-Java ManagerConnection-1-Reader-0] WARN > org.asteriskjava.fastagi.AsyncAgiServer - Unable to execute > org.asteriskjava.fastagi.internal.AsyncAgiConnectionHandler > 16:19:33,040 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) > [STDERR] java.util.concurrent.RejectedExecutionException > 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) > [STDERR] at > java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:1768) > > 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) > [STDERR] at > java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:767) > > 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) > [STDERR] at > java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:658) > > 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) > [STDERR] at > org.asteriskjava.fastagi.AbstractAgiServer.execute(AbstractAgiServer.java:137) > > 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) > [STDERR] at > org.asteriskjava.fastagi.AsyncAgiServer.handleAsyncAgiEvent(AsyncAgiServer.java:89) > > 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) > [STDERR] at > org.asteriskjava.fastagi.AsyncAgiServer.onManagerEvent(AsyncAgiServer.java:68) > > 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) > [STDERR] at > org.asteriskjava.manager.internal.ManagerConnectionImpl.fireEvent(ManagerConnectionImpl.java:1245) > > 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) > [STDERR] at > org.asteriskjava.manager.internal.ManagerConnectionImpl.dispatchEvent(ManagerConnectionImpl.java:1229) > > 16:19:33,042 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) > [STDERR] at > org.asteriskjava.manager.internal.ManagerReaderImpl.run(ManagerReaderImpl.java:220) > > 16:19:33,042 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) > [STDERR] at java.lang.Thread.run(Thread.java:619) > > > The pool size is 1000, configured on file fastagi.properties: > poolSize=1000 > > Can it be stuck threads, that should be released? Is there any way to > check how many threads of the pool are in use? > > Thanks in advance! > > Regards > Jeryes > > > > ------------------------------------------------------------------------------ > Don't let slow site performance ruin your business. Deploy New Relic APM > Deploy New Relic app performance management and know exactly > what is happening inside your Ruby, Python, PHP, Java, and .NET app > Try New Relic at no cost today and get our sweet Data Nerd shirt too! > http://p.sf.net/sfu/newrelic-dev2dev > > > _______________________________________________ > Asterisk-java-devel mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel |
From: Jeryes . <je...@vo...> - 2012-10-16 17:14:03
|
Thank you for the quick reply! I've just migrated to AsyncAgi, and I only changed the way the application connects to Asterisk, and how the application gets the channelName and uniqueID from AgiRequest, on service event. Is there other alterations that impacts on the migration from Sync to Async. Do I need to change the way that I invoke the commands on channel, like answer, streamFile, rec, playMusicOnHold ? The main idea to migrate to AsyncAgi, in a first step, is to process some events on AMI, like stoped MusicOnHold, which is not delivered to AMI Listener when using Sync connection. Brett, I reduced the pool to 5 threads and I couldn't reproduce that situation, maybe it is occurring in some exclusive types of call processing, so I gotta do more tests... Thanks! AgiScript: public class AsteriskServer extends BaseAgiScript { private CallEventListener callEventListener; public void service(AgiRequest request, AgiChannel channel) throws AgiException { * // I didn't find a better way the get those values...* *String[] paramList = ((String) request.getRequest().get("request")).split("\n"); String channelName = paramList[1].split(":")[1].trim(); String uniqueID = paramList[4].split(":")[1].trim();* String fromAddress = channel.getVariable("SIP_HEADER(FROM)"); String toAddress = channel.getVariable("SIP_HEADER(TO)"); // The event is added into a queue and treated by another threadpool, to release the current thread. callEventListener.callCreated(request, channel, fromAddress, toAddress, channelName, uniqueID); *// keep channel stuck while process the call, that will be released on disconnect command* waitProcessing(channel); } * //Command executed by CallEventListener to release the channel.* public void disconnect(AgiChannel channel) { processingDone(channel); } public void *waitProcessing*(AgiChannel channel) throws InterruptedException { System.out.println("wait until call get released..."); synchronized (channel) { channel.wait(); } } public void *processingDone*(AgiChannel channel) { System.out.println("releasing call..."); synchronized (channel) { channel.notify(); } } public void addCallEventListener(CallEventListener callEventListener) { this.callEventListener = callEventListener; } public void startup() { new AsyncAsteriskServerConnector(this, "192.168.192.32", "dev", "dev").connect(); } class *AsyncAsteriskServerConnector* implements Runnable { private BaseAgiScript agiScript; private ManagerConnection connection; public AsyncAsteriskServerConnector(BaseAgiScript agiScript, String ip, String username, String passwd) { this.agiScript = agiScript; connection = new DefaultManagerConnection(ip, username, passwd); } public ManagerConnection connect() { new Thread(this).start(); return connection; } public void run() { AsyncAgiServer agiServer = new AsyncAgiServer(agiScript); connection.addEventListener(agiServer); try { connection.login(); synchronized (this.agiScript) { agiScript.wait(); } } catch (Throwable e) {e.printStackTrace();} } } } 2012/10/15 Brett Sutton <bs...@no...> > I would suggest that you get something like Visual VM which will give you > and good idea of what your application is doing. > Of course any decent dev environment like eclipse will tell you what > threads a running and you can then pause them to see if and where they are > stuck. > > Also reduce the pool to a really small number (10) and see if it gets > stuck sooner. > > Brett > > > On 16/10/12 09:18, Jeryes . wrote: > > Hi All! > > I'm working with asterisk 1.6.3 and asterisk-java 1.0.0.M3, and I have an > implementation of BaseAgiScript, that connects to Asterisk with > AsyncAgiServer. After some calls, between 100 ou 200 , the agiscript stops > to receive the *service* events, this error log is thrown instead: > > 16:19:33,040 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) [STDERR] > 137706502 [Asterisk-Java ManagerConnection-1-Reader-0] WARN > org.asteriskjava.fastagi.AsyncAgiServer - Unable to execute > org.asteriskjava.fastagi.internal.AsyncAgiConnectionHandler > 16:19:33,040 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) [STDERR] > java.util.concurrent.RejectedExecutionException > 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) [STDERR] > at > java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:1768) > 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) [STDERR] > at > java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:767) > 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) [STDERR] > at > java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:658) > 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) [STDERR] > at > org.asteriskjava.fastagi.AbstractAgiServer.execute(AbstractAgiServer.java:137) > 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) [STDERR] > at > org.asteriskjava.fastagi.AsyncAgiServer.handleAsyncAgiEvent(AsyncAgiServer.java:89) > 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) [STDERR] > at > org.asteriskjava.fastagi.AsyncAgiServer.onManagerEvent(AsyncAgiServer.java:68) > 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) [STDERR] > at > org.asteriskjava.manager.internal.ManagerConnectionImpl.fireEvent(ManagerConnectionImpl.java:1245) > 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) [STDERR] > at > org.asteriskjava.manager.internal.ManagerConnectionImpl.dispatchEvent(ManagerConnectionImpl.java:1229) > 16:19:33,042 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) [STDERR] > at > org.asteriskjava.manager.internal.ManagerReaderImpl.run(ManagerReaderImpl.java:220) > 16:19:33,042 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) [STDERR] > at java.lang.Thread.run(Thread.java:619) > > > The pool size is 1000, configured on file fastagi.properties: > poolSize=1000 > > Can it be stuck threads, that should be released? Is there any way to > check how many threads of the pool are in use? > > Thanks in advance! > > Regards > Jeryes > > > > ------------------------------------------------------------------------------ > Don't let slow site performance ruin your business. Deploy New Relic APM > Deploy New Relic app performance management and know exactly > what is happening inside your Ruby, Python, PHP, Java, and .NET app > Try New Relic at no cost today and get our sweet Data Nerd shirt too!http://p.sf.net/sfu/newrelic-dev2dev > > > > _______________________________________________ > Asterisk-java-devel mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel > > > > > ------------------------------------------------------------------------------ > Don't let slow site performance ruin your business. Deploy New Relic APM > Deploy New Relic app performance management and know exactly > what is happening inside your Ruby, Python, PHP, Java, and .NET app > Try New Relic at no cost today and get our sweet Data Nerd shirt too! > http://p.sf.net/sfu/newrelic-dev2dev > _______________________________________________ > Asterisk-java-devel mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel > > |
From: Brett S. <bs...@no...> - 2012-10-17 01:05:42
|
I don't have enough info to provide a coherent answer. One thing to watch with async is that channel variables don't always appear immediately and so you some times need to poll for the channel vars. You should also investigate CountDownLatch as a replacement with wait notify as these don't do quite what you expect in all cases. e.g. wait can wake even when not notified. Brett On 17/10/12 04:13, Jeryes . wrote: > Thank you for the quick reply! > > I've just migrated to AsyncAgi, and I only changed the way the > application connects to Asterisk, and how the application gets the > channelName and uniqueID from AgiRequest, on service event. Is there > other alterations that impacts on the migration from Sync to Async. Do > I need to change the way that I invoke the commands on channel, like > answer, streamFile, rec, playMusicOnHold ? > The main idea to migrate to AsyncAgi, in a first step, is to process > some events on AMI, like stoped MusicOnHold, which is not delivered to > AMI Listener when using Sync connection. > > Brett, > > I reduced the pool to 5 threads and I couldn't reproduce that > situation, maybe it is occurring in some exclusive types of call > processing, so I gotta do more tests... > Thanks! > > AgiScript: > > > public class AsteriskServer extends BaseAgiScript > { > > private CallEventListener callEventListener; > > public void service(AgiRequest request, AgiChannel channel) throws > AgiException > { > * // I didn't find a better way the get those values...* > *String[] paramList = ((String) > request.getRequest().get("request")).split("\n"); > String channelName = paramList[1].split(":")[1].trim(); > String uniqueID = paramList[4].split(":")[1].trim();* > String fromAddress = channel.getVariable("SIP_HEADER(FROM)"); > String toAddress = channel.getVariable("SIP_HEADER(TO)"); > > // The event is added into a queue and treated by another > threadpool, to release the current thread. > callEventListener.callCreated(request, channel, fromAddress, > toAddress, channelName, uniqueID); > > *// keep channel stuck while process the call, that will be released > on disconnect command* > waitProcessing(channel); > } > > * //Command executed by CallEventListener to release the channel.* > public void disconnect(AgiChannel channel) > { > processingDone(channel); > } > > public void *waitProcessing*(AgiChannel channel) throws > InterruptedException > { > System.out.println("wait until call get released..."); > synchronized (channel) > { > channel.wait(); > } > } > > public void *processingDone*(AgiChannel channel) > { > System.out.println("releasing call..."); > synchronized (channel) > { > channel.notify(); > } > } > > public void addCallEventListener(CallEventListener callEventListener) > { > this.callEventListener = callEventListener; > } > > public void startup() > { > new AsyncAsteriskServerConnector(this, "192.168.192.32", > "dev", "dev").connect(); > } > > class *AsyncAsteriskServerConnector* implements Runnable > { > private BaseAgiScript agiScript; > private ManagerConnection connection; > > public AsyncAsteriskServerConnector(BaseAgiScript agiScript, > String ip, String username, String passwd) > { > this.agiScript = agiScript; > connection = new DefaultManagerConnection(ip, username, > passwd); > } > > public ManagerConnection connect() > { > new Thread(this).start(); > return connection; > } > > public void run() > { > AsyncAgiServer agiServer = new AsyncAgiServer(agiScript); > connection.addEventListener(agiServer); > > try > { > connection.login(); > synchronized (this.agiScript) > { > agiScript.wait(); > } > } catch (Throwable e) {e.printStackTrace();} > } > } > } > > > 2012/10/15 Brett Sutton <bs...@no... > <mailto:bs...@no...>> > > I would suggest that you get something like Visual VM which will > give you and good idea of what your application is doing. > Of course any decent dev environment like eclipse will tell you > what threads a running and you can then pause them to see if and > where they are stuck. > > Also reduce the pool to a really small number (10) and see if it > gets stuck sooner. > > Brett > > > On 16/10/12 09:18, Jeryes . wrote: >> Hi All! >> >> I'm working with asterisk 1.6.3 and asterisk-java 1.0.0.M3, and I >> have an implementation of BaseAgiScript, that connects to >> Asterisk with AsyncAgiServer. After some calls, between 100 ou >> 200 , the agiscript stops to receive the */service/* events, this >> error log is thrown instead: >> >> 16:19:33,040 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) >> [STDERR] 137706502 [Asterisk-Java ManagerConnection-1-Reader-0] >> WARN org.asteriskjava.fastagi.AsyncAgiServer - Unable to execute >> org.asteriskjava.fastagi.internal.AsyncAgiConnectionHandler >> 16:19:33,040 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) >> [STDERR] java.util.concurrent.RejectedExecutionException >> 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) >> [STDERR] at >> java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:1768) >> >> 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) >> [STDERR] at >> java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:767) >> >> 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) >> [STDERR] at >> java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:658) >> >> 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) >> [STDERR] at >> org.asteriskjava.fastagi.AbstractAgiServer.execute(AbstractAgiServer.java:137) >> >> 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) >> [STDERR] at >> org.asteriskjava.fastagi.AsyncAgiServer.handleAsyncAgiEvent(AsyncAgiServer.java:89) >> >> 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) >> [STDERR] at >> org.asteriskjava.fastagi.AsyncAgiServer.onManagerEvent(AsyncAgiServer.java:68) >> >> 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) >> [STDERR] at >> org.asteriskjava.manager.internal.ManagerConnectionImpl.fireEvent(ManagerConnectionImpl.java:1245) >> >> 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) >> [STDERR] at >> org.asteriskjava.manager.internal.ManagerConnectionImpl.dispatchEvent(ManagerConnectionImpl.java:1229) >> >> 16:19:33,042 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) >> [STDERR] at >> org.asteriskjava.manager.internal.ManagerReaderImpl.run(ManagerReaderImpl.java:220) >> >> 16:19:33,042 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) >> [STDERR] at java.lang.Thread.run(Thread.java:619) >> >> >> The pool size is 1000, configured on file fastagi.properties: >> poolSize=1000 >> >> Can it be stuck threads, that should be released? Is there any >> way to check how many threads of the pool are in use? >> >> Thanks in advance! >> >> Regards >> Jeryes >> >> >> >> ------------------------------------------------------------------------------ >> Don't let slow site performance ruin your business. Deploy New Relic APM >> Deploy New Relic app performance management and know exactly >> what is happening inside your Ruby, Python, PHP, Java, and .NET app >> Try New Relic at no cost today and get our sweet Data Nerd shirt too! >> http://p.sf.net/sfu/newrelic-dev2dev >> >> >> _______________________________________________ >> Asterisk-java-devel mailing list >> Ast...@li... <mailto:Ast...@li...> >> https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel > > > ------------------------------------------------------------------------------ > Don't let slow site performance ruin your business. Deploy New > Relic APM > Deploy New Relic app performance management and know exactly > what is happening inside your Ruby, Python, PHP, Java, and .NET app > Try New Relic at no cost today and get our sweet Data Nerd shirt too! > http://p.sf.net/sfu/newrelic-dev2dev > _______________________________________________ > Asterisk-java-devel mailing list > Ast...@li... > <mailto:Ast...@li...> > https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel > > > > > ------------------------------------------------------------------------------ > Don't let slow site performance ruin your business. Deploy New Relic APM > Deploy New Relic app performance management and know exactly > what is happening inside your Ruby, Python, PHP, Java, and .NET app > Try New Relic at no cost today and get our sweet Data Nerd shirt too! > http://p.sf.net/sfu/newrelic-dev2dev > > > _______________________________________________ > Asterisk-java-devel mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel |
From: Yves A. <yv...@gm...> - 2012-10-17 10:48:45
|
Hi, the code is not complete and I therefore cannot understand dependencies, what is called when and so on. help stucks here... but, as far as I can see... your code seems "overloaded"... or "very complicated"... meaning that the things you are trying to achive could be done "easier" and therefor even cleaner... but that reflects just my opinion after seeing the codefragments, without knowing exactly what your objective is... maybe you could clear that and I can further assist you. regards, yves Am 16.10.2012 19:13, schrieb Jeryes .: > Thank you for the quick reply! > > I've just migrated to AsyncAgi, and I only changed the way the > application connects to Asterisk, and how the application gets the > channelName and uniqueID from AgiRequest, on service event. Is there > other alterations that impacts on the migration from Sync to Async. Do > I need to change the way that I invoke the commands on channel, like > answer, streamFile, rec, playMusicOnHold ? > The main idea to migrate to AsyncAgi, in a first step, is to process > some events on AMI, like stoped MusicOnHold, which is not delivered to > AMI Listener when using Sync connection. > > Brett, > > I reduced the pool to 5 threads and I couldn't reproduce that > situation, maybe it is occurring in some exclusive types of call > processing, so I gotta do more tests... > Thanks! > > AgiScript: > > > public class AsteriskServer extends BaseAgiScript > { > > private CallEventListener callEventListener; > > public void service(AgiRequest request, AgiChannel channel) throws > AgiException > { > * // I didn't find a better way the get those values...* > *String[] paramList = ((String) > request.getRequest().get("request")).split("\n"); > String channelName = paramList[1].split(":")[1].trim(); > String uniqueID = paramList[4].split(":")[1].trim();* > String fromAddress = channel.getVariable("SIP_HEADER(FROM)"); > String toAddress = channel.getVariable("SIP_HEADER(TO)"); > > // The event is added into a queue and treated by another > threadpool, to release the current thread. > callEventListener.callCreated(request, channel, fromAddress, > toAddress, channelName, uniqueID); > > *// keep channel stuck while process the call, that will be released > on disconnect command* > waitProcessing(channel); > } > > * //Command executed by CallEventListener to release the channel.* > public void disconnect(AgiChannel channel) > { > processingDone(channel); > } > > public void *waitProcessing*(AgiChannel channel) throws > InterruptedException > { > System.out.println("wait until call get released..."); > synchronized (channel) > { > channel.wait(); > } > } > > public void *processingDone*(AgiChannel channel) > { > System.out.println("releasing call..."); > synchronized (channel) > { > channel.notify(); > } > } > > public void addCallEventListener(CallEventListener callEventListener) > { > this.callEventListener = callEventListener; > } > > public void startup() > { > new AsyncAsteriskServerConnector(this, "192.168.192.32", > "dev", "dev").connect(); > } > > class *AsyncAsteriskServerConnector* implements Runnable > { > private BaseAgiScript agiScript; > private ManagerConnection connection; > > public AsyncAsteriskServerConnector(BaseAgiScript agiScript, > String ip, String username, String passwd) > { > this.agiScript = agiScript; > connection = new DefaultManagerConnection(ip, username, > passwd); > } > > public ManagerConnection connect() > { > new Thread(this).start(); > return connection; > } > > public void run() > { > AsyncAgiServer agiServer = new AsyncAgiServer(agiScript); > connection.addEventListener(agiServer); > > try > { > connection.login(); > synchronized (this.agiScript) > { > agiScript.wait(); > } > } catch (Throwable e) {e.printStackTrace();} > } > } > } > > > 2012/10/15 Brett Sutton <bs...@no... > <mailto:bs...@no...>> > > I would suggest that you get something like Visual VM which will > give you and good idea of what your application is doing. > Of course any decent dev environment like eclipse will tell you > what threads a running and you can then pause them to see if and > where they are stuck. > > Also reduce the pool to a really small number (10) and see if it > gets stuck sooner. > > Brett > > > On 16/10/12 09:18, Jeryes . wrote: >> Hi All! >> >> I'm working with asterisk 1.6.3 and asterisk-java 1.0.0.M3, and I >> have an implementation of BaseAgiScript, that connects to >> Asterisk with AsyncAgiServer. After some calls, between 100 ou >> 200 , the agiscript stops to receive the */service/* events, this >> error log is thrown instead: >> >> 16:19:33,040 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) >> [STDERR] 137706502 [Asterisk-Java ManagerConnection-1-Reader-0] >> WARN org.asteriskjava.fastagi.AsyncAgiServer - Unable to execute >> org.asteriskjava.fastagi.internal.AsyncAgiConnectionHandler >> 16:19:33,040 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) >> [STDERR] java.util.concurrent.RejectedExecutionException >> 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) >> [STDERR] at >> java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:1768) >> >> 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) >> [STDERR] at >> java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:767) >> >> 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) >> [STDERR] at >> java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:658) >> >> 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) >> [STDERR] at >> org.asteriskjava.fastagi.AbstractAgiServer.execute(AbstractAgiServer.java:137) >> >> 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) >> [STDERR] at >> org.asteriskjava.fastagi.AsyncAgiServer.handleAsyncAgiEvent(AsyncAgiServer.java:89) >> >> 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) >> [STDERR] at >> org.asteriskjava.fastagi.AsyncAgiServer.onManagerEvent(AsyncAgiServer.java:68) >> >> 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) >> [STDERR] at >> org.asteriskjava.manager.internal.ManagerConnectionImpl.fireEvent(ManagerConnectionImpl.java:1245) >> >> 16:19:33,041 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) >> [STDERR] at >> org.asteriskjava.manager.internal.ManagerConnectionImpl.dispatchEvent(ManagerConnectionImpl.java:1229) >> >> 16:19:33,042 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) >> [STDERR] at >> org.asteriskjava.manager.internal.ManagerReaderImpl.run(ManagerReaderImpl.java:220) >> >> 16:19:33,042 ERROR (Asterisk-Java ManagerConnection-1-Reader-0) >> [STDERR] at java.lang.Thread.run(Thread.java:619) >> >> >> The pool size is 1000, configured on file fastagi.properties: >> poolSize=1000 >> >> Can it be stuck threads, that should be released? Is there any >> way to check how many threads of the pool are in use? >> >> Thanks in advance! >> >> Regards >> Jeryes >> >> >> >> ------------------------------------------------------------------------------ >> Don't let slow site performance ruin your business. Deploy New Relic APM >> Deploy New Relic app performance management and know exactly >> what is happening inside your Ruby, Python, PHP, Java, and .NET app >> Try New Relic at no cost today and get our sweet Data Nerd shirt too! >> http://p.sf.net/sfu/newrelic-dev2dev >> >> >> _______________________________________________ >> Asterisk-java-devel mailing list >> Ast...@li... <mailto:Ast...@li...> >> https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel > > > ------------------------------------------------------------------------------ > Don't let slow site performance ruin your business. Deploy New > Relic APM > Deploy New Relic app performance management and know exactly > what is happening inside your Ruby, Python, PHP, Java, and .NET app > Try New Relic at no cost today and get our sweet Data Nerd shirt too! > http://p.sf.net/sfu/newrelic-dev2dev > _______________________________________________ > Asterisk-java-devel mailing list > Ast...@li... > <mailto:Ast...@li...> > https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel > > > > > ------------------------------------------------------------------------------ > Don't let slow site performance ruin your business. Deploy New Relic APM > Deploy New Relic app performance management and know exactly > what is happening inside your Ruby, Python, PHP, Java, and .NET app > Try New Relic at no cost today and get our sweet Data Nerd shirt too! > http://p.sf.net/sfu/newrelic-dev2dev > > > _______________________________________________ > Asterisk-java-devel mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel |
From: Videanu A. <vid...@ya...> - 2012-11-08 11:56:21
|
Hi all, i have this scenario : 1- I do a login in asterisk 2 -get the queues (asteriskServer.getQueues()) 3 -add a new queue in asterisk/ restart asterisk server 4- get the queues (asteriskServer.getQueues()) this is not refreshed :( How can i refresh the asteriskServer.getQueues()? Regards, Adrian Videanu |
From: <Jac...@L-...> - 2012-11-08 13:54:10
|
Why are you doing a second getQueues() command? If you create a class that implements AsteriskServerListner interface and creates your DefaultAsteriskServer object it will automatically notify you when a new queue is add; onNewQueue method is called. Jacob From: Videanu Adrian [mailto:vid...@ya...] Sent: Thursday, November 08, 2012 5:56 AM To: ast...@li... Subject: [Asterisk-java-devel] Queue refresh Hi all, i have this scenario : 1- I do a login in asterisk 2 -get the queues (asteriskServer.getQueues()) 3 -add a new queue in asterisk/ restart asterisk server 4- get the queues (asteriskServer.getQueues()) this is not refreshed :( How can i refresh the asteriskServer.getQueues()? Regards, Adrian Videanu |
From: Videanu A. <vid...@ya...> - 2012-11-08 13:59:04
|
... fair enough, but in this case you should somehow maintain an "artificial and parallel" list of queues in your application. Am I right? Regards, Adrian Videanu --- On Thu, 11/8/12, Jac...@L-... <Jac...@L-...> wrote: From: Jac...@L-... <Jac...@L-...> Subject: Re: [Asterisk-java-devel] Queue refresh To: ast...@li... Date: Thursday, November 8, 2012, 3:46 PM Why are you doing a second getQueues() command? If you create a class that implements AsteriskServerListner interface and creates your DefaultAsteriskServer object it will automatically notify you when a new queue is add; onNewQueue method is called. Jacob From: Videanu Adrian [mailto:vid...@ya...] Sent: Thursday, November 08, 2012 5:56 AM To: ast...@li... Subject: [Asterisk-java-devel] Queue refresh Hi all, i have this scenario : 1- I do a login in asterisk 2 -get the queues (asteriskServer.getQueues()) 3 -add a new queue in asterisk/ restart asterisk server 4- get the queues (asteriskServer.getQueues()) this is not refreshed :( How can i refresh the asteriskServer.getQueues()? Regards, Adrian Videanu -----Inline Attachment Follows----- ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov -----Inline Attachment Follows----- _______________________________________________ Asterisk-java-devel mailing list Ast...@li... https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel |
From: <Jac...@L-...> - 2012-11-08 14:12:00
|
I guess that all depends on what your application is doing! I do not actually use Queues so not sure what you are doing with the queues once you have them. I would keep a local ArrayList of each Queue that contains the members of the queue. This approach would be useful for a Real-time system, if you are just getting the info and displaying it to a static web-page interface keeping an ArrayList of each queue would be a little bit of an over kill. Although you could still listen for the onNewQueueEntry and then get a static list if members for that queue and then update the simi-static page if that is what you are going for. Jacob From: Videanu Adrian [mailto:vid...@ya...] Sent: Thursday, November 08, 2012 7:59 AM To: ast...@li... Subject: Re: [Asterisk-java-devel] Queue refresh ... fair enough, but in this case you should somehow maintain an "artificial and parallel" list of queues in your application. Am I right? Regards, Adrian Videanu --- On Thu, 11/8/12, Jac...@L-... <Jac...@L-...> wrote: From: Jac...@L-... <Jac...@L-...> Subject: Re: [Asterisk-java-devel] Queue refresh To: ast...@li... Date: Thursday, November 8, 2012, 3:46 PM Why are you doing a second getQueues() command? If you create a class that implements AsteriskServerListner interface and creates your DefaultAsteriskServer object it will automatically notify you when a new queue is add; onNewQueue method is called. Jacob From: Videanu Adrian [mailto:vid...@ya...] Sent: Thursday, November 08, 2012 5:56 AM To: ast...@li... Subject: [Asterisk-java-devel] Queue refresh Hi all, i have this scenario : 1- I do a login in asterisk 2 -get the queues (asteriskServer.getQueues()) 3 -add a new queue in asterisk/ restart asterisk server 4- get the queues (asteriskServer.getQueues()) this is not refreshed :( How can i refresh the asteriskServer.getQueues()? Regards, Adrian Videanu -----Inline Attachment Follows----- ------------------------------------------------------------------------ ------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov -----Inline Attachment Follows----- _______________________________________________ Asterisk-java-devel mailing list Ast...@li... https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel |
From: Videanu A. <vid...@ya...> - 2012-11-08 14:38:50
|
thanks for hint and quick responses Jacob, indeed i try to build an liveMonitor application that will display in an ajax based webpage all the activity inside asteriskServer. Regards, Adrian Videanu --- On Thu, 11/8/12, Jac...@L-... <Jac...@L-...> wrote: From: Jac...@L-... <Jac...@L-...> Subject: Re: [Asterisk-java-devel] Queue refresh To: ast...@li... Date: Thursday, November 8, 2012, 4:10 PM I guess that all depends on what your application is doing! I do not actually use Queues so not sure what you are doing with the queues once you have them. I would keep a local ArrayList of each Queue that contains the members of the queue. This approach would be useful for a Real-time system, if you are just getting the info and displaying it to a static web-page interface keeping an ArrayList of each queue would be a little bit of an over kill. Although you could still listen for the onNewQueueEntry and then get a static list if members for that queue and then update the simi-static page if that is what you are going for. Jacob From: Videanu Adrian [mailto:vid...@ya...] Sent: Thursday, November 08, 2012 7:59 AM To: ast...@li... Subject: Re: [Asterisk-java-devel] Queue refresh ... fair enough, but in this case you should somehow maintain an "artificial and parallel" list of queues in your application. Am I right? Regards, Adrian Videanu --- On Thu, 11/8/12, Jac...@L-... <Jac...@L-...> wrote: From: Jac...@L-... <Jac...@L-...> Subject: Re: [Asterisk-java-devel] Queue refresh To: ast...@li... Date: Thursday, November 8, 2012, 3:46 PMWhy are you doing a second getQueues() command? If you create a class that implements AsteriskServerListner interface and creates your DefaultAsteriskServer object it will automatically notify you when a new queue is add; onNewQueue method is called. Jacob From: Videanu Adrian [mailto:vid...@ya...] Sent: Thursday, November 08, 2012 5:56 AM To: ast...@li... Subject: [Asterisk-java-devel] Queue refresh Hi all, i have this scenario : 1- I do a login in asterisk 2 -get the queues (asteriskServer.getQueues()) 3 -add a new queue in asterisk/ restart asterisk server 4- get the queues (asteriskServer.getQueues()) this is not refreshed :( How can i refresh the asteriskServer.getQueues()? Regards, Adrian Videanu -----Inline Attachment Follows----------------------------------------------------------------------------------- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov -----Inline Attachment Follows-----_______________________________________________ Asterisk-java-devel mailing list Ast...@li... https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel -----Inline Attachment Follows----- ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov -----Inline Attachment Follows----- _______________________________________________ Asterisk-java-devel mailing list Ast...@li... https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel |
From: Videanu A. <vid...@ya...> - 2012-11-12 08:19:31
|
Hi all, i have added a new class (PauseMixMonitorAction) to asterisk-java package that allows you to pause a recording performed with MixMonitor using asterisk manager command MixMonitorMute. This can be used from an asteriskChannel like this : asteriskChannel.pauseMixMonitor() or asteriskChannel.unPauseMixMonitor(). If there is anyone interested or is a way to commit that code to official repository please let me know. |
From: Stefan R. <ste...@re...> - 2012-11-12 13:04:04
|
On 2012-11-12 09:19, Videanu Adrian wrote: > If there is anyone interested or is a way to commit that code to > official repository please let me know. Sure just clone the repo at github and send me a pull request. =Stefan -- reuter network consulting Im Zollhafen 14 50678 Koeln Germany Telefon: +49 251 530289-20 Telefax: +49 251 530289-29 E-Mail: ste...@re... WWW: http://www.reucon.com Steuernummern 215/5140/1791 USt-IdNr. DE220701760 |
From: Brett S. <bs...@no...> - 2013-06-03 02:42:25
|
HI Stephan, I've got a long outstanding pull request on asterisk java. Is it possible for you to merge it? Or is there anything I can do to help? Brett On 12/11/12 23:46, Stefan Reuter wrote: > On 2012-11-12 09:19, Videanu Adrian wrote: >> If there is anyone interested or is a way to commit that code to >> official repository please let me know. > Sure just clone the repo at github and send me a pull request. > > =Stefan > |
From: Brett S. <bs...@no...> - 2012-11-13 11:57:00
|
Videanu, I have a fork on git hub. If you would like to send the patch to me I will apply it and then push it up. Brett Videanu Adrian <vid...@ya...> wrote: >Hi all, >i have added a new class (PauseMixMonitorAction) to asterisk-java >package that allows you to pause a recording performed with MixMonitor >using asterisk manager command MixMonitorMute. This can be used from an >asteriskChannel like this : >asteriskChannel.pauseMixMonitor() or >asteriskChannel.unPauseMixMonitor(). > >If there is anyone interested or is a way to commit that code to >official repository please let me know. > > >------------------------------------------------------------------------ > >------------------------------------------------------------------------------ >Everyone hates slow websites. So do we. >Make your web apps faster with AppDynamics >Download AppDynamics Lite for free today: >http://p.sf.net/sfu/appdyn_d2d_nov > >------------------------------------------------------------------------ > >_______________________________________________ >Asterisk-java-devel mailing list >Ast...@li... >https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. |
From: Videanu A. <vid...@ya...> - 2012-11-13 12:51:16
|
Hi Brett, i have already sent a pool request to Stephan (https://github.com/srt/asterisk-java/pull/16). I can send it to you either if you think this is necessary. Regards, Adrian Videanu --- On Mon, 11/12/12, Brett Sutton <bs...@no...> wrote: From: Brett Sutton <bs...@no...> Subject: Re: [Asterisk-java-devel] PauseMixMonitorAction To: ast...@li... Date: Monday, November 12, 2012, 10:33 AM Videanu, I have a fork on git hub. If you would like to send the patch to me I will apply it and then push it up. Brett Videanu Adrian <vid...@ya...> wrote: Hi all, i have added a new class (PauseMixMonitorAction) to asterisk-java package that allows you to pause a recording performed with MixMonitor using asterisk manager command MixMonitorMute. This can be used from an asteriskChannel like this : asteriskChannel.pauseMixMonitor() or asteriskChannel.unPauseMixMonitor(). If there is anyone interested or is a way to commit that code to official repository please let me know. Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov Asterisk-java-devel mailing list Ast...@li... https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. -----Inline Attachment Follows----- ------------------------------------------------------------------------------ Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov -----Inline Attachment Follows----- _______________________________________________ Asterisk-java-devel mailing list Ast...@li... https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel |
From: Brett S. <bs...@no...> - 2012-11-13 22:26:35
|
No if you have already down the pull all is good. Videanu Adrian <vid...@ya...> wrote: >Hi Brett, >i have already sent a pool request to Stephan >(https://github.com/srt/asterisk-java/pull/16). I can send it to you >either if you think this is necessary. > >Regards, > >Adrian Videanu > >--- On Mon, 11/12/12, Brett Sutton <bs...@no...> wrote: > >From: Brett Sutton <bs...@no...> >Subject: Re: [Asterisk-java-devel] PauseMixMonitorAction >To: ast...@li... >Date: Monday, November 12, 2012, 10:33 AM > >Videanu, > >I have a fork on git hub. If you would like to send the patch to me I >will apply it and then push it up. > >Brett > >Videanu Adrian <vid...@ya...> wrote: >Hi all, >i have added a new class (PauseMixMonitorAction) to asterisk-java >package that allows you to pause a recording performed with MixMonitor >using asterisk manager command MixMonitorMute. This can be used from an >asteriskChannel like this : >asteriskChannel.pauseMixMonitor() or >asteriskChannel.unPauseMixMonitor(). > >If there is anyone interested or is a way to commit that code to >official repository please let me know. > >Everyone hates slow websites. So do we. >Make your web apps faster with AppDynamics >Download AppDynamics Lite for free today: >http://p.sf.net/sfu/appdyn_d2d_nov >Asterisk-java-devel mailing list >Ast...@li... >https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel > > >-- > >Sent from my Android phone with K-9 Mail. Please excuse my brevity. >-----Inline Attachment Follows----- > >------------------------------------------------------------------------------ >Monitor your physical, virtual and cloud infrastructure from a single >web console. Get in-depth insight into apps, servers, databases, >vmware, >SAP, cloud infrastructure, etc. Download 30-day Free Trial. >Pricing starts from $795 for 25 servers or applications! >http://p.sf.net/sfu/zoho_dev2dev_nov >-----Inline Attachment Follows----- > >_______________________________________________ >Asterisk-java-devel mailing list >Ast...@li... >https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel > > >------------------------------------------------------------------------ > >------------------------------------------------------------------------------ >Monitor your physical, virtual and cloud infrastructure from a single >web console. Get in-depth insight into apps, servers, databases, >vmware, >SAP, cloud infrastructure, etc. Download 30-day Free Trial. >Pricing starts from $795 for 25 servers or applications! >http://p.sf.net/sfu/zoho_dev2dev_nov > >------------------------------------------------------------------------ > >_______________________________________________ >Asterisk-java-devel mailing list >Ast...@li... >https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. |