Author Message
MattBystrzak
Joined: Jan 12, 2014
Messages: 0
Offline
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");
      
   }
}
JohnBiggs
Joined: Jun 20, 2005
Messages: 1139
Location: Rural, Virginia
Offline
Some general guidance/questions.. have you gotten each of the sample applications to run. There is one that provides proxy services to a call.

Have you located and used the ACE logs to your advantage in troubleshooting?
/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/AAFT/aaft.log

Are you using traceSM to track the progress of the call (to see if ACE returns to Session Manager after your proxy attempt)?

THe latter two suggestions are for how to debug the problem, the first is what you should do to validate your environment is setup properly, and have something to compare your application's event sequence with.

As far as debugging your code that goes beyond the scope of the forums... Should you wish hands on debugging assistancet please review the terms and conditions associated with Technical Support requests, and enter a support request with all the relevant details (releases of products, logs, code, etc)
MattBystrzak
Joined: Jan 12, 2014
Messages: 0
Offline
Hi John,

Thank you very much for taking the time to respond. As far as the sample apps, I haven't yet tried to use them. I have however been able to implement a number of the methods in the api without problems. I have been following traces from both the logs on the AAFT server as well as tracesm on SM.

I have found that the SIP INVITE gets sent to the AAFT server properly. The application handle is showing up correctly. I get a 100 trying back from the AAFT server and after x number of seconds I get a response timed out.

The logs on the AAFT server show the invite coming and it looks right but after that it's difficult to parse through all of the debug messages.

I have this set up as an originating sequenced app. I am researching and analyzing the proxy method calls in the sample apps but don't see anything different than what I've done. I will continue to research.

Again, many thanks.
JohnBiggs
Joined: Jun 20, 2005
Messages: 1139
Location: Rural, Virginia
Offline
does ACE provide a response to the INVITE that Session Manager sends to it, or does your proxy request stop at ACE from Session Manager's perspective?


The ACE log file of interest is
/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/AAFT/aaft.log


yes it is very verbose. It takes a while to locate the information you are interested in.
MattBystrzak
Joined: Jan 12, 2014
Messages: 0
Offline
Hi John,

Thanks for the response.

The problem was the TLS port I was using for the entity link in Session Manager. I was using 5061 and apparently it allows the use of any TLS port other than 5061.
JohnBiggs
Joined: Jun 20, 2005
Messages: 1139
Location: Rural, Virginia
Offline
glad you found the issue...
Go to:   
Mobile view