我想开发一个Java应用程序,在所有已连接的呼叫中记录呼叫和被呼叫的IP地址,端口和callID。我使用CISCO JTapi。

我使用TerminalObserver并处理RTP事件。我可以获取ip和端口,但CallID为null。

有人能帮我吗?谢谢

这是我的代码:

 @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;


            }

        }
    }


}

最佳答案

我不了解思科世界。但是可能您必须在电话系统中激活CallID生成(这是我在avaya世界中了解到的)。

10-08 01:53