Merge remote branch 'smg_freeswitch/master'

This commit is contained in:
Moises Silva 2010-10-13 18:19:22 -04:00
commit fe638ad614
11 changed files with 627 additions and 93 deletions

6
devel-bootstrap.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
export CFLAGS="-ggdb3 -O0"
export CXXFLAGS="-ggdb3 -O0"
./bootstrap.sh -j
./configure $@

View File

@ -726,7 +726,7 @@ static FIO_SPAN_SET_SIG_STATUS_FUNCTION(ftdm_sangoma_isdn_set_span_sig_status)
}
static ftdm_status_t ftdm_sangoma_isdn_start(ftdm_span_t *span)
{
{
ftdm_log(FTDM_LOG_INFO,"Starting span %s:%u.\n",span->name,span->span_id);
if (sng_isdn_stack_start(span) != FTDM_SUCCESS) {
ftdm_log(FTDM_LOG_CRIT, "Failed to start span %s\n", span->name);
@ -747,9 +747,11 @@ static ftdm_status_t ftdm_sangoma_isdn_start(ftdm_span_t *span)
}
static ftdm_status_t ftdm_sangoma_isdn_stop(ftdm_span_t *span)
{
{
ftdm_iterator_t *chaniter = NULL;
ftdm_iterator_t *curr = NULL;
unsigned i;
sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data;
ftdm_log(FTDM_LOG_INFO, "Stopping span %s\n", span->name);
/* throw the STOP_THREAD flag to signal monitor thread stop */
@ -772,8 +774,13 @@ static ftdm_status_t ftdm_sangoma_isdn_stop(ftdm_span_t *span)
}
ftdm_iterator_free(chaniter);
ftdm_sched_destroy(&((sngisdn_span_data_t*)span->signal_data)->sched);
ftdm_queue_destroy(&((sngisdn_span_data_t*)span->signal_data)->event_queue);
ftdm_sched_destroy(&signal_data->sched);
ftdm_queue_destroy(&signal_data->event_queue);
for (i = 0 ; i < signal_data->num_local_numbers ; i++) {
if (signal_data->local_numbers[i] != NULL) {
ftdm_safe_free(signal_data->local_numbers[i]);
}
}
ftdm_safe_free(span->signal_data);
ftdm_log(FTDM_LOG_DEBUG, "Finished stopping span %s\n", span->name);

View File

@ -55,6 +55,7 @@
#define NUM_BRI_CHANNELS_PER_SPAN 2
#define SNGISDN_EVENT_QUEUE_SIZE 100
#define SNGISDN_EVENT_POLL_RATE 100
#define SNGISDN_NUM_LOCAL_NUMBERS 8
/* TODO: rename all *_cc_* to *_an_* */
@ -161,7 +162,7 @@ typedef struct sngisdn_chan_data {
/* Span specific data */
typedef struct sngisdn_span_data {
ftdm_span_t *ftdm_span;
ftdm_span_t *ftdm_span;
uint8_t link_id;
uint8_t switchtype;
uint8_t signalling; /* SNGISDN_SIGNALING_CPE or SNGISDN_SIGNALING_NET */
@ -175,7 +176,9 @@ typedef struct sngisdn_span_data {
uint8_t setup_arb;
uint8_t facility;
int8_t facility_timeout;
ftdm_sched_t *sched;
uint8_t num_local_numbers;
char* local_numbers[SNGISDN_NUM_LOCAL_NUMBERS];
ftdm_sched_t *sched;
ftdm_queue_t *event_queue;
} sngisdn_span_data_t;

View File

@ -36,9 +36,23 @@
ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span);
ftdm_status_t parse_signalling(const char* signalling, ftdm_span_t *span);
ftdm_status_t add_local_number(const char* val, ftdm_span_t *span);
extern ftdm_sngisdn_data_t g_sngisdn_data;
ftdm_status_t add_local_number(const char* val, ftdm_span_t *span)
{
sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data;
if (signal_data->num_local_numbers >= SNGISDN_NUM_LOCAL_NUMBERS) {
ftdm_log(FTDM_LOG_ERROR, "%s: Maximum number of local-numbers exceeded (max:%d)\n", span->name, SNGISDN_NUM_LOCAL_NUMBERS);
return FTDM_FAIL;
}
signal_data->local_numbers[signal_data->num_local_numbers++] = ftdm_strdup(val);
return FTDM_SUCCESS;
}
ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span)
{
unsigned i;
@ -253,6 +267,10 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_
ftdm_span_set_bearer_capability(val, &span->default_caller_data.bearer_capability);
} else if (!strcasecmp(var, "outbound-bearer_layer1")) {
ftdm_span_set_bearer_layer1(val, &span->default_caller_data.bearer_layer1);
} else if (!strcasecmp(var, "local-number")) {
if (add_local_number(val, span) != FTDM_SUCCESS) {
return FTDM_FAIL;
}
} else if (!strcasecmp(var, "facility-timeout")) {
signal_data->facility_timeout = atoi(val);
if (signal_data->facility_timeout < 0) {

View File

@ -43,7 +43,7 @@ extern ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Displ
void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event)
{
ISDN_FUNC_TRACE_ENTER(__FUNCTION__);
unsigned i;
int16_t suId = sngisdn_event->suId;
uint32_t suInstId = sngisdn_event->suInstId;
uint32_t spInstId = sngisdn_event->spInstId;
@ -57,7 +57,7 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event)
ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n");
ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_DEBUG, "Processing SETUP (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId);
switch (ftdmchan->state) {
case FTDM_CHANNEL_STATE_DOWN: /* Proper state to receive a SETUP */
if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE) ||
@ -80,11 +80,35 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event)
sngisdn_info->suInstId = get_unique_suInstId(suId);
sngisdn_info->spInstId = spInstId;
if (conEvnt->cdPtyNmb.eh.pres && signal_data->num_local_numbers) {
uint8_t local_number_matched = 0;
for (i = 0 ; i < signal_data->num_local_numbers ; i++) {
if (!strcmp(signal_data->local_numbers[i], (char*)conEvnt->cdPtyNmb.nmbDigits.val)) {
local_number_matched++;
break;
}
}
if (!local_number_matched) {
ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received SETUP, but local-number %s does not match - ignoring\n", conEvnt->cdPtyNmb.nmbDigits.val);
/* Special case to tell the stack to clear all internal resources about this call. We will no receive any event for this call after sending disconnect request */
ftdmchan->caller_data.hangup_cause = IN_CCNORTTODEST;
ftdm_sched_timer(signal_data->sched, "delayed_disconnect", 1, sngisdn_delayed_disconnect, (void*) sngisdn_info, NULL);
return;
}
}
/* If this is a glared call that was previously saved, we moved
all the info to the current call, so clear the glared saved data */
if (sngisdn_info->glare.spInstId == spInstId) {
clear_call_glare_data(sngisdn_info);
}
}
if (ftdmchan->span->trunk_type == FTDM_TRUNK_BRI_PTMP) {
if (signal_data->signalling == SNGISDN_SIGNALING_NET) {
sngisdn_info->ces = ces;
}
}
ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex);
g_sngisdn_data.ccs[suId].active_suInstIds[sngisdn_info->suInstId] = sngisdn_info;
@ -92,11 +116,6 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event)
ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND);
if (ftdmchan->span->trunk_type == FTDM_TRUNK_BRI_PTMP &&
signal_data->signalling == SNGISDN_SIGNALING_NET) {
sngisdn_info->ces = ces;
}
/* try to open the channel */
if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) {
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Failed to open channel");
@ -122,14 +141,13 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event)
ftdmchan->caller_data.bearer_layer1 = sngisdn_get_infoTranCap_from_stack(conEvnt->bearCap[0].usrInfoLyr1Prot.val);
ftdmchan->caller_data.bearer_capability = sngisdn_get_infoTranCap_from_stack(conEvnt->bearCap[0].infoTranCap.val);
}
if (signal_data->switchtype == SNGISDN_SWITCH_NI2) {
if (conEvnt->shift11.eh.pres && conEvnt->ni2OctStr.eh.pres) {
if (conEvnt->ni2OctStr.str.len == 4 && conEvnt->ni2OctStr.str.val[0] == 0x37) {
snprintf(ftdmchan->caller_data.aniII, 5, "%.2d", conEvnt->ni2OctStr.str.val[3]);
}
}
if (signal_data->facility == SNGISDN_OPT_TRUE && conEvnt->facilityStr.eh.pres) {
/* Verify whether the Caller Name will come in a subsequent FACILITY message */
@ -260,6 +278,10 @@ void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event)
case FTDM_CHANNEL_STATE_DIALING:
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_UP);
break;
case FTDM_CHANNEL_STATE_HANGUP_COMPLETE:
case FTDM_CHANNEL_STATE_HANGUP:
/* Race condition, we just hung up the call - ignore this message */
break;
default:
ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Processing CONNECT/CONNECT ACK in an invalid state (%s)\n", ftdm_channel_state2str(ftdmchan->state));
@ -274,7 +296,7 @@ void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event)
/* do nothing */
break;
case FTDM_CHANNEL_STATE_HANGUP_COMPLETE:
/* We just hung up an incoming call right after we sent a CONNECT so ignore this message */
/* Race condition, We just hung up an incoming call right after we sent a CONNECT - ignore this message */
break;
default:
ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Processing CONNECT/CONNECT ACK in an invalid state (%s)\n", ftdm_channel_state2str(ftdmchan->state));
@ -923,6 +945,16 @@ void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event)
break;
}
break;
case 12: /* We received a disconnect indication */
switch (ftdmchan->state) {
case FTDM_CHANNEL_STATE_TERMINATING:
/* We are already waiting for user app to handle the disconnect, do nothing */
break;
default:
ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state));
break;
}
break;
case 22:
switch (ftdmchan->state) {
case FTDM_CHANNEL_STATE_UP:

View File

@ -706,7 +706,7 @@ void sngisdn_rcv_q931_ind(InMngmt *status)
ftdm_span_t *ftdmspan;
sngisdn_span_data_t *signal_data = g_sngisdn_data.spans[status->t.usta.suId];
if (!signal_data) {
ftdm_log(FTDM_LOG_INFO, "Received q921 status on unconfigured span (lnkNmb:%d)\n", status->t.usta.suId);
ftdm_log(FTDM_LOG_INFO, "Received q931 status on unconfigured span (lnkNmb:%d)\n", status->t.usta.suId);
return;
}
ftdmspan = signal_data->ftdm_span;

View File

@ -424,11 +424,15 @@ void sngisdn_delayed_disconnect(void* p_sngisdn_info)
sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data;
ftdm_mutex_lock(ftdmchan->mutex);
if (ftdmchan->state != FTDM_CHANNEL_STATE_DOWN) {
if (ftdmchan->caller_data.hangup_cause == IN_CCNORTTODEST || ftdmchan->state != FTDM_CHANNEL_STATE_DOWN) {
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending delayed DISCONNECT (suId:%d suInstId:%u spInstId:%u)\n",
signal_data->cc_id, sngisdn_info->glare.spInstId, sngisdn_info->glare.suInstId);
sngisdn_snd_disconnect(ftdmchan);
if (ftdmchan->caller_data.hangup_cause == IN_CCNORTTODEST) {
ftdm_channel_t *close_chan = ftdmchan;
ftdm_channel_close(&close_chan);
}
}
ftdm_mutex_unlock(ftdmchan->mutex);

View File

@ -209,7 +209,10 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ
/* add any special variables for the dialplan */
sprintf(nadi, "%d", siConEvnt->cgPtyNum.natAddrInd.val);
ftdm_channel_add_var(ftdmchan, "ss7_nadi", nadi);
ftdm_channel_add_var(ftdmchan, "ss7_clg_nadi", nadi);
sprintf(nadi, "%d", siConEvnt->cdPtyNum.natAddrInd.val);
ftdm_channel_add_var(ftdmchan, "ss7_cld_nadi", nadi);
/* set the state of the channel to collecting...the rest is done by the chan monitor */
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_COLLECT);

