Author Message
coldplay
Joined: Sep 10, 2015
Messages: 5
Offline
Hi i'm trying to redirect incoming call using this code:


@Override
public synchronized void connectionAlerting(CallControlConnectionEvent callControlConnectionEvent) {
Address fromAddress = callControlConnectionEvent.getCallingAddress();
CallControlConnection connection = (CallControlConnection) callControlConnectionEvent.getConnection();
String from = (fromAddress != null ? fromAddress.getName() : "");
String redirectNumber = numberReceiver.getNumberForCall(from);
try {
if (redirectNumber != null) {
connection.redirect(redirectNumber);
}
} catch (Exception e) {
logger.warn("Cant redirect call from " + from + " cause:", e);
}
}

Listener added to Address object received from provider. Redirect is working, but after method redirect called, thread become blocked and listener wont't receive any event. In dump i found this blocked threads :


"pool-146-thread-3" Id=740 BLOCKED on com.avaya.jtapi.tsapi.tsapiInterface.TSInvokeID@59adc066 owned by "DistributeCSTAEvent" Id=704
at java.lang.Object.wait(Native Method)
- blocked on com.avaya.jtapi.tsapi.tsapiInterface.TSInvokeID@59adc066
at com.avaya.jtapi.tsapi.tsapiInterface.TSInvokeID.waitForConf(TSInvokeID.java:77)
at com.avaya.jtapi.tsapi.tsapiInterface.TsapiSession.send(TsapiSession.java:529)
at com.avaya.jtapi.tsapi.tsapiInterface.TsapiSession.send(TsapiSession.java:448)
at com.avaya.jtapi.tsapi.tsapiInterface.Tsapi.deflectCall(Tsapi.java:1373)
at com.avaya.jtapi.tsapi.impl.core.TSConnection.redirect(TSConnection.java:508)
at com.avaya.jtapi.tsapi.impl.TsapiConnection.redirect(TsapiConnection.java:297)
at citc.fcb.avaya.CallEventListener.connectionAlerting(CallEventListener.java:100)
at com.avaya.jtapi.tsapi.impl.monitor.TsapiCallMonitor.deliverEventToCallback(TsapiCallMonitor.java:1805)
at com.avaya.jtapi.tsapi.impl.monitor.TsapiCallMonitor.deliverListenerEvents(TsapiCallMonitor.java:1704)
at com.avaya.jtapi.tsapi.impl.monitor.TsapiCallMonitor.run(TsapiCallMonitor.java:1695)
at com.avaya.jtapi.tsapi.impl.core.JtapiEventDeliveryThread.run(JtapiEventDeliveryThread.java:35)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

"DistributeCSTAEvent" Id=704 BLOCKED on java.util.Vector@3010dda1 owned by "pool-146-thread-3" Id=740
at java.util.Vector.size(Vector.java:315)
- blocked on java.util.Vector@3010dda1
at com.avaya.jtapi.tsapi.impl.monitor.TsapiCallMonitor.createListenerEvents(TsapiCallMonitor.java:473)
at com.avaya.jtapi.tsapi.impl.monitor.TsapiCallMonitor.deliverEventsInternal(TsapiCallMonitor.java:459)
at com.avaya.jtapi.tsapi.impl.monitor.TsapiCallMonitor.deliverEvents(TsapiCallMonitor.java:450)
at com.avaya.jtapi.tsapi.impl.core.DisconnectedConfHandler.handleConf(TSConnection.java:2249)
at com.avaya.jtapi.tsapi.tsapiInterface.TSInvokeID.setConf(TSInvokeID.java:54)
at com.avaya.jtapi.tsapi.tsapiInterface.TsapiEventDistributor.handleEvent(TsapiEventDistributor.java:103)
at com.avaya.jtapi.tsapi.tsapiInterface.TsapiEventQueue.run(TsapiEventQueue.java:103)


Is this way to redirect incorrect or what ? Using jtapi 5.2
MartinFlynn
Joined: Nov 30, 2009
Messages: 1922
Offline
You should not be making API calls using the JTAPI Listener thread. In fact, you should not do more than minor processing using this thread as it can lead to a backlog of incoming events and, under severe load, can lead to the link to AE Services going down.

Apart maybe from some tracing, the only actions that should be in the listener callback is to take the message and place it on an internal queue. Use your own thread(s) to process the messages and make API calls. There is a very basic example of this process in the AgentView sample application on the Devconnect website.

Martin
Go to:   
Mobile view