void handle_sng_alarm(sng_alrm_t t_alarm)
{

    switch (t_alarm.entity) {
    /**************************************************************************/
    case (ENTL1):
        ftdm_log(FTDM_LOG_WARNING,"[SNG-MTP1] %s : %s : %s \n",
                                    DECODE_LL1_EVENT(t_alarm.event),
                                    DECODE_LL1_CAUSE(t_alarm.cause),
                                    DECODE_LL1_PARM(t_alarm.eventParm[0]));
        break;
    /**************************************************************************/
    case (ENTSD):
        ftdm_log(FTDM_LOG_WARNING,"[SNG-MTP2] %s : %s \n",
                                    DECODE_LSD_EVENT(t_alarm.event),
                                    DECODE_LSD_CAUSE(t_alarm.cause));
        break;
    /**************************************************************************/
    case (ENTSN):
        ftdm_log(FTDM_LOG_WARNING,"[SNG-MTP3] %s on %d: %s \n",
                                    DECODE_LSN_EVENT(t_alarm.event),
                                    t_alarm.id,
                                    DECODE_LSN_CAUSE(t_alarm.cause));
        break;
    /**************************************************************************/
    case (ENTSI):
        handle_entsi_alarm(t_alarm);
        break;
    /**************************************************************************/
    case (ENTCC):
        ftdm_log(FTDM_LOG_DEBUG,"[SNG-CC] %s : %s \n",
                                    DECODE_LCC_EVENT(t_alarm.event),
                                    DECODE_LCC_CAUSE(t_alarm.cause));
        break;
    /**************************************************************************/
    default:
        ftdm_log(FTDM_LOG_WARNING,"Received alarm from unknown entity");
        break;
    /**************************************************************************/
    } /* switch (t_alarm.entity) */

    return;
}
void handle_sng_mtp3_alarm(Pst *pst, SnMngmt *sta)
{
	char	buf[50];
	int		x = 1;

	SS7_RELAY_DBG_FUN(handle_sng_mtp3_alarm);
	
	memset(buf, '\0', sizeof(buf));

	switch (sta->hdr.elmId.elmnt) {
	/**************************************************************************/
	case (STDLSAP):

			/* find the name for the sap in question */
			x = 1;
			while (x < (MAX_MTP_LINKS+1)) {
				if (g_ftdm_sngss7_data.cfg.mtp3Link[x].id == sta->hdr.elmId.elmntInst1) {
					break;
				}
				x++;
			}

			if (g_ftdm_sngss7_data.cfg.mtp3Link[x].id == 0) {
				sprintf(buf, "[SAPID:%d]", sta->hdr.elmId.elmntInst1);
			} else {
				sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtp3Link[x].name);
			}

		switch (sta->t.usta.alarm.event) {
		/**********************************************************************/
		case (LSN_EVENT_INV_OPC_OTHER_END):
			
			ftdm_log(FTDM_LOG_ERROR,"[MTP3]%s %s : %s : OPC(0x%X%X%X%X)\n",
										buf,
										DECODE_LSN_EVENT(sta->t.usta.alarm.event),
										DECODE_LSN_CAUSE(sta->t.usta.alarm.cause),
										sta->t.usta.evntParm[3],
										sta->t.usta.evntParm[2],
										sta->t.usta.evntParm[1],
										sta->t.usta.evntParm[0]);
			break;
		/**********************************************************************/
		case (LSN_EVENT_INV_SLC_OTHER_END):
			ftdm_log(FTDM_LOG_ERROR,"[MTP3]%s %s : %s : SLC(%d)\n",
										buf,
										DECODE_LSN_EVENT(sta->t.usta.alarm.event),
										DECODE_LSN_CAUSE(sta->t.usta.alarm.cause),
										sta->t.usta.evntParm[0]);
			break;
		/**********************************************************************/
		default:
			ftdm_log(FTDM_LOG_DEBUG,"[MTP3]%s %s(%d) : %s(%d)\n",
										buf,
										DECODE_LSN_EVENT(sta->t.usta.alarm.event),
										sta->t.usta.alarm.event,
										DECODE_LSN_CAUSE(sta->t.usta.alarm.cause),
										sta->t.usta.alarm.cause);
			break;
		/**********************************************************************/
		} /* sta->t.usta.alarm.event */
		break;
	/**************************************************************************/
	case (STNSAP):
		ftdm_log(FTDM_LOG_ERROR,"[MTP3][SAPID:%d] %s : %s\n",
									sta->hdr.elmId.elmntInst1,
									DECODE_LSN_EVENT(sta->t.usta.alarm.event),
									DECODE_LSN_CAUSE(sta->t.usta.alarm.cause));
		break;
	/**************************************************************************/
	case (STLNKSET):
		ftdm_log(FTDM_LOG_DEBUG,"[MTP3][LNKSET:%d] %s : %s\n",
									sta->hdr.elmId.elmntInst1,
									DECODE_LSN_EVENT(sta->t.usta.alarm.event),
									DECODE_LSN_CAUSE(sta->t.usta.alarm.cause));
		break;
	/**************************************************************************/
	case (STROUT):
		switch (sta->t.usta.alarm.event) {
		/**********************************************************************/
		case (LSN_EVENT_RX_TRANSFER_MSG):
			switch (sta->t.usta.evntParm[5]) {
			/******************************************************************/
			case (0x23):
				ftdm_log(FTDM_LOG_INFO,"[MTP3] Rx SNM TFC\n");
				break;
			/******************************************************************/
			case (0x34):
				ftdm_log(FTDM_LOG_INFO,"[MTP3] Rx SNM TFR\n");
				break;
			/******************************************************************/
			case (0x54):
				ftdm_log(FTDM_LOG_INFO,"[MTP3] Rx SNM TFA\n");
				break;
			/******************************************************************/
			case (0x14):
				ftdm_log(FTDM_LOG_INFO,"[MTP3] Rx SNM TFP\n");
				break;
			/******************************************************************/
			case (0x24):
				ftdm_log(FTDM_LOG_INFO,"[MTP3] Rx SNM TFP (cluster)\n");
				break;
			/******************************************************************/
			case (0x64):
				ftdm_log(FTDM_LOG_INFO,"[MTP3] Rx SNM TFA (cluster)\n");
				break;
			/******************************************************************/
			case (0x44):
				ftdm_log(FTDM_LOG_INFO,"[MTP3] Rx SNM TFR (cluster)\n");
				break;
			/******************************************************************/
			} /* switch (sta->t.usta.evntParm[5]) */
			break;
		/**********************************************************************/
		default:
			ftdm_log(FTDM_LOG_ERROR,"[MTP3][DPC:0x%X%X%X%X] %s : %s\n",
										sta->t.usta.evntParm[0],
										sta->t.usta.evntParm[1],
										sta->t.usta.evntParm[2],
										sta->t.usta.evntParm[3],
										DECODE_LSN_EVENT(sta->t.usta.alarm.event),
										DECODE_LSN_CAUSE(sta->t.usta.alarm.cause));
			break;
		/**********************************************************************/
		} /* switch (sta->t.usta.alarm.event) */
		break;
	/**************************************************************************/
	default:
		ftdm_log(FTDM_LOG_ERROR,"[MTP3] %s(%d) : %s(%d)\n",
									DECODE_LSN_EVENT(sta->t.usta.alarm.event),
									sta->t.usta.alarm.event,
									DECODE_LSN_CAUSE(sta->t.usta.alarm.cause),
									sta->t.usta.alarm.cause);
		break;
	/**************************************************************************/
	} /* switch (sta->hdr.elmId.elmnt) */

	return;
}   /* handle_mtp3_alarm */