View File

@ -206,6 +206,8 @@ typedef struct sng_isup_intf {
uint32_t mtpRouteId;
uint32_t ssf;
uint32_t isap;
uint32_t clg_nadi;
uint32_t cld_nadi;
uint16_t t4;
uint32_t t10;
uint32_t t11;

View File

@ -74,7 +74,8 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
SS7_FUNC_TRACE_ENTER (__FUNCTION__);
sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;;
const char *nadi = NULL;
const char *clg_nadi = NULL;
const char *cld_nadi = NULL;
SiConEvnt iam;
sngss7_info->suInstId = get_unique_id ();
@ -183,13 +184,23 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
copy_cgPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cgPtyNum);
/* check if the user would like a custom NADI value for the calling Pty Num */
nadi = ftdm_channel_get_var(ftdmchan, "ss7_nadi");
if ((nadi != NULL) && (*nadi)) {
SS7_DEBUG_CHAN(ftdmchan,"Found user supplied NADI value \"%s\"\n", nadi);
iam.cgPtyNum.natAddrInd.val = atoi(nadi);
clg_nadi = ftdm_channel_get_var(ftdmchan, "ss7_clg_nadi");
if ((clg_nadi != NULL) && (*clg_nadi)) {
SS7_DEBUG_CHAN(ftdmchan,"Found user supplied NADI value \"%s\"\n", clg_nadi);
iam.cgPtyNum.natAddrInd.val = atoi(clg_nadi);
} else {
SS7_DEBUG_CHAN(ftdmchan,"No user supplied NADI value found, using \"3\" %s\n", " ");
iam.cgPtyNum.natAddrInd.val = 0x03;
iam.cgPtyNum.natAddrInd.val = g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId].clg_nadi;
SS7_DEBUG_CHAN(ftdmchan,"No user supplied NADI value found for CLG, using \"%d\"\n", iam.cgPtyNum.natAddrInd.val);
}
cld_nadi = ftdm_channel_get_var(ftdmchan, "ss7_cld_nadi");
if ((cld_nadi != NULL) && (*cld_nadi)) {
SS7_DEBUG_CHAN(ftdmchan,"Found user supplied NADI value \"%s\"\n", cld_nadi);
iam.cdPtyNum.natAddrInd.val = atoi(cld_nadi);
} else {
iam.cdPtyNum.natAddrInd.val = g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId].cld_nadi;
SS7_DEBUG_CHAN(ftdmchan,"No user supplied NADI value found for CLD, using \"%d\"\n", iam.cdPtyNum.natAddrInd.val);
}
sng_cc_con_request (sngss7_info->spId,
@ -199,10 +210,12 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
&iam,
0);
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx IAM clg = \"%s\", cld = \"%s\"\n",
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx IAM clg = \"%s\" (NADI=%d), cld = \"%s\" (NADI=%d)\n",
sngss7_info->circuit->cic,
ftdmchan->caller_data.cid_num.digits,
ftdmchan->caller_data.dnis.digits);
iam.cgPtyNum.natAddrInd.val,
ftdmchan->caller_data.dnis.digits,
iam.cdPtyNum.natAddrInd.val);
SS7_FUNC_TRACE_EXIT (__FUNCTION__);
return;

