When an NMS ISDN protocol stack message is received, an ISDNEVN_RCV_MESSAGE event occurs.
The buffer field in the CTA_EVENT structure is a pointer to an ISDN_PACKET structure. This structure contains:
An ISDN_MESSAGE structure that contains the message, and other data.
A data area that contains the message header.
The following illustration shows the structure of this message packet:
After receiving and processing the data within the CTA_EVENT event buffer, the application must use isdnReleaseBuffer to free the buffer as quickly as possible. Otherwise, the ISDN interface times out and stops passing events to the application.
The following sample code illustrates how the application processes an incoming ISDN event from the on-board protocol stack through the Natural Access event mechanism:
cta_ret = ctaWaitEvent(ctaqueuehd, &cta_event, CTA_WAIT_FOREVER);
if (cta_ret != SUCCESS)
{
printf("isdnproc: ctaWaitEvent failure %d %x\n",
cta_ret, cta_ret);
continue;
}
/* We have an event -- switch on the type */
switch (cta_event.id)
{
.
.
.
case ISDNEVN_RCV_MESSAGE:
/* Pick up the ISDN_PACKET structure */
isdnpkt = (ISDN_PACKET *)adi_event.buffer;
isdnmsg = (ISDN_MESSAGE *)&isdnpkt->message;
/* Extract information from the ISDN incoming packet */
message = isdnmsg->code;
sender = isdnmsg->from_ent;
recipient = isdnmsg->to_ent;
CRN = isdnmsg->add.conn_id;
}
The fields in the received ISDN_MESSAGE structure contain the following information:
ISDN_MESSAGE field |
Value in ACU stack mode... |
Value in LAPD stack mode... |
---|---|---|
nai |
Specifies the network access identifier (NAI) of the trunk that the message concerns. |
Specifies the network access identifier (NAI) of the trunk that the message concerns. |
from_ent |
ENT_CC. Indicates that the message was sent from call control layer (ACU). |
ENT_DL_D. Indicates that the message was sent from data link layer. |
to_ent |
ENT_APPLI. Indicates that the message was sent to an application. |
ENT_APPLI. Indicates that the message was sent to an application. |
to_sapi |
ACU_SAPI |
DL_SAPI_SIG |
conn_id |
Contains the connection ID of the call that the message concerns. |
1 |
code |
Specifies the primitive of the message, for example, ACU_CONN_IN. |
Specifies the primitive of the message, for example, DL_DA_IN. |
inf0, inf1, inf2, inf3, inf4 |
Reserved for internal data relay. |
Reserved for internal data relay. |
data_size |
Specifies the size of the message buffer containing data associated with the event, if any. |
Specifies the size of the message buffer containing data associated with the event, if any. |
nfas_group |
Specifies the NFAS group number for the network access identifier (NAI). Used only if duplicate NAI values are defined. |
Specifies the NFAS group number for the network access identifier (NAI). Used only if duplicate NAI values are defined. |
userid |
Not used. |
Not used. |