gpt4 book ai didi

java - jtapi - 获取调用者和调用者的 IP 地址和端口

转载 作者:太空宇宙 更新时间:2023-11-04 14:03:10 26 4
gpt4 key购买 nike

我想开发一个 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;


}

}
}


}

最佳答案

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

关于java - jtapi - 获取调用者和调用者的 IP 地址和端口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29118499/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com