jtapi - get calling and caller ip address and ports

810 Views Asked by At

I would like to develop a Java app that logs calling and called IP addresses, ports and callID in all connected calls. I use CISCO JTapi.

I use my TerminalObserver and handle RTP events. I can get ip and ports, but CallID is null.

Can someone help me? Thanks

Here is my code:

 @Override
public void terminalChangedEvent(TermEv[] eventList) {
    if (eventList == null) {
        System.out.println("Terminal Event - Null");
    } else {

         String ip;
         String port;
         String callId;
         CiscoCallID callc;

        for (int i = 0; i < eventList.length; ++i) {
            //System.out.println("Terminal "+eventList[i].getTerminal().getName()+" Event "+eventList[i].getID()+":");
         switch (eventList[i].getID()){ 
         case CiscoRTPInputStartedEv.ID: 
             CiscoRTPInputStartedEv inputStrEv =  ((CiscoRTPInputStartedEv)eventList[i]);
              ip = inputStrEv.getRTPInputProperties().getLocalAddress().getHostAddress();
                 port = String.valueOf(inputStrEv.getRTPInputProperties().getLocalPort());                           
                 callc = inputStrEv.getCallID();
                if(callc == null){
                    callId = "no id";
                }else{
                    callId = String.valueOf(callc.intValue());
                }

                 System.out.println("RTP input started: " + ip+ ":"+port+", callID: "+callId);

                break; 
         case CiscoRTPOutputStartedEv.ID:
             CiscoRTPOutputStartedEv outputStrEv = (CiscoRTPOutputStartedEv)eventList[i];
              ip = outputStrEv.getRTPOutputProperties().getRemoteAddress().getHostAddress();
             port = String.valueOf(outputStrEv.getRTPOutputProperties().getRemotePort());
              callc = outputStrEv.getCallID();
                if(callc == null){
                    callId = "no id";
                }else{
                    callId = String.valueOf(callc.intValue());
                }
             System.out.println("RTP output is started: " + ip+ ":"+port+", callID: "+callId);

            break;

         case CiscoRTPInputStoppedEv.ID: 
             CiscoRTPInputStoppedEv inputStopEv = (CiscoRTPInputStoppedEv)eventList[i];
             callc = inputStopEv.getCallID();
                if(callc == null){
                    callId = "no id";
                }else{
                    callId = String.valueOf(callc.intValue());
                }
             System.out.println("RTP input is stoped: callID: "+callId);
                 break; 

        case CiscoRTPOutputStoppedEv.ID: 
            CiscoRTPOutputStoppedEv outputStopEv =  (CiscoRTPOutputStoppedEv)eventList[i];
             callc = outputStopEv.getCallID();
                if(callc == null){
                    callId = "no id";
                }else{
                    callId = String.valueOf(callc.intValue());
                }
             System.out.println("RTP output is stoped: callID: "+callId);
                 break; 


            }

        }
    }


}
1

There are 1 best solutions below

0
Hajo Thelen On

I don't know the Cisco world. But may be you have to activate CallID generation in the phone system (this is what i've learned in the avaya world).