Dialogic 05-2239-009 用户手册
266
Dialogic Corporation
QoS_infop->QoSThresholdData[n].unPercentSuccessThreshold);
printf("\tPercent Fail Threshold = %u\n",
QoS_infop->QoSThresholdData[n].unPercentFailThreshold);
printf("\n\n");
}
}
printf("\tPercent Fail Threshold = %u\n",
QoS_infop->QoSThresholdData[n].unPercentFailThreshold);
printf("\n\n");
}
}
4.21.5
Handling QoS Alarms
The application must first be enabled to receive notification of alarms on the specified line device.
The following code demonstrates how this is achieved.
The following code demonstrates how this is achieved.
/****************************************************************
* NAME: enable_alarm_notification(struct channel *pline)
* DESCRIPTION: Enables all alarms notification for pline
* Also fills in pline->mediah
* INPUT: pline - pointer to channel data structure
* RETURNS: None - exits if error
* CAUTIONS: Does no sanity checking as to whether or not the technology
* supports alarms - assumes caller has done that already
****************************************************************/
* NAME: enable_alarm_notification(struct channel *pline)
* DESCRIPTION: Enables all alarms notification for pline
* Also fills in pline->mediah
* INPUT: pline - pointer to channel data structure
* RETURNS: None - exits if error
* CAUTIONS: Does no sanity checking as to whether or not the technology
* supports alarms - assumes caller has done that already
****************************************************************/
static void enable_alarm_notification(struct channel *pline)
{
char str[MAX_STRING_SIZE];
int alarm_ldev; /* linedevice that alarms come on */
{
char str[MAX_STRING_SIZE];
int alarm_ldev; /* linedevice that alarms come on */
alarm_ldev = pline->ldev; /* until proven otherwise */
if (pline->techtype == H323)
{
/* Recall that the alarms for IP come on the media device, not the network device */
if (gc_GetResourceH(pline->ldev, &alarm_ldev, GC_MEDIADEVICE) != GC_SUCCESS)
{
sprintf(str, "gc_GetResourceH(linedev=%ld, &alarm_ldev,
GC_MEDIADEVICE) Failed", pline->ldev);
printandlog(pline->index, GC_APIERR, NULL, str);
exitdemo(1);
}
sprintf(str, "gc_GetResourceH(linedev=%ld, &alarm_ldev,
GC_MEDIADEVICE) passed, mediah = %d", pline->ldev, alarm_ldev);
printandlog(pline->index, MISC, NULL, str);
pline->mediah = alarm_ldev; /* save for later use */
}
else
{
printandlog(pline->index, MISC, NULL, "Not setting pline->mediah
since techtype != H323");
}
sprintf(str, "enable_alarm_notification - pline->mediah = %d\n", (int) pline->mediah);
{
/* Recall that the alarms for IP come on the media device, not the network device */
if (gc_GetResourceH(pline->ldev, &alarm_ldev, GC_MEDIADEVICE) != GC_SUCCESS)
{
sprintf(str, "gc_GetResourceH(linedev=%ld, &alarm_ldev,
GC_MEDIADEVICE) Failed", pline->ldev);
printandlog(pline->index, GC_APIERR, NULL, str);
exitdemo(1);
}
sprintf(str, "gc_GetResourceH(linedev=%ld, &alarm_ldev,
GC_MEDIADEVICE) passed, mediah = %d", pline->ldev, alarm_ldev);
printandlog(pline->index, MISC, NULL, str);
pline->mediah = alarm_ldev; /* save for later use */
}
else
{
printandlog(pline->index, MISC, NULL, "Not setting pline->mediah
since techtype != H323");
}
sprintf(str, "enable_alarm_notification - pline->mediah = %d\n", (int) pline->mediah);
if (gc_SetAlarmNotifyAll(alarm_ldev, ALARM_SOURCE_ID_NETWORK_ID,
ALARM_NOTIFY) != GC_SUCCESS)
{
sprintf(str, "gc_SetAlarmNotifyAll(linedev=%ld,
ALARM_SOURCE_ID_NETWORK_ID, ALARM_NOTIFY) Failed", pline->ldev);
printandlog(pline->index, GC_APIERR, NULL, str);
exitdemo(1);
}
sprintf(str, "gc_SetAlarmNotifyAll(linedev=%ld, ALARM_SOURCE_ID_NETWORK_ID,
ALARM_NOTIFY) PASSED", pline->ldev);
printandlog(pline->index, MISC, NULL, str);
}
ALARM_NOTIFY) != GC_SUCCESS)
{
sprintf(str, "gc_SetAlarmNotifyAll(linedev=%ld,
ALARM_SOURCE_ID_NETWORK_ID, ALARM_NOTIFY) Failed", pline->ldev);
printandlog(pline->index, GC_APIERR, NULL, str);
exitdemo(1);
}
sprintf(str, "gc_SetAlarmNotifyAll(linedev=%ld, ALARM_SOURCE_ID_NETWORK_ID,
ALARM_NOTIFY) PASSED", pline->ldev);
printandlog(pline->index, MISC, NULL, str);
}