CAP Dialog not found for Dialog Id

100 views Asked by At

I am using SS7 Stack to receive IDP packets and forward to core using a new dialog.

I am able to successfully forward the request using following code:

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

}

TCPDump

enter image description here

Now when core node replies to this packet (packet #3) . I am getting CAP Dialog not found for Dialog Id n in sigtran logs.

Sigtran Logs

Sigtran logs

Am I forwarding packet correctly?

2

There are 2 answers

0
BarbosSergos On

It's a little bit more complicated. I may assume that you want to handle all in same Sbb..

  1. When you create a new capDialog(clientDialog in your case), it created with new TCAP otid and dtid. So even when you receive a response in terms of new capDialog, you have to correlate it with original capDialog.
  2. Sbb knows only about ActivityContext from initial event, as you didn't attach sbbLocalObject to new ActivityContext.
  3. It's better to use Parent->Child architecture for such tasks. Parent Sbb handles all original dialog events. Child Sbb creates new dialog, attach sbbLocalObject to new ActivityContext and handles all related events for new dialog.
0
Zeeshan Ali On

I was able to forward packet and get reply without any issue by doing following changes:

  1. Have to create new dialog like this
CAPDialogCircuitSwitchedCall capDialog = capProvider.getCAPServiceCircuitSwitchedCall().createNewDialog(arg0
      .getCAPDialog().getApplicationContext(), proxyOwnAddress, destinationAddress, arg0.getCAPDialog().getRemoteDialogId());
  1. Copy payload from original dialog and put in new dialog

capDialog.addInitialDPRequest((int) arg0.getInvokeId(), arg0.getServiceKey(), arg0.getCalledPartyNumber(), arg0.getCallingPartyNumber(), arg0.getCallingPartysCategory(), arg0.getCGEncountered(), arg0.getIPSSPCapabilities(), arg0.getLocationNumber(), arg0.getOriginalCalledPartyID(), arg0.getExtensions(), arg0 .getHighLayerCompatibility(), arg0.getAdditionalCallingPartyNumber(), arg0.getBearerCapability(), arg0.getEventTypeBCSM(), arg0 .getRedirectingPartyID(), arg0.getRedirectionInformation(), arg0.getCause(), arg0.getServiceInteractionIndicatorsTwo(), arg0.getCarrier(), arg0.getCugIndex(), arg0.getCugInterlock(), arg0.getCugOutgoingAccess(), arg0.getIMSI(), arg0.getSubscriberState(), arg0 .getLocationInformation(), arg0.getExtBasicServiceCode(), arg0.getCallReferenceNumber(), arg0.getMscAddress(), arg0 .getCalledPartyBCDNumber(), arg0.getTimeAndTimezone(), arg0.getCallForwardingSSPending(), arg0.getInitialDPArgExtension());

  1. Save and Forward new dialog

dialogHashMap.put(capDialog.getLocalDialogId(), arg0.getCAPDialog()); capDialog.setReturnMessageOnError(true);

capDialog.send();
logger.info("[" + refId + "] Forwaded with id: " + capDialog.getLocalDialogId());

  1. Retrieve and reply So now when I received the reply from core. I just needed to retrieve original dialog from dialogHashMap using local dialogId and reply back