You are here: SwitchKit® Development Environment - TCAP Interface User’s Guide > 7 SKTAL Sample Application > Step Four - Receiving a TCAP Transaction

Step Four - Receiving a TCAP Transaction

The API function described in this section allows you to receive a TCAP transaction from the SS7 network via SwitchKit.

Application Code

Transactions are received via dialogue handler and registered with SKTAL. Sample implementation for dialogue handler is shown in the following code excerpt.

i/*

* new dialogue handler

*/

extern "C" int

newDialogue(int instance, unsigned newDID)

{

printf("NEW DIALOGUE: %08x\n", newDID);

// register a message handler for new dialogue.

return sktal_setTCAPDialogHandler(instance, newDID,

onMessage, NULL);

}

/*

* Message handler.

*/

extern "C" int

onMessage(int instance, SKTAL_EVENT *ev, void *tag)

{

static sktal::TCAP_Dialogue *dlg = NULL;

SKTAL_CPT cpt;

sktal::Event event;

unsigned did;

printf("ON MESSAGE\n");

if (TCAP_MSG_TYPE(ev) == SKTAL_TCAP_DLG)

{

event = ev;

sktal::TCAP_Dialogue::Receive(sktal_getTCAPHandle(instance),

event, &dlg);

if (dlg)

{

dlg->Print(std::cout);

}

}

else if (TCAP_MSG_TYPE(ev) == SKTAL_TCAP_CPT)

{

printf("Got component\n");

sktal::TCAP_Component *result;

event = ev;

sktal::TCAP_Component::Receive(sktal_getTCAPHandle(instance),

event, dlg, &result);

result->Print(std::cout);

delete result;

delete dlg;

dlg = NULL;

}

else

{

fprintf(stderr, "Unknown message type: %d\n", TCAP_MSG_TYPE(ev));

}

printf("RETURN FROM USER HANDLER\n");

return (SK_OK);

}

}

See Transaction Capability Application Part.
See Signaling System Number Seven.
In PPL, a condition that, when met, drives a state machine (PPL Component) from one state to another, by invoking an associated Primitive. In PPL files, an Event is marked by an arrow and text.