AG ISDN Messaging API Developer's Reference Manual (6272-17): Alphabetical Function Reference
(Page 2 of 6 in this chapter)
isdnReleaseBuffer
Description
- Returns an event buffer to the AG ISDN API.
Prototype
- DWORD isdnReleaseBuffer ( CTAHD ctahd,
void *buffer )
- ctahd CTA context handle associated with a D channel, returned by ctaCreateContext.
- buffer Pointer to the event buffer.
Return Values
Events
- None.
Details
- This function indicates to the stack that the application has finished processing an event buffer (described by the CTA_EVENT buffer and size fields) and is returning that buffer to the AG ISDN API. The event ID for ISDN events is ISDNEVN_RCV_MESSAGE.
Note: The application must return every event buffer to the AG ISDN API as soon as possible, or the API will time out and stop passing events to the application.
Example
sample_process_events (CTAHD ctahd)
{
CTA_EVENT event;
ISDN_MESSAGE *imsg;
ISDN_PACKET *ipkt;
BYTE *data;
DWORD ret;
char errortext[40];
#define EVENT_CODE(from, code) ((from<<8)|code)
...
/*
** Protocol already started
** Application may have sent messages to stack
*/
...
/*
** Application waiting for events
*/
myWaitForEvent( ctahd, &event);
/*
** Got event ISDN_RCV_MESSAGE
** If the event value field is not SUCCESS, then
** the event was not received successfully.
*/
if( event.value != SUCCESS )
{
ctaGetText(ctahd, event.value, errortext, 40);
printf("RCV_FAIL: %s\n", errortext);
return MY_ERROR_RCV_FAILED;
}
/*
** NOTE: all asynchnous events have the
** msg->userid field is ISDN_USERID_ASYNC
*/
ipkt = (ISDN_PACKET *) event->buffer;
imsg = &ipkt->message;
data = ipkt->data;
printf("from: %c code=%c to=%c id=%d len=%d\n",
imsg->from_ent,
imsg->code,
imsg->to_ent,
imsg->add.conn_id,
ipkt->data_len);
switch(EVENT_CODE(imsg->from_ent, imsg->code) )
{
case EVENT_CODE(ENT_ACU, CONN_CO):
/*
** call is now connected
*/
printf("Connected on conn_id: %d\n",imsg->add.conn_id);
break;
case EVENT_CODE(ENT_ACU,ACU_CLEAR_CO):
/*
** call is now cleared
*/
printf("Cleared on conn_id: %d\n", imsg->add.conn_id);
break;
...
default:
printf("Unprocessed message: %c %c\n", imsg->from_ent,
imsg->code);
break;
}
/*
** Processing is done, release the buffer as soon as possible
*/
ret = isdnReleaseBuffer( ctahd, event.buffer );
if( ret != SUCCESS )
{
ctaGetText(ctahd, event.value, errortext, 40);
printf("RELEASE_FAIL: %s\n", errortext);
return MY_ERROR_RELEASE_FAILED;
}
...
}
(Page 2 of 6 in this chapter)
tech_support@nmss.com
Copyright © 1999, Natural MicroSystems, Inc. All rights
reserved.