Dialogic Dialogic Global Call IP IP Phone User Manual


 
334
Dialogic Corporation
To enable the receipt of signaling LAN disconnect alarm events, the application must perform the
following general steps:
Explicitly open the board device.
Register the device handle (from the open operation) with GCAMS using the Global Call
function gc_SetAlarmNotifyAll( ). This registration uses the wildcard Alarm Source Object
(ASO) ID, ALARM_SOURCE_ID_NETWORK_ID, because the IP Call Control library ASO
ID is not known at this point.
When an alarm event is received, the alarm number, the alarm name, the ASO ID and the ASO
name can be retrieved using standard Global Call alarm APIs. The retrieved alarm number is equal
to TYPE_LAN_DISCONNECT for a disconnect alarm or TYPE_LAN_DISCONNECT + 0x10
for a reconnect alarm event. The retrieved alarm name will be “Lan Cable Disconnected” or “Lan
cable connected”. The retrieved ASO ID will be “IPCCLIBAsoId”.
The following code illustrates how signaling LAN disconnect alarms are enabled and handled.
main()
{
/* Initialize the SRL mode for the application */
#ifdef _WIN32
int mode = SR_STASYNC;
sr_setparm(SRL_DEVICE, SR_MODELTYPE, &mode)
#else
int mode = SR_POLLMODE;
sr_setparm(SRL_DEVICE, SR_MODEID, &mode)
#endif
/* Open the board device */
sprintf(DevName,":N_iptB1:P_IP");
rc = gc_OpenEx(&boarddev,DevName,EV_ASYNC,(void *)NULL);
/* Enable Alarm notification on the board handle with generic ASO ID*/
gc_SetAlarmNotifyAll (boarddev, ALARM_SOURCE_ID_NETWORK_ID, ALARM_NOTIFY);
/* -- Forever loop where the main work is done - wait for an event or user requested exit */
for (;;)
{
ret = sr_waitevt(500); /* 1/2 second */
if (ret != -1)
{ /* i.e. not timeout */
process_event();
}
}
}
process_event()
{
METAEVENT metaevent;
gc_GetMetaEvent(&metaevent)
evttype = metaevent.evttype;
switch (evttype)
{
case GCEV_ALARM:
print_alarm_info(&metaevent);
break;
}
}