コード例 #1
0
ftdm_status_t sngisdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trace_opt)
{
	sngisdn_span_data_t *signal_data = sngisdn_dchan((sngisdn_span_data_t*)span->signal_data);

	if (!signal_data) {
		ftdm_log(FTDM_LOG_ERROR, "%s:Span is not used by signalling module\n", span->name);
		return FTDM_FAIL;
	}

	switch (trace_opt) {
		case SNGISDN_TRACE_DISABLE:
			if (sngisdn_test_trace_flag(signal_data, SNGISDN_TRACE_Q921)) {
				ftdm_log(FTDM_LOG_INFO, "%s:Disabling q921 trace\n", signal_data->ftdm_span->name);
				sngisdn_clear_trace_flag(signal_data, SNGISDN_TRACE_Q921);
				
				if (sngisdn_cntrl_q921(signal_data->ftdm_span, ADISIMM, SATRC) != FTDM_SUCCESS) {
					ftdm_log(FTDM_LOG_INFO, "%s:Failed to disable q921 trace\n", signal_data->ftdm_span->name);
				}
			}
			if (sngisdn_test_trace_flag(signal_data, SNGISDN_TRACE_Q931)) {
				ftdm_log(FTDM_LOG_INFO, "%s:Disabling q921 trace\n", signal_data->ftdm_span->name);
				sngisdn_clear_trace_flag(signal_data, SNGISDN_TRACE_Q931);

				if (sngisdn_cntrl_q931(signal_data->ftdm_span, ADISIMM, SATRC) != FTDM_SUCCESS) {
					ftdm_log(FTDM_LOG_INFO, "%s:Failed to disable q921 trace\n", signal_data->ftdm_span->name);
				}
			}
			break;
		case SNGISDN_TRACE_Q921:
			if (!sngisdn_test_trace_flag(signal_data, SNGISDN_TRACE_Q921)) {
				ftdm_log(FTDM_LOG_INFO, "%s:Enabling q921 trace\n", signal_data->ftdm_span->name);
				sngisdn_set_trace_flag(signal_data, SNGISDN_TRACE_Q921);

				if (sngisdn_cntrl_q921(signal_data->ftdm_span, AENA, SATRC) != FTDM_SUCCESS) {
					ftdm_log(FTDM_LOG_INFO, "%s:Failed to enable q921 trace\n", signal_data->ftdm_span->name);
				}
			}
			break;
		case SNGISDN_TRACE_Q931:
			if (!sngisdn_test_trace_flag(signal_data, SNGISDN_TRACE_Q931)) {
				ftdm_log(FTDM_LOG_INFO, "s%d Enabling q931 trace\n", signal_data->link_id);
				sngisdn_set_trace_flag(signal_data, SNGISDN_TRACE_Q931);
				
				if (sngisdn_cntrl_q931(signal_data->ftdm_span, AENA, SATRC) != FTDM_SUCCESS) {
					ftdm_log(FTDM_LOG_INFO, "%s:Failed to enable q931 trace\n", signal_data->ftdm_span->name);
				}
			}
			break;
	}
	return FTDM_SUCCESS;
}
コード例 #2
0
ftdm_status_t sng_isdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trace_opt)
{
	sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data;
	switch (trace_opt) {
		case SNGISDN_TRACE_DISABLE:
			if (sngisdn_test_trace_flag(signal_data, SNGISDN_TRACE_Q921)) {
				ftdm_log(FTDM_LOG_INFO, "s%d Disabling q921 trace\n", signal_data->link_id);
				sngisdn_clear_trace_flag(signal_data, SNGISDN_TRACE_Q921);
				
				if (sng_isdn_cntrl_q921(span, ADISIMM, SAELMNT) != FTDM_SUCCESS) {
					ftdm_log(FTDM_LOG_ERROR, "s%d Failed to disable q921 trace\n");
				}
			}
			if (sngisdn_test_trace_flag(signal_data, SNGISDN_TRACE_Q931)) {
				ftdm_log(FTDM_LOG_INFO, "s%d Disabling q931 trace\n", signal_data->link_id);
				sngisdn_clear_trace_flag(signal_data, SNGISDN_TRACE_Q931);

				if (sng_isdn_cntrl_q931(span, ADISIMM, SATRC) != FTDM_SUCCESS) {
					ftdm_log(FTDM_LOG_ERROR, "s%d Failed to disable q931 trace\n");
				}
			}
			break;
		case SNGISDN_TRACE_Q921:
			if (!sngisdn_test_trace_flag(signal_data, SNGISDN_TRACE_Q921)) {
				ftdm_log(FTDM_LOG_INFO, "s%d Enabling q921 trace\n", signal_data->link_id);
				sngisdn_set_trace_flag(signal_data, SNGISDN_TRACE_Q921);

				if (sng_isdn_cntrl_q921(span, AENA, SATRC) != FTDM_SUCCESS) {
					ftdm_log(FTDM_LOG_ERROR, "s%d Failed to enable q921 trace\n");
				}
			}
			break;
		case SNGISDN_TRACE_Q931:
			if (!sngisdn_test_trace_flag(signal_data, SNGISDN_TRACE_Q931)) {
				ftdm_log(FTDM_LOG_INFO, "s%d Enabling q931 trace\n", signal_data->link_id);
				sngisdn_set_trace_flag(signal_data, SNGISDN_TRACE_Q931);
				
				if (sng_isdn_cntrl_q931(span, AENA, SATRC) != FTDM_SUCCESS) {
					ftdm_log(FTDM_LOG_ERROR, "s%d Failed to enable q931 trace\n");
				}
			}
			break;
	}
	return FTDM_SUCCESS;
}