- Once the queues and contexts are created, the application must bind itself to each desired ISUP user service access point by calling ctaOpenServices once for each binding. The binding operation specifies the following parameters:
- board TX board number
- srcEnt Calling application entity ID
- srcInst Calling application instance ID
- suId Calling applications service user ID
- spId ISUP service access point ID on which to bind
- ssn ISUP subsystem number associated with the service access point
- Under Natural Access, these parameters are specified in the CTA_SERVICE_ARGS structure, contained in the CTA_SERVICE_DESC structure. An example of the parameter specification is provided:
CTA_SERVICE_DESC isupOpenSvcLst[] = {{{"ISUP", "ISUPMGR"}, {0}, {0}, {0}}};
isupOpenSvcLst[0].svcargs.args[0] = board; /* board number */
isupOpenSvcLst[0].svcargs.args[1] = INST_ID; /* srcInst */
isupOpenSvcLst[0].svcargs.args[2] = ENT_ID; /* srcEnt */
isupOpenSvcLst[0].svcargs.args[3] = 1; /* AutoBind? (yes=1,no= 0)*/
isupOpenSvcLst[0].svcargs.args[4] = SAP_ID; /* spId */
isupOpenSvcLst[0].svcargs.args[5] = SAP_ID; /* suId */
- The ctaOpenServices function is an asynchronous function - that is, the return from the function indicates that the bind operation has been initiated. Once completed, a CTAEVN_OPEN_SERVICES_DONE event is returned to the to the user application.
Note: If multiple contexts are assigned to the same queue, then all of those contexts must use the same entity ID in the service arguments parameter shown above. Conversely, contexts bound to different queues must specify a unique entity IDs.
CTA_EVENT event; /* Event structure to wait for ISUP events */
Ret = ctaOpenServices( ctaHd, isupOpenSvcLst, 1 );
if ( Ret != SUCCESS )
{
ctaGetText( NULL_CTAHD, Ret, sErr, sizeof( sErr ) );
printf( "ERROR : ctaOpenServices failed( %s )\n", sErr );
ctaDestroyQueue( ctaQueue ); /* destroys context too */
return()
}
/* Wait for "open services" to complete; note: this loop
* assumes no other contexts are already active on the queue
* we're waiting on, so no other events will be received that
* need handling
*/
event.id = CTAEVN_NULL_EVENT;
do
{
ctaWaitEvent( ctaQueue, &event, 5000 );
}
while( (event.id != CTAEVN_OPEN_SERVICES_DONE) &&
(event.id != CTAEVN_WAIT_TIMEOUT) );
/* check if binding succeeded */
if( (pSap->event.id != CTAEVN_OPEN_SERVICES_DONE) ||
(pSap->event.value != CTA_REASON_FINISHED) )
{
ctaGetText( event.ctahd, event.value, sErr, sizeof( sErr ) );
printf( "ERROR opening ISUP service [%s]\n", sErr );
ctaDestroyQueue( pSap->ctaQueue ); /* destroys context too */
return( );
}