View File

@ -47,6 +47,23 @@ typedef struct sng_timeslot
int hole;
}sng_timeslot_t;
typedef struct sng_isupCkt
{
ftdm_span_t *span;
uint32_t cicbase;
uint32_t typeCntrl;
char ch_map[MAX_CIC_MAP_LENGTH];
uint32_t isupInf;
uint32_t t3;
uint32_t t12;
uint32_t t13;
uint32_t t14;
uint32_t t15;
uint32_t t16;
uint32_t t17;
uint32_t tval;
} sng_isupCkt_t;
int cmbLinkSetId;
/******************************************************************************/
@ -77,7 +94,7 @@ static int ftmod_ss7_fill_in_isap(sng_isap_t *sng_isap);
static int ftmod_ss7_fill_in_self_route(int spc, int linkType, int switchType, int ssf);
static int ftmod_ss7_fill_in_circuits(char *ch_map, int cicbase, int typeCntrl, int isup_id, ftdm_span_t *span);
static int ftmod_ss7_fill_in_circuits(sng_isupCkt_t *isupCkt);
static int ftmod_ss7_next_timeslot(char *ch_map, sng_timeslot_t *timeslot);
/******************************************************************************/
@ -91,9 +108,10 @@ int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *spa
const char *val = NULL;
ftdm_conf_node_t *ptr = NULL;
sng_route_t self_route;
char ch_map[MAX_CIC_MAP_LENGTH];
int typeCntrl = 0;
int cicbase = 0;
sng_isupCkt_t isupCkt;
/* clean out the isup ckt */
memset(&isupCkt, 0x0, sizeof(sng_isupCkt_t));
/* clean out the self route */
memset(&self_route, 0x0, sizeof(sng_route_t));
@ -124,24 +142,24 @@ int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *spa
if (!strcasecmp(var, "ch_map")) {
/**********************************************************************/
strcpy(ch_map, val);
SS7_DEBUG("\tFound channel map \"%s\"\n", ch_map);
strcpy(isupCkt.ch_map, val);
SS7_DEBUG("\tFound channel map \"%s\"\n", isupCkt.ch_map);
/**********************************************************************/
} else if (!strcasecmp(var, "typeCntrl")) {
if (!strcasecmp(val, "bothway")) {
typeCntrl = BOTHWAY;
isupCkt.typeCntrl = BOTHWAY;
SS7_DEBUG("\tFound control type \"bothway\"\n");
} else if (!strcasecmp(val, "incoming")) {
typeCntrl = INCOMING;
isupCkt.typeCntrl = INCOMING;
SS7_DEBUG("\tFound control type \"incoming\"\n");
} else if (!strcasecmp(val, "outgoing")) {
typeCntrl = OUTGOING;
isupCkt.typeCntrl = OUTGOING;
SS7_DEBUG("\tFound control type \"outgoing\"\n");
} else if (!strcasecmp(val, "controlled")) {
typeCntrl = CONTROLLED;
isupCkt.typeCntrl = CONTROLLED;
SS7_DEBUG("\tFound control type \"controlled\"\n");
} else if (!strcasecmp(val, "controlling")) {
typeCntrl = CONTROLLING;
isupCkt.typeCntrl = CONTROLLING;
SS7_DEBUG("\tFound control type \"controlling\"\n");
} else {
SS7_ERROR("Found invalid circuit control type \"%s\"!", val);
@ -149,8 +167,8 @@ int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *spa
}
/**********************************************************************/
} else if (!strcasecmp(var, "cicbase")) {
cicbase = atoi(val);
SS7_DEBUG("\tFound cicbase = %d\n", cicbase);
isupCkt.cicbase = atoi(val);
SS7_DEBUG("\tFound cicbase = %d\n", isupCkt.cicbase);
/**********************************************************************/
} else if (!strcasecmp(var, "dialplan")) {
/* do i give a shit about this??? */
@ -169,7 +187,41 @@ int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *spa
/* move on to the next one */
x++;
}
SS7_DEBUG("\tFound isup_interface = %s\n",g_ftdm_sngss7_data.cfg.isupIntf[x].name );
isupCkt.isupInf = x;
SS7_DEBUG("\tFound isup_interface = %s\n",g_ftdm_sngss7_data.cfg.isupIntf[x].name);
/**********************************************************************/
} else if (!strcasecmp(var, "isup.t3")) {
isupCkt.t3 = atoi(val);
SS7_DEBUG("\tFound isup t3 = \"%d\"\n", isupCkt.t3);
/**********************************************************************/
} else if (!strcasecmp(var, "isup.t12")) {
isupCkt.t12 = atoi(val);
SS7_DEBUG("\tFound isup t12 = \"%d\"\n", isupCkt.t12);
/**********************************************************************/
} else if (!strcasecmp(var, "isup.t13")) {
isupCkt.t13 = atoi(val);
SS7_DEBUG("\tFound isup t13 = \"%d\"\n", isupCkt.t13);
/**********************************************************************/
} else if (!strcasecmp(var, "isup.t14")) {
isupCkt.t14 = atoi(val);
SS7_DEBUG("\tFound isup t14 = \"%d\"\n", isupCkt.t14);
/**********************************************************************/
} else if (!strcasecmp(var, "isup.t15")) {
isupCkt.t15 = atoi(val);
SS7_DEBUG("\tFound isup t15 = \"%d\"\n", isupCkt.t15);
/**********************************************************************/
} else if (!strcasecmp(var, "isup.t16")) {
isupCkt.t16 = atoi(val);
SS7_DEBUG("\tFound isup t16 = \"%d\"\n", isupCkt.t16);
/**********************************************************************/
} else if (!strcasecmp(var, "isup.t17")) {
isupCkt.t17 = atoi(val);
SS7_DEBUG("\tFound isup t17 = \"%d\"\n", isupCkt.t17);
/**********************************************************************/
} else if (!strcasecmp(var, "isup.tval")) {
isupCkt.tval = atoi(val);
SS7_DEBUG("\tFound isup tval = \"%d\"\n", isupCkt.tval);
/**********************************************************************/
} else {
SS7_ERROR("Unknown parameter found =\"%s\"...ignoring it!\n", var);
@ -192,10 +244,11 @@ int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *spa
}
/* fill the pointer to span into isupCkt */
isupCkt.span = span;
/* setup the circuits structure */
if(ftmod_ss7_fill_in_circuits(ch_map, cicbase, typeCntrl,
g_ftdm_sngss7_data.cfg.isupIntf[x].id, span)) {
if(ftmod_ss7_fill_in_circuits(&isupCkt)) {
SS7_ERROR("Failed to fill in circuits structure!\n");
goto ftmod_ss7_parse_xml_error;
}
@ -582,6 +635,130 @@ static int ftmod_ss7_parse_mtp_link(ftdm_conf_node_t *mtp_link, sng_mtp_link_t *
mtpLink->mtp3.slc = atoi(parm->val);
SS7_DEBUG("\tFound mtpLink->slc = \"%d\"\n",mtpLink->mtp3.slc);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp2.t1")) {
mtpLink->mtp2.t1 = atoi(parm->val);
SS7_DEBUG("\tFound mtp2 t1 = \"%d\"\n",mtpLink->mtp2.t1);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp2.t2")) {
mtpLink->mtp2.t2 = atoi(parm->val);
SS7_DEBUG("\tFound mtp2 t2 = \"%d\"\n",mtpLink->mtp2.t2);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp2.t3")) {
mtpLink->mtp2.t3 = atoi(parm->val);
SS7_DEBUG("\tFound mtp2 t3 = \"%d\"\n",mtpLink->mtp2.t3);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp2.t4n")) {
mtpLink->mtp2.t4n = atoi(parm->val);
SS7_DEBUG("\tFound mtp2 t4n = \"%d\"\n",mtpLink->mtp2.t4n);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp2.t4e")) {
mtpLink->mtp2.t4e = atoi(parm->val);
SS7_DEBUG("\tFound mtp2 t4e = \"%d\"\n",mtpLink->mtp2.t4e);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp2.t5")) {
mtpLink->mtp2.t5 = atoi(parm->val);
SS7_DEBUG("\tFound mtp2 t5 = \"%d\"\n",mtpLink->mtp2.t5);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp2.t6")) {
mtpLink->mtp2.t6 = atoi(parm->val);
SS7_DEBUG("\tFound mtp2 t6 = \"%d\"\n",mtpLink->mtp2.t6);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp2.t7")) {
mtpLink->mtp2.t7 = atoi(parm->val);
SS7_DEBUG("\tFound mtp2 t7 = \"%d\"\n",mtpLink->mtp2.t7);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t1")) {
mtpLink->mtp3.t1 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t1 = \"%d\"\n",mtpLink->mtp3.t1);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t2")) {
mtpLink->mtp3.t2 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t2 = \"%d\"\n",mtpLink->mtp3.t2);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t3")) {
mtpLink->mtp3.t3 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t3 = \"%d\"\n",mtpLink->mtp3.t3);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t4")) {
mtpLink->mtp3.t4 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t4 = \"%d\"\n",mtpLink->mtp3.t4);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t5")) {
mtpLink->mtp3.t5 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t5 = \"%d\"\n",mtpLink->mtp3.t5);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t7")) {
mtpLink->mtp3.t7 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t7 = \"%d\"\n",mtpLink->mtp3.t7);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t12")) {
mtpLink->mtp3.t12 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t12 = \"%d\"\n",mtpLink->mtp3.t12);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t13")) {
mtpLink->mtp3.t13 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t13 = \"%d\"\n",mtpLink->mtp3.t13);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t14")) {
mtpLink->mtp3.t14 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t14 = \"%d\"\n",mtpLink->mtp3.t14);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t17")) {
mtpLink->mtp3.t17 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t17 = \"%d\"\n",mtpLink->mtp3.t17);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t22")) {
mtpLink->mtp3.t22 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t22 = \"%d\"\n",mtpLink->mtp3.t22);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t23")) {
mtpLink->mtp3.t23 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t23 = \"%d\"\n",mtpLink->mtp3.t23);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t24")) {
mtpLink->mtp3.t24 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t24 = \"%d\"\n",mtpLink->mtp3.t24);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t31")) {
mtpLink->mtp3.t31 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t31 = \"%d\"\n",mtpLink->mtp3.t31);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t32")) {
mtpLink->mtp3.t32 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t32 = \"%d\"\n",mtpLink->mtp3.t32);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t33")) {
mtpLink->mtp3.t33 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t33 = \"%d\"\n",mtpLink->mtp3.t33);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t34")) {
mtpLink->mtp3.t34 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t34 = \"%d\"\n",mtpLink->mtp3.t34);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t35")) {
mtpLink->mtp3.t35 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t35 = \"%d\"\n",mtpLink->mtp3.t35);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t36")) {
mtpLink->mtp3.t36 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t36 = \"%d\"\n",mtpLink->mtp3.t36);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t37")) {
mtpLink->mtp3.t37 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t37 = \"%d\"\n",mtpLink->mtp3.t37);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.tcraft")) {
mtpLink->mtp3.tcraft = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 tcraft = \"%d\"\n",mtpLink->mtp3.tcraft);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.tflc")) {
mtpLink->mtp3.tflc = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 tflc = \"%d\"\n",mtpLink->mtp3.tflc);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.tbnd")) {
mtpLink->mtp3.tbnd = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 tbnd = \"%d\"\n",mtpLink->mtp3.tbnd);
/**********************************************************************/
} else {
SS7_ERROR("\tFound an invalid parameter \"%s\"!\n", parm->val);
return FTDM_FAIL;
@ -697,6 +874,50 @@ static int ftmod_ss7_parse_mtp_route(ftdm_conf_node_t *mtp_route)
return FTDM_FAIL;
}
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t6")) {
mtpRoute.t6 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t6 = \"%d\"\n",mtpRoute.t6);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t8")) {
mtpRoute.t8 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t8 = \"%d\"\n",mtpRoute.t8);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t10")) {
mtpRoute.t10 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t10 = \"%d\"\n",mtpRoute.t10);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t11")) {
mtpRoute.t11 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t11 = \"%d\"\n",mtpRoute.t11);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t15")) {
mtpRoute.t15 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t15 = \"%d\"\n",mtpRoute.t15);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t16")) {
mtpRoute.t16 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t16 = \"%d\"\n",mtpRoute.t16);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t18")) {
mtpRoute.t18 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t18 = \"%d\"\n",mtpRoute.t18);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t19")) {
mtpRoute.t19 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t19 = \"%d\"\n",mtpRoute.t19);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t21")) {
mtpRoute.t21 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t21 = \"%d\"\n",mtpRoute.t21);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t25")) {
mtpRoute.t25 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t25 = \"%d\"\n",mtpRoute.t25);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "mtp3.t26")) {
mtpRoute.t26 = atoi(parm->val);
SS7_DEBUG("\tFound mtp3 t26 = \"%d\"\n",mtpRoute.t26);
/**********************************************************************/
} else {
SS7_ERROR("\tFound an invalid parameter \"%s\"!\n", parm->val);
return FTDM_FAIL;
@ -755,6 +976,8 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface)
int num_parms = isup_interface->n_parameters;
int i;
int linkSetId;
int flag_cld_nadi = 0;
int flag_clg_nadi = 0;
memset(&sng_isup, 0x0, sizeof(sng_isup));
memset(&sng_isap, 0x0, sizeof(sng_isap));
@ -840,6 +1063,192 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface)
SS7_DEBUG("\tFound license file = %s\n", g_ftdm_sngss7_data.cfg.license);
SS7_DEBUG("\tFound signature file = %s\n", g_ftdm_sngss7_data.cfg.signature);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t1")) {
sng_isap.t1 = atoi(parm->val);
SS7_DEBUG("\tFound isup t1 = \"%d\"\n",sng_isap.t1);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t2")) {
sng_isap.t2 = atoi(parm->val);
SS7_DEBUG("\tFound isup t2 = \"%d\"\n",sng_isap.t2);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t4")) {
sng_isup.t4 = atoi(parm->val);
SS7_DEBUG("\tFound isup t4 = \"%d\"\n",sng_isup.t4);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t5")) {
sng_isap.t5 = atoi(parm->val);
SS7_DEBUG("\tFound isup t5 = \"%d\"\n",sng_isap.t5);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t6")) {
sng_isap.t6 = atoi(parm->val);
SS7_DEBUG("\tFound isup t6 = \"%d\"\n",sng_isap.t6);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t7")) {
sng_isap.t7 = atoi(parm->val);
SS7_DEBUG("\tFound isup t7 = \"%d\"\n",sng_isap.t7);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t8")) {
sng_isap.t8 = atoi(parm->val);
SS7_DEBUG("\tFound isup t8 = \"%d\"\n",sng_isap.t8);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t9")) {
sng_isap.t9 = atoi(parm->val);
SS7_DEBUG("\tFound isup t9 = \"%d\"\n",sng_isap.t9);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t10")) {
sng_isup.t10 = atoi(parm->val);
SS7_DEBUG("\tFound isup t10 = \"%d\"\n",sng_isup.t10);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t11")) {
sng_isup.t11 = atoi(parm->val);
SS7_DEBUG("\tFound isup t11 = \"%d\"\n",sng_isup.t11);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t18")) {
sng_isup.t18 = atoi(parm->val);
SS7_DEBUG("\tFound isup t18 = \"%d\"\n",sng_isup.t18);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t19")) {
sng_isup.t19 = atoi(parm->val);
SS7_DEBUG("\tFound isup t19 = \"%d\"\n",sng_isup.t19);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t20")) {
sng_isup.t20 = atoi(parm->val);
SS7_DEBUG("\tFound isup t20 = \"%d\"\n",sng_isup.t20);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t21")) {
sng_isup.t21 = atoi(parm->val);
SS7_DEBUG("\tFound isup t21 = \"%d\"\n",sng_isup.t21);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t22")) {
sng_isup.t22 = atoi(parm->val);
SS7_DEBUG("\tFound isup t22 = \"%d\"\n",sng_isup.t22);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t23")) {
sng_isup.t23 = atoi(parm->val);
SS7_DEBUG("\tFound isup t23 = \"%d\"\n",sng_isup.t23);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t24")) {
sng_isup.t24 = atoi(parm->val);
SS7_DEBUG("\tFound isup t24 = \"%d\"\n",sng_isup.t24);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t25")) {
sng_isup.t25 = atoi(parm->val);
SS7_DEBUG("\tFound isup t25 = \"%d\"\n",sng_isup.t25);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t26")) {
sng_isup.t26 = atoi(parm->val);
SS7_DEBUG("\tFound isup t26 = \"%d\"\n",sng_isup.t26);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t28")) {
sng_isup.t28 = atoi(parm->val);
SS7_DEBUG("\tFound isup t28 = \"%d\"\n",sng_isup.t28);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t29")) {
sng_isup.t29 = atoi(parm->val);
SS7_DEBUG("\tFound isup t29 = \"%d\"\n",sng_isup.t29);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t30")) {
sng_isup.t30 = atoi(parm->val);
SS7_DEBUG("\tFound isup t30 = \"%d\"\n",sng_isup.t30);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t31")) {
sng_isap.t31 = atoi(parm->val);
SS7_DEBUG("\tFound isup t31 = \"%d\"\n",sng_isap.t31);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t32")) {
sng_isup.t32 = atoi(parm->val);
SS7_DEBUG("\tFound isup t32 = \"%d\"\n",sng_isup.t32);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t33")) {
sng_isap.t33 = atoi(parm->val);
SS7_DEBUG("\tFound isup t33 = \"%d\"\n",sng_isap.t33);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t34")) {
sng_isap.t34 = atoi(parm->val);
SS7_DEBUG("\tFound isup t34 = \"%d\"\n",sng_isap.t34);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t35")) {
sng_isup.t35 = atoi(parm->val);
SS7_DEBUG("\tFound isup t35 = \"%d\"\n",sng_isup.t35);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t36")) {
sng_isap.t36 = atoi(parm->val);
SS7_DEBUG("\tFound isup t36 = \"%d\"\n",sng_isap.t36);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t37")) {
sng_isup.t37 = atoi(parm->val);
SS7_DEBUG("\tFound isup t37 = \"%d\"\n",sng_isup.t37);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t38")) {
sng_isup.t38 = atoi(parm->val);
SS7_DEBUG("\tFound isup t38 = \"%d\"\n",sng_isup.t38);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.t39")) {
sng_isup.t39 = atoi(parm->val);
SS7_DEBUG("\tFound isup t39 = \"%d\"\n",sng_isup.t39);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.tccr")) {
sng_isap.tccr = atoi(parm->val);
SS7_DEBUG("\tFound isup tccr = \"%d\"\n",sng_isap.tccr);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.tccrt")) {
sng_isap.tccrt = atoi(parm->val);
SS7_DEBUG("\tFound isup tccrt = \"%d\"\n",sng_isap.tccrt);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.tex")) {
sng_isap.tex = atoi(parm->val);
SS7_DEBUG("\tFound isup tex = \"%d\"\n",sng_isap.tex);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.tect")) {
sng_isap.tect = atoi(parm->val);
SS7_DEBUG("\tFound isup tect = \"%d\"\n",sng_isap.tect);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.tcrm")) {
sng_isap.tcrm = atoi(parm->val);
SS7_DEBUG("\tFound isup tcrm = \"%d\"\n",sng_isap.tcrm);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.tcra")) {
sng_isap.tcra = atoi(parm->val);
SS7_DEBUG("\tFound isup tcra = \"%d\"\n",sng_isap.tcra);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.tfgr")) {
sng_isup.tfgr = atoi(parm->val);
SS7_DEBUG("\tFound isup tfgr = \"%d\"\n",sng_isup.tfgr);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.trelrsp")) {
sng_isap.trelrsp = atoi(parm->val);
SS7_DEBUG("\tFound isup trelrsp = \"%d\"\n",sng_isap.trelrsp);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.tfnlrelrsp")) {
sng_isap.tfnlrelrsp = atoi(parm->val);
SS7_DEBUG("\tFound isup tfnlrelrsp = \"%d\"\n",sng_isap.tfnlrelrsp);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.tfnlrelrsp")) {
sng_isap.tfnlrelrsp = atoi(parm->val);
SS7_DEBUG("\tFound isup tfnlrelrsp = \"%d\"\n",sng_isap.tfnlrelrsp);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.tpause")) {
sng_isup.tpause = atoi(parm->val);
SS7_DEBUG("\tFound isup tpause = \"%d\"\n",sng_isup.tpause);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "isup.tstaenq")) {
sng_isup.tstaenq = atoi(parm->val);
SS7_DEBUG("\tFound isup tstaenq = \"%d\"\n",sng_isup.tstaenq);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "clg_nadi")) {
/**********************************************************************/
/* throw the flag so that we know we got this optional parameter */
flag_clg_nadi = 1;
sng_isup.clg_nadi = atoi(parm->val);
SS7_DEBUG("\tFound default CLG_NADI value = %d\n", sng_isup.clg_nadi);
/**********************************************************************/
} else if (!strcasecmp(parm->var, "cld_nadi")) {
/**********************************************************************/
/* throw the flag so that we know we got this optional parameter */
flag_cld_nadi = 1;
sng_isup.cld_nadi = atoi(parm->val);
SS7_DEBUG("\tFound default CLD_NADI value = %d\n", sng_isup.cld_nadi);
/**********************************************************************/
} else {
SS7_ERROR("\tFound an invalid parameter \"%s\"!\n", parm->val);
return FTDM_FAIL;
@ -850,6 +1259,17 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface)
parm = parm + 1;
}
/* check if the user filled in a nadi value by looking at flag */
if (!flag_cld_nadi) {
/* default the nadi value to national */
sng_isup.cld_nadi = 0x03;
}
if (!flag_clg_nadi) {
/* default the nadi value to national */
sng_isup.clg_nadi = 0x03;
}
/* trickle down the SPC to all sub entities */
linkSetId = g_ftdm_sngss7_data.cfg.mtpRoute[sng_isup.mtpRouteId].linkSetId;
@ -1249,6 +1669,8 @@ static int ftmod_ss7_fill_in_isup_interface(sng_isup_inf_t *sng_isup)
g_ftdm_sngss7_data.cfg.isupIntf[i].switchType = sng_isup->switchType;
g_ftdm_sngss7_data.cfg.isupIntf[i].ssf = sng_isup->ssf;
g_ftdm_sngss7_data.cfg.isupIntf[i].isap = sng_isup->isap;
g_ftdm_sngss7_data.cfg.isupIntf[i].cld_nadi = sng_isup->cld_nadi;
g_ftdm_sngss7_data.cfg.isupIntf[i].clg_nadi = sng_isup->clg_nadi;
if (sng_isup->t4 != 0) {
g_ftdm_sngss7_data.cfg.isupIntf[i].t4 = sng_isup->t4;
@ -1544,7 +1966,7 @@ static int ftmod_ss7_fill_in_self_route(int spc, int linkType, int switchType, i
}
/******************************************************************************/
static int ftmod_ss7_fill_in_circuits(char *ch_map, int cicbase, int typeCntrl, int isup_id, ftdm_span_t *span)
static int ftmod_ss7_fill_in_circuits(sng_isupCkt_t *isupCkt)
{
sngss7_chan_data_t *ss7_info = NULL;
ftdm_channel_t *ftdmchan = NULL;
@ -1555,10 +1977,10 @@ static int ftmod_ss7_fill_in_circuits(char *ch_map, int cicbase, int typeCntrl,
count = 1;
while (ch_map[0] != '\0') {
while (isupCkt->ch_map[0] != '\0') {
/* pull out the next timeslot */
if (ftmod_ss7_next_timeslot(ch_map, &timeslot)) {
if (ftmod_ss7_next_timeslot(isupCkt->ch_map, &timeslot)) {
SS7_ERROR("Failed to parse the channel map!\n");
return FTDM_FAIL;
}
@ -1568,10 +1990,10 @@ static int ftmod_ss7_fill_in_circuits(char *ch_map, int cicbase, int typeCntrl,
x = 1;
while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
if ((g_ftdm_sngss7_data.cfg.isupCkt[x].chan == count) &&
(g_ftdm_sngss7_data.cfg.isupCkt[x].span == span->channels[1]->physical_span_id)) {
(g_ftdm_sngss7_data.cfg.isupCkt[x].span == isupCkt->span->channels[1]->physical_span_id)) {
SS7_DEVEL_DEBUG("Circuit for span=%d, chan=%d is already exists...id=%d\n",
span->channels[1]->physical_span_id,
isupCkt->span->channels[1]->physical_span_id,
count,
x);
@ -1585,7 +2007,7 @@ static int ftmod_ss7_fill_in_circuits(char *ch_map, int cicbase, int typeCntrl,
/* check why we exited the while loop */
if (g_ftdm_sngss7_data.cfg.isupCkt[x].id == 0) {
SS7_DEVEL_DEBUG("Circuit for span=%d, chan=%d is new...id=%d\n",
span->channels[1]->physical_span_id,
isupCkt->span->channels[1]->physical_span_id,
count,
x);
@ -1596,7 +2018,7 @@ static int ftmod_ss7_fill_in_circuits(char *ch_map, int cicbase, int typeCntrl,
/* circuit is new so fill in the needed information */
g_ftdm_sngss7_data.cfg.isupCkt[x].id = x;
g_ftdm_sngss7_data.cfg.isupCkt[x].span = span->channels[1]->physical_span_id;
g_ftdm_sngss7_data.cfg.isupCkt[x].span = isupCkt->span->channels[1]->physical_span_id;
g_ftdm_sngss7_data.cfg.isupCkt[x].chan = count;
if (timeslot.siglink) {
g_ftdm_sngss7_data.cfg.isupCkt[x].type = SIG;
@ -1605,22 +2027,14 @@ static int ftmod_ss7_fill_in_circuits(char *ch_map, int cicbase, int typeCntrl,
}
if (timeslot.channel) {
g_ftdm_sngss7_data.cfg.isupCkt[x].cic = cicbase;
cicbase++;
g_ftdm_sngss7_data.cfg.isupCkt[x].cic = isupCkt->cicbase;
isupCkt->cicbase++;
} else {
g_ftdm_sngss7_data.cfg.isupCkt[x].cic = 0;
}
g_ftdm_sngss7_data.cfg.isupCkt[x].infId = isup_id;
g_ftdm_sngss7_data.cfg.isupCkt[x].typeCntrl = typeCntrl;
g_ftdm_sngss7_data.cfg.isupCkt[x].t3 = 1200;
g_ftdm_sngss7_data.cfg.isupCkt[x].t12 = 300;
g_ftdm_sngss7_data.cfg.isupCkt[x].t13 = 3000;
g_ftdm_sngss7_data.cfg.isupCkt[x].t14 = 300;
g_ftdm_sngss7_data.cfg.isupCkt[x].t15 = 3000;
g_ftdm_sngss7_data.cfg.isupCkt[x].t16 = 300;
g_ftdm_sngss7_data.cfg.isupCkt[x].t17 = 3000;
g_ftdm_sngss7_data.cfg.isupCkt[x].tval = 10;
g_ftdm_sngss7_data.cfg.isupCkt[x].ssf = g_ftdm_sngss7_data.cfg.isupIntf[isup_id].ssf;
g_ftdm_sngss7_data.cfg.isupCkt[x].infId = isupCkt->isupInf;
g_ftdm_sngss7_data.cfg.isupCkt[x].typeCntrl = isupCkt->typeCntrl;
g_ftdm_sngss7_data.cfg.isupCkt[x].ssf = g_ftdm_sngss7_data.cfg.isupIntf[isupCkt->isupInf].ssf;
g_ftdm_sngss7_data.cfg.isupCkt[x].obj = ss7_info;
} /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].id == 0) */
@ -1631,26 +2045,26 @@ static int ftmod_ss7_fill_in_circuits(char *ch_map, int cicbase, int typeCntrl,
} else { /* if ((timeslot.siglink) || (timeslot.gap)) */
/* find the ftdm the channel structure for this channel*/
i = 1;
while (span->channels[i] != NULL) {
if (span->channels[i]->physical_chan_id == timeslot.channel) {
while (isupCkt->span->channels[i] != NULL) {
if (isupCkt->span->channels[i]->physical_chan_id == timeslot.channel) {
break;
}
i++;
} /* while (span->channels[i] != NULL) */
if (span->channels[i] == NULL) {
if (isupCkt->span->channels[i] == NULL) {
/* we weren't able to find the channel in the ftdm channels */
SS7_ERROR("Unable to find the requested channel %d in the FreeTDM channels!\n", timeslot.channel);
return FTDM_FAIL;
} else {
ftdmchan = span->channels[i];
ftdmchan = isupCkt->span->channels[i];
}
/* try to find a match for the physical span and chan */
x = 1;
while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) {
if ((g_ftdm_sngss7_data.cfg.isupCkt[x].chan == ftdmchan->physical_chan_id)
&& (g_ftdm_sngss7_data.cfg.isupCkt[x].span == ftdmchan->physical_span_id)) {
if ((g_ftdm_sngss7_data.cfg.isupCkt[x].chan == ftdmchan->physical_chan_id) &&
(g_ftdm_sngss7_data.cfg.isupCkt[x].span == ftdmchan->physical_span_id)) {
/* we have a match so this circuit already exists in the structure */
break;
@ -1673,33 +2087,65 @@ static int ftmod_ss7_fill_in_circuits(char *ch_map, int cicbase, int typeCntrl,
ftdmchan->call_data = ss7_info;
/* prepare the timer structures */
ss7_info->t35.sched = ((sngss7_span_data_t *)span->mod_data)->sched;
ss7_info->t35.sched = ((sngss7_span_data_t *)isupCkt->span->mod_data)->sched;
ss7_info->t35.counter = 1;
ss7_info->t35.beat = g_ftdm_sngss7_data.cfg.isupIntf[isup_id].t35*100; /* beat is in ms, t35 is in 100ms */
ss7_info->t35.beat = g_ftdm_sngss7_data.cfg.isupIntf[isupCkt->isupInf].t35*100; /* beat is in ms, t35 is in 100ms */
ss7_info->t35.callback = handle_isup_t35;
ss7_info->t35.sngss7_info = ss7_info;
/* circuit is new so fill in the needed information */
g_ftdm_sngss7_data.cfg.isupCkt[x].id = x;
g_ftdm_sngss7_data.cfg.isupCkt[x].id = x;
g_ftdm_sngss7_data.cfg.isupCkt[x].span = ftdmchan->physical_span_id;
g_ftdm_sngss7_data.cfg.isupCkt[x].chan = ftdmchan->physical_chan_id;
g_ftdm_sngss7_data.cfg.isupCkt[x].type = VOICE;
g_ftdm_sngss7_data.cfg.isupCkt[x].cic = cicbase;
g_ftdm_sngss7_data.cfg.isupCkt[x].infId = isup_id;
g_ftdm_sngss7_data.cfg.isupCkt[x].typeCntrl = typeCntrl;
g_ftdm_sngss7_data.cfg.isupCkt[x].t3 = 1200;
g_ftdm_sngss7_data.cfg.isupCkt[x].t12 = 300;
g_ftdm_sngss7_data.cfg.isupCkt[x].t13 = 3000;
g_ftdm_sngss7_data.cfg.isupCkt[x].t14 = 300;
g_ftdm_sngss7_data.cfg.isupCkt[x].t15 = 3000;
g_ftdm_sngss7_data.cfg.isupCkt[x].t16 = 300;
g_ftdm_sngss7_data.cfg.isupCkt[x].t17 = 3000;
g_ftdm_sngss7_data.cfg.isupCkt[x].tval = 10;
g_ftdm_sngss7_data.cfg.isupCkt[x].cic = isupCkt->cicbase;
g_ftdm_sngss7_data.cfg.isupCkt[x].infId = isupCkt->isupInf;
g_ftdm_sngss7_data.cfg.isupCkt[x].typeCntrl = isupCkt->typeCntrl;
if (isupCkt->t3 == 0) {
g_ftdm_sngss7_data.cfg.isupCkt[x].t3 = 1200;
} else {
g_ftdm_sngss7_data.cfg.isupCkt[x].t3 = isupCkt->t3;
}
if (isupCkt->t12 == 0) {
g_ftdm_sngss7_data.cfg.isupCkt[x].t12 = 300;
} else {
g_ftdm_sngss7_data.cfg.isupCkt[x].t12 = isupCkt->t12;
}
if (isupCkt->t13 == 0) {
g_ftdm_sngss7_data.cfg.isupCkt[x].t13 = 3000;
} else {
g_ftdm_sngss7_data.cfg.isupCkt[x].t13 = isupCkt->t13;
}
if (isupCkt->t14 == 0) {
g_ftdm_sngss7_data.cfg.isupCkt[x].t14 = 300;
} else {
g_ftdm_sngss7_data.cfg.isupCkt[x].t14 = isupCkt->t14;
}
if (isupCkt->t15 == 0) {
g_ftdm_sngss7_data.cfg.isupCkt[x].t15 = 3000;
} else {
g_ftdm_sngss7_data.cfg.isupCkt[x].t15 = isupCkt->t15;
}
if (isupCkt->t16 == 0) {
g_ftdm_sngss7_data.cfg.isupCkt[x].t16 = 300;
} else {
g_ftdm_sngss7_data.cfg.isupCkt[x].t16 = isupCkt->t16;
}
if (isupCkt->t17 == 0) {
g_ftdm_sngss7_data.cfg.isupCkt[x].t17 = 3000;
} else {
g_ftdm_sngss7_data.cfg.isupCkt[x].t17 = isupCkt->t17;
}
if (isupCkt->tval == 0) {
g_ftdm_sngss7_data.cfg.isupCkt[x].tval = 10;
} else {
g_ftdm_sngss7_data.cfg.isupCkt[x].tval = isupCkt->tval;
}
g_ftdm_sngss7_data.cfg.isupCkt[x].obj = ss7_info;
g_ftdm_sngss7_data.cfg.isupCkt[x].ssf = g_ftdm_sngss7_data.cfg.isupIntf[isup_id].ssf;
g_ftdm_sngss7_data.cfg.isupCkt[x].ssf = g_ftdm_sngss7_data.cfg.isupIntf[isupCkt->isupInf].ssf;
/* increment the cicbase */
cicbase++;
isupCkt->cicbase++;
} else { /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].id == 0) */
SS7_DEBUG("Circuit for span=%d, chan=%d is new...id=%d\n",
ftdmchan->physical_span_id,
@ -1745,12 +2191,12 @@ static int ftmod_ss7_fill_in_circuits(char *ch_map, int cicbase, int typeCntrl,
/******************************************************************************/
static int ftmod_ss7_next_timeslot(char *ch_map, sng_timeslot_t *timeslot)
{
int i;
int x;
int lower;
int upper;
char tmp[5]; /*KONRAD FIX ME*/
char new_ch_map[MAX_CIC_LENGTH];
int i;
int x;
int lower;
int upper;
char tmp[5]; /*KONRAD FIX ME*/
char new_ch_map[MAX_CIC_LENGTH];
memset(&tmp[0], '\0', sizeof(tmp));
memset(&new_ch_map[0], '\0', sizeof(new_ch_map));