我正在使用SS7 堆栈接收 IDP 数据包并使用新对话框转发到核心。
我能够使用以下代码成功转发请求:
@Override
public void onInitialDPRequest(InitialDPRequest arg0) {
try {
String refId = StringUtility.createRefId("sc");
logger.info("[" + refId + "] IDP Recieved");
String outgoingGTDigits = "92308985051";
int calledSSN = 146;
int remotePC = 3003;
SccpAddress remoteAddress = MapUtilities.getSccpAddress(RoutingIndicator.ROUTING_BASED_ON_GLOBAL_TITLE, outgoingGTDigits, calledSSN, remotePC);
arg0.getCAPDialog().setRemoteAddress(remoteAddress);
logger.debug("[" + refId + "] Forwading to Core with remoteAddress [" + remoteAddress + "]");
InitialDPRequestImpl initialDPRequestImpl = (InitialDPRequestImpl) arg0;
Invoke invoke = SCCPProxy.tcapStack_cap.getProvider().getComponentPrimitiveFactory()
.createTCInvokeRequest(InvokeClass.Class2);
invoke.setTimeout(_Timer_CircuitSwitchedCallControl_Short);
OperationCode oc = SCCPProxy.tcapStack_cap.getProvider().getComponentPrimitiveFactory().createOperationCode();
oc.setLocalOperationCode((long) CAPOperationCode.initialDP);
AsnOutputStream aos = new AsnOutputStream();
initialDPRequestImpl.encodeData(aos);
Parameter p = SCCPProxy.tcapStack_cap.getProvider().getComponentPrimitiveFactory().createParameter();
p.setTagClass(initialDPRequestImpl.getTagClass());
p.setPrimitive(initialDPRequestImpl.getIsPrimitive());
p.setTag(initialDPRequestImpl.getTag());
p.setData(aos.toByteArray());
invoke.setParameter(p);
invoke.setOperationCode(oc);
// Create a new dialog
Dialog clientDialog = SCCPProxy.tcapStack_cap.getProvider().getNewDialog(arg0.getCAPDialog().getLocalAddress(), remoteAddress);
invoke.setInvokeId(clientDialog.getLocalDialogId());
clientDialog.sendComponent(invoke);
logger.debug("[" + refId + "] set invoke id " + clientDialog.getLocalDialogId());
//long[] _ACN_ = new long[]{0, 4, 0, 0, 1, 0, 19, 2};
ApplicationContextName acn = SCCPProxy.tcapStack_cap.getProvider().getDialogPrimitiveFactory()
.createApplicationContextName(arg0.getCAPDialog().getApplicationContext().getOID());
// Create begin request
TCBeginRequest tcbr = SCCPProxy.tcapStack_cap.getProvider().getDialogPrimitiveFactory().createBegin(clientDialog);
tcbr.setApplicationContextName(acn);
clientDialog.send(tcbr);
logger.info("[" + refId + "] Forwaded to core with id: " + clientDialog.getLocalDialogId());
} catch (Exception ex) {
logger.error("Exception: ", ex);
}
}
TCP转储
现在,当核心节点回复此数据包(数据包#3)时。我在 sigtran 日志中收到CAP Dialog not found for Dialog Id n 。
SIGTRAN 日志
我是否正确转发数据包?