
Description | Cautions | Example | Errors | See Also
Name: |
int cc_SndMsg(crn, msg_type, sndmsgptr) | |
Inputs: |
CRN crn |
|
int msg_type |
| |
IE_BLK *sndmsgptr |
| |
Returns: |
0 on success | |
Includes: |
cclib.h | |
Category: |
Optional call handling | |
Mode: |
synchronous | |
Technology: |
BRI/2; BRI/SC; PRI (all protocols) | |
The cc_SndMsg( ) function sends a non-Call State related ISDN message to the network over the D channel, while a call exists. The data is sent transparently over the D channel data link using the LAPD (Layer 2) protocol.
For BRI, the cc_SndMsg( ) function is used to invoke supplemental services, such as Called/Calling Party Identification, Call Transfer, and Message Waiting. The services are invoked by sending Facility Messages or Notify Messages (see Table 27) to the switch. Upon receipt of the message, the network may return a NOTIFY message to the user. The NOTIFY messages can be retrieved by calling the cc_GetCallInfo( ) function. For more information on invoking supplemental services, see Appendix D.
Parameter |
Description |
crn: |
The call reference number. Each call needs a valid CRN. |
msg_type: |
Specifies one of the ISDN message types listed in Table 27 below. The values for msg_type are defined in cclib.h. Descriptions of the message types for DPNSS are provided in Appendix C. |
sndmsgptr: |
Points to the buffer (IE_BLK) that contains the information element(s) to be sent in the message. For a description of the data structure used to send the IEs, see Section 6.6. IE_BLK. See the Example code below for details. |
Table 27. ISDN Message Types for cc_SndMsg( )
All Protocols |
Custom BRI 5ESS only |
DPNSS only |
SndMsg_Congestion |
SndMsg_Drop |
SndMsg_Divert |
SndMsg_Facility |
SndMsg_DropAck |
SndMsg_Intrude |
SndMsg_FacilityAck |
SndMsg_DropRej |
SndMsg_NSI |
SndMsg_FacilityRej |
SndMsg_Redirect |
SndMsg_Transfer |
SndMsg_Information |
SndMsg_Transit | |
SndMsg_Notify |
||
SndMsg_Status |
||
SndMsg_StatusEnquiry |
||
SndMsg_UsrInformation |
None
#include <windows.h> /* For Windows applications only */
#include <stdio.h>
#include <errno.h>
#include "srllib.h"
#include "dtilib.h"
#include "cclib.h"
/* FUNCTION PROTOTYPES */
void InitSndMsgBlk(); /* fills in the information element to send */
void main()
{
LINEDEV devhdl = 0;
CRN crn = 0;
char *devname = "dtiB1T1";
IE_BLK ie_blk; /* Info elem block pointer for SndMsg() */
.
.
.
/* open the ISDN line device */
if ( cc_Open(&devhdl, devname, 0) < 0 )
{
printf("Error opening device: errno = %d\n", errno);
exit(1);
}
/* wait for the incoming call */
if ( cc_WaitCall(devhdl, &crn, NULL, -1, EV_SYNC) < 0 )
procdevfail(devhdl);
/* answer the call */
if ( cc_AnswerCall(crn, 0, EV_SYNC) < 0)
callfail(crn);
/*initialize the SndMsg Block to send */
InitSndMsgBlk(&ie_blk);
/* send INFORMATION IE data */
if ( cc_SndMsg(crn, SndMsg_Information, &ie_blk) == -1> { < 0 )
callfail(crn);
}
/* drop the call */
if ( cc_DropCall(crn, NORMAL_CLEARING, EV_SYNC) < 0 )
callfail(crn);
/* release the CRN */
if ( cc_ReleaseCall(crn) < 0 )
callfail(crn);
/* close the line device */
if ( cc_Close(devhdl) < 0 )
printf("Error closing device, errno = %d\n", errno);
} /* end of main */
int callfail(CRN crn)
{
LINEDEV ld;
cc_CRN2LineDev(crn,&ld);
procdevfail(ld);
}
int procdevfail(LINEDEV handle)
{
int reason;
char *msg;
reason = cc_CauseValue(handle);
cc_ResultMsg(handle,reason,&msg);
printf("reason = %x - %s\n",reason,msg);
}
void InitSndMsgBlk (IE_BLK * IE_BLK_PTR)
{
IE_BLK_PTR-> length = 10; /* 10 bytes of data */
IE_BLK_PTR-> data[0] = 0x28; /* DISPLAY IE (0x28) */
IE_BLK_PTR-> data[1] = 0x08; /* IE length: 8 bytes */
IE_BLK_PTR-> data[2] = 0x46;
IE_BLK_PTR-> data[3] = 0x52;
IE_BLK_PTR-> data[4] = 0x2E;
IE_BLK_PTR-> data[5] = 0x20;
IE_BLK_PTR-> data[6] = 0x30;
IE_BLK_PTR-> data[7] = 0x2E;
IE_BLK_PTR-> data[8] = 0x32;
IE_BLK_PTR-> data[9] = 0x30;
}
If the function returns a value < 0 to indicate failure, use the cc_CauseValue( ) function to retrieve the reason code for the failure. The cc_ResultMsg( ) function can be used to interpret the reason code. Error codes are defined in the files ccerr.h, isdnerr.h, and isdncmd.h.
Possible error codes from the cc_SndMsg( ) function include the following:
Error Code |
Description |
ERR_ISDN_LIB | E_ISBADIF |
Bad interface number |
ERR_ISDN_LIB | E_BADSTATE |
Bad state |
ERR_ISDN_LIB | E_ISBADTS |
Bad time slot |
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation