jtapi - 获取呼叫和呼叫者IP地址和端口

时间:2015-03-18 09:38:05

标签: java jtapi

我想开发一个Java应用程序来记录所有已连接的呼叫中的呼叫并呼叫 IP地址,端口和callID 。我使用的是CISCO 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; 


            }

        }
    }


}

1 个答案:

答案 0 :(得分:0)

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