You are here: SwitchKit® Development Environment - TCAP Interface User’s Guide > 7 SKTAL Sample Application > Step Three - Sending a TCAP Dialogue and Component
Step Three - Sending a TCAP Dialogue and Component
The API function described in this section allows you to send a dialog and component through SwitchKit to the SS7 network.
// allocate dialogue id. instance value is returned during
// registration.
ret = sk_allocateTCAPDialogueID(instance, &did);
if (ret != SK_OK)
{
printf("Failed to allocate dialog id: %d\n", ret);
}
// Create TCAP Begin dialogue object
sktal::TCAP_Begin begin;
// populate orignating and destination
// point codes.
begin.SetOPC(LOCAL_PC);
begin.SetDPC(REMOTE_PC);
// populate orignating SCCP address
begin.SetOrigAddr(true, LOCAL_PC, LOCAL_SSN);
// Populate destination SCCP address.
begin.SetOrigAddr(true, LOCAL_PC, LOCAL_SSN);
// Populate destination SCCP address.
begin.SetDestAddr(true, REMOTE_PC, REMOTE_SSN);
// Set dialogue id allocated.
begin.SetDialogueID(did);
// Create TCAP invoke component instance.
sktal::TCAP_Invoke invoke;
invoke.SetOperation(true, 1, 1);
// Set invoke id.
invoke.SetInvokeID(1);
// set invoke timeout.
invoke.SetTimeOut(20);
// Set encoded parameters of TCAP User part
// API's like ANSI-41, MAP, CAMEL etc.
invoke.SetParameter(encodedParam);
// Send TCAP Component
ret = sktal::TCAP_Component::Send(sktal_getTCAPHandle(instance),
&begin, &invoke);
if (ret != SKTAL_SUCCESS)
{
printf("Failed to send component: %d\n", ret);
}
else
{
// Send TCAP dialogue.
ret = sktal::TCAP_Dialogue::Send(sktal_getTCAPHandle(instance),
&begin);
if (ret != SKTAL_SUCCESS)
{
printf("Failed to send dialogue: %d\n", ret);
}
}