Hi
I am new to developing custom apps with the foundation toolkit. I am trying to explore the ProxyRoutingService Interface to see what it can do.
I have been able to successfully block calls using the reject method, redirect calls with the redirect method but I can't seem to get the proxy method to work. All I'm trying to do is simply connect the call to the dialed endpoint. I get a 100 trying back from the ace server which ultimately leads to a 408 Request Timed Out.
Currently I am functioning without an AMS server on the network. I installed the AAFT with an IP address for the AMS server which doesn't actually exist yet. I don't think that this should matter in regards to the proxy interface. Maybe I'm wrong? I am under the impression unless I'm using the MediaServer Interface I shouldn't need the AMS server.
My code seems to be right and My Session Manager config looks accurate as well.
Any insight would be greatly appreciated.
Here's my code...
package com.m3freelance.ace.training;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.EnumSet;
import java.util.Properties;
import java.util.UUID;
import java.util.regex.Pattern;
import com.avaya.service.client.ServiceFactory;
import com.avaya.service.client.appbinding.AppBindingProperties;
import com.avaya.service.client.appbinding.AppBindingService;
import com.avaya.service.client.appbinding.AppBindingStatusListener;
import com.avaya.service.client.appbinding.BindId;
import com.avaya.service.client.call.CallPhase;
import com.avaya.service.client.call.Dialog;
import com.avaya.service.client.call.DialogState;
import com.avaya.service.client.call.ProxyDialogTerminationCause;
import com.avaya.service.client.call.inbound.EndpointDialogListener;
import com.avaya.service.client.call.inbound.InboundDialogService;
import com.avaya.service.client.call.inbound.SequencedDialogListener;
import com.avaya.service.client.call.routing.ProxyListener;
import com.avaya.service.client.call.routing.ProxyNotification;
import com.avaya.service.client.call.routing.ProxyRoutingService;
import com.avaya.service.client.call.routing.Target;
import com.avaya.service.client.message.RequestContent;
import com.avaya.service.client.message.ResponseContent;
import com.avaya.service.client.message.SipRequest;
import com.avaya.service.client.message.SipResponse;
public class CallScreening implements SequencedDialogListener, ProxyListener{
private AppBindingService m_abs;
private BindId m_bindId;
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
CallScreening callScreening = new CallScreening();
while(true){}
}
public CallScreening () {
// bind to the AAFT server when constructed
Properties properties = new Properties();
properties.put(AppBindingProperties.APPLICATION_NAME, "callscreening");
try {
URL aaftURL = new URL("http://172.27.1.44:8080/foundation/cometd/");
this.m_abs = ServiceFactory.getAppBindingService();
this.m_bindId = this.m_abs.createBinding(aaftURL, properties);
System.out.println("Binding successful");
} catch (MalformedURLException e) {
e.printStackTrace();
}
// add sequenced dialog listener
InboundDialogService ids = ServiceFactory.getInboundDialogService(m_bindId);
ids.setSequencedDialogListener(this, "callscreening");
System.out.println("Sequenced dialog listener set succesfully");
}
/*
@Override
public void newInboundDialog(Dialog dialog, String callingParty,
String calledParty, CallPhase callPhase, SipRequest request) {
System.out.println("Recieved new inbound dialog");
System.out.println("Calling Party: " + callingParty);
System.out.println("Called Party: " + calledParty);
//ProxyRoutingService prs = ServiceFactory.getProxyRoutingService(this.m_bindId);
//ResponseContent rc = new ResponseContent(499, "GoAway");
//rc.addHeader("Day Of The Week", "Saturday");
//prs.reject(dialog, rc);
//System.out.println("Rejected the call");
//ProxyRoutingService prs = ServiceFactory.getProxyRoutingService(this.m_bindId);
//prs.redirect(dialog, 302, "sip:8002@macsourceinc.com");
//System.out.println("Redirected the call to extension 8002");
ProxyRoutingService prs = ServiceFactory.getProxyRoutingService(m_bindId);
prs.proxy(dialog, this, EnumSet.noneOf(ProxyNotification.class), RequestContent.NO_ALTERATION);
System.out.println("Proxying the dialog to the intended destination");
} */
@Override
public void newInboundDialog(Dialog dialog, String caller, String callee,
CallPhase callPhase, SipRequest siprequest) {
System.out.println("Received new inbound dialog");
System.out.println("Caller: " + caller);
System.out.println("Callee: " + callee);
// get a proxy routing service and use it to proxy the inbound dialog to the intended destination
ProxyRoutingService prs = ServiceFactory.getProxyRoutingService(m_bindId);
prs.proxy(dialog, this, EnumSet.noneOf(ProxyNotification.class), RequestContent.NO_ALTERATION);
System.out.println("Proxying the dialog to the intended destination");
}
@Override
public void dialogConfirmed(Dialog dialog, SipResponse response) {
System.out.println("Answered");
}
@Override
public void dialogEarly(Dialog dialog, SipResponse response) {
System.out.println("Ringing");
}
@Override
public void dialogForked(Dialog original, Dialog forked,
DialogState forkedDialogState) {
System.out.println("Forked");
}
@Override
public void dialogTerminated(Dialog dialog,
ProxyDialogTerminationCause terminationCause, SipResponse response) {
System.out.println("Bye");
}
}
|