Merge branch 'master' of homer:smg_freeswitch

This commit is contained in:
Moises Silva 2010-10-05 13:29:15 -04:00
commit 7d3c3c8437
4 changed files with 57 additions and 10 deletions

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

@ -755,6 +755,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 +842,20 @@ 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, "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 +866,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 +1276,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;