Intel 05-1832-002 IP Phone User Manual


 
268 Voice API for Windows Operating Systems Library Reference — November 2003
dx_gtextcallid( ) — retrieve a caller ID message
/* Put the channel onhook */
if (dx_sethook(chdev, DX_ONHOOK, EV_SYNC) == -1) {
/* process error */
exit (0);
}
/* Wait for 2 rings and go offhook (timeout after 20 seconds) */
if (dx_wtring(chdev, numRings, DX_OFFHOOK, ringTimeout) == -1) {
/* process error */
}
/*************************************************************
* If the message is an MDM (Multiple Data Message), then
* individual submessages are available.
* First get the frame and check the frame type. If Class MDM,
* get and print information from submessages.
*************************************************************/
if (
dx_gtextcallid
(chdev,CLIDINFO_FRAMETYPE, buffer) != -1) {
if(buffer[0] == CLASSFRAME_MDM) {
/* Get and print the caller ID */
if (
dx_gtextcallid
(chdev, MCLASS_DN, buffer) != -1) {
printf("Caller ID = %s\n", buffer);
}
/* This is another way to obtain caller ID (regardless of frame type)*/
else if (
dx_gtextcallid
(chdev, CLIDINFO_CALLID, buffer) != -1) {
printf("Caller ID = %s\n", buffer);
}
else {
/* print the reason for the Absence of caller ID */
printf("Caller ID not available: %s\n", ATDV_ERRMSGP(chdev));
}
/* Get and print the Caller Name */
if (
dx_gtextcallid
(chdev, MCLASS_NAME, buffer) != -1) {
printf("Caller Name = %s\n", buffer);
}
/* Get and print the Date and Time */
if (
dx_gtextcallid
(chdev, MCLASS_DATETIME, buffer) != -1) {
printf("Date/Time = %s\n", buffer);
}
/* Get and print the Dialed Number */
if (
dx_gtextcallid
(chdev, MCLASS_DDN, buffer) != -1) {
printf("Dialed Number = %s\n", buffer);
}
}
else {
printf("Submessages not available - not an MDM message\n");
/* Get just the caller ID */
if (
dx_gtextcallid
(chdev, CLIDINFO_CALLID, buffer) != -1) {
printf("Caller ID = %s\n", buffer);
}
else {
/* print the reason for the absence of caller ID */
printf("Caller ID not available: %s\n", ATDV_ERRMSGP(chdev));
}
/***********************************************************
* If desired, the date/time, caller name, and caller ID can
* be obtained together.
**********************************************************/
if (
dx_gtextcallid
(chdev, CLIDINFO_GENERAL, buffer) != -1) {
printf("Date/Time, Caller Number, and Caller ID = %s\n", buffer);
}
else {
/* Print out the error message */
printf("Error: %s\n", ATDV_ERRMSGP(chdev));
}