Step Three: Sending a TCAP Transaction

 

The API function described in this section allows you to send a TCAP transaction.

 

 

Application Code

// Create SKIM_Trans object of type SKIM_TC_BEGIN

SKIM_Trans trans (SKIM_TC_BEGIN);

 

// Create objects for calling party and called party

// address.

SKIM_CallingPartyAddr origAddr;

SKIM_CalledPartyAddr destAddr;

 

// Populate OPC and DPC

trans.SetOPC(LOCAL_PC);

trans.SetOPC(REMOTE_PC);

 

// populate calling party address

origAddr.SetSSN(LOCAL_SSN);

origAddr.SetPointCode(LOCAL_PC);

origAddr.SetRouteByPCSSN(true);

 

#if defined(CCITT)

origAddr.SetInternationalRouting(true);

#elif defined (ANSI)

origAddr.SetInternationalRouting(false);

#endif

 

// Set calling party address for begin transaction.

trans.SetSourceAddress(origAddr);

 

//Set Called Party Address

destAddr.SetSSN(REMOTE_SSN);

destAddr.SetPointCode(REMOTE_PC);

destAddr.SetRouteByPCSSN(true);

#if defined(CCITT)

destAddr.SetInternationalRouting(true);

#elif defined (ANSI)

destAddr.SetInternationalRouting(false);

#endif

// Set called party address for begin transaction.

trans.SetDestAddress(destAddr);

 

// Set quality of service for the transaction message.

SKIM_OCTET priority;

 

priority = 0;

trans.SetQualityOfService(QOSI_RET_OPT|SKIM_QOSI_RET_OPT, priority);

 

// Adding a operation to transaction object.

 

// Create operation of type SKIM_TC_INVOKE

SKIM_Operation op(SKIM_TC_INVOKE);

 

// Set Invoke Id.

op.SetInvokeId(1 + i);

 

// Set Operation Code

#if defined(CCITT)

op.SetOpCode(100);

 

// Set Operation Class for invoke operation.

op.SetClass(1); // Set Invoke operation timeout

op.SetInvokeTimeout(10);

#else defined(ANSI)

op.SetOpCode(true, 1, 1);

#endif

 

// Set ASN.1 encoded TCAP User parameters

op.SetParameter(SKIM_Encode());

 

// Add operation to the transaction object.

trans.AddOperation(op);

 

// Send transaction to EXS

ret = api_classptr.Send(trans);

if (ret != SKIM_SUCCESS)

{

printf("Send transaction failed ret = %d", ret);

return ret;

}

 

// Get the call reference id allocated for this transaction.

SKIM_UINT callrefid = ;

trans.GetCallReferenceId();