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;
}
/* GENERAL STATUS *************************************************************/
void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt)
{
	SS7_FUNC_TRACE_ENTER(__FUNCTION__);

	sngss7_chan_data_t	*sngss7_info = NULL;
	ftdm_channel_t		*ftdmchan = NULL;
	sngss7_event_data_t	*sngss7_event = NULL;
	uint32_t			intfId;
	int 				x;



	/* check if the eventType is a pause/resume */
	switch (evntType) {
	/**************************************************************************/
	case (SIT_STA_PAUSEIND):
	case (SIT_STA_RESUMEIND):
		/* the circuit may or may not be on the local system so we have to find 
		 * circuit with the same intfId.  The circuit specified might also be
		 * a non-voice cic so we also need to find the first voice cic on this 
		 * system with the same intfId.
		 */
		intfId = g_ftdm_sngss7_data.cfg.isupCkt[circuit].infId;

		if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
			SS7_DEBUG("Rx %s on circuit that is not a voice CIC (%d) finding a new circuit\n", 
						DECODE_LCC_EVENT(evntType),
						g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic);
		}

		x = (g_ftdm_sngss7_data.cfg.procId * MAX_CIC_MAP_LENGTH) + 1;
		while ((g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) &&
			   (g_ftdm_sngss7_data.cfg.isupCkt[x].id < ((g_ftdm_sngss7_data.cfg.procId + 1) * MAX_CIC_MAP_LENGTH))) {
			/**********************************************************************/
			/* confirm this is a voice channel and not a gap/sig (no ftdmchan there) */
			if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == SNG_CKT_VOICE) {
				/* compare the intfIds */
				if (g_ftdm_sngss7_data.cfg.isupCkt[x].infId == intfId) {
					/* we have a match, setup the pointers to the correct values */
					circuit = x;

					/* confirm that the circuit is active on our side otherwise move to the next circuit */
					if (!sngss7_test_flag(&g_ftdm_sngss7_data.cfg.isupCkt[circuit], SNGSS7_ACTIVE)) {
						SS7_DEBUG("[CIC:%d]Rx %s but circuit is not active yet, skipping!\n",
									g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic,
									DECODE_LCC_EVENT(evntType));
						x++;
						continue;
					}

					if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) {
						SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit);
						SS7_FUNC_TRACE_EXIT(__FUNCTION__);
						return;
					}

					/* bounce out of the loop */
					break;
				}
			}

			x++;
			/**********************************************************************/
		}

		/* check if we found any circuits that are on the intfId, drop the message
		 * if none are found */
		if (!ftdmchan) {
			SS7_FUNC_TRACE_EXIT(__FUNCTION__);
			return;
		}

		break;
	/**************************************************************************/
	default:
		if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != SNG_CKT_VOICE) {
			ftdm_log(FTDM_LOG_DEBUG, "Rx %s on circuit that is not a voice CIC (%d) (circuit:%d)\n",
						DECODE_LCC_EVENT(evntType), g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, circuit);
			SS7_FUNC_TRACE_EXIT(__FUNCTION__);
			return;
		}

		/* get the ftdmchan and ss7_chan_data from the circuit */
		if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) {
			SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit);
			SS7_FUNC_TRACE_EXIT(__FUNCTION__);
			return;
		}
		break;
	/**************************************************************************/
	} /* switch (evntType) */

	/* initalize the sngss7_event */
	sngss7_event = ftdm_malloc(sizeof(*sngss7_event));
	if (sngss7_event == NULL) {
		SS7_ERROR("Failed to allocate memory for sngss7_event!\n");
		SS7_FUNC_TRACE_EXIT(__FUNCTION__);
		return;
	}
	memset(sngss7_event, 0x0, sizeof(*sngss7_event));

	/* fill in the sngss7_event struct */
	sngss7_event->spInstId	= spInstId;
	sngss7_event->suInstId	= suInstId;
	sngss7_event->circuit	= circuit;
	sngss7_event->globalFlg	= globalFlg;
	sngss7_event->evntType	= evntType;
	sngss7_event->event_id	= SNGSS7_STA_IND_EVENT;
	if (siStaEvnt != NULL) {
		memcpy(&sngss7_event->event.siStaEvnt, siStaEvnt, sizeof(*siStaEvnt));
	}

	/* enqueue this event */
	ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event);
}