1

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

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

有人能帮我吗?谢谢

这是我的代码:

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


            }

        }
    }


}
4

1 回答 1

0

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

于 2015-04-14T07:19:45.730 回答