Merge branch 'master' into smgmaster

This commit is contained in:
Moises Silva 2011-05-05 07:43:43 -04:00
commit f99218704f
8 changed files with 127 additions and 50 deletions

View File

@ -1301,30 +1301,35 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
ftdm_set_string(caller_data.rdnis.digits, sipvar);
}
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-TON");
if (sipvar) {
caller_data.rdnis.type = (uint8_t)atoi(sipvar);
}
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-Plan");
if (sipvar) {
caller_data.rdnis.plan = (uint8_t)atoi(sipvar);
ftdm_usrmsg_add_var(&usrmsg, "ss7_rdnis_plan", sipvar);
}
/* Used by ftmod_sangoma_ss7 only */
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-NADI");
if (sipvar) {
ftdm_usrmsg_add_var(&usrmsg, "ss7_rdnis_nadi", sipvar);
}
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-Screen");
if (sipvar) {
ftdm_usrmsg_add_var(&usrmsg, "ss7_rdnis_screen_ind", sipvar);
}
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-Presentation");
if (sipvar) {
ftdm_usrmsg_add_var(&usrmsg, "ss7_rdnis_pres_ind", sipvar);
}
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-Screen");
if (sipvar) {
caller_data.screen = (uint8_t)atoi(sipvar);
ftdm_usrmsg_add_var(&usrmsg, "ss7_screen_ind", sipvar);
}
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-Presentation");
if (sipvar) {
caller_data.pres = (uint8_t)atoi(sipvar);
ftdm_usrmsg_add_var(&usrmsg, "ss7_pres_ind", sipvar);
}
@ -1343,19 +1348,19 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
}
if ((var = channel_get_variable(session, var_event, "freetdm_bearer_layer1"))) {
caller_data.bearer_layer1 = (uint8_t)atoi(var);
caller_data.bearer_layer1 = (uint8_t)atoi(var);
}
if ((var = channel_get_variable(session, var_event, "freetdm_screening_ind"))) {
ftdm_set_screening_ind(var, &caller_data.screen);
ftdm_set_screening_ind(var, &caller_data.screen);
}
if ((var = channel_get_variable(session, var_event, "freetdm_presentation_ind"))) {
ftdm_set_presentation_ind(var, &caller_data.pres);
ftdm_set_presentation_ind(var, &caller_data.pres);
}
if ((var = channel_get_variable(session, var_event, "freetdm_outbound_ton"))) {
ftdm_set_ton(var, &caller_data.dnis.type);
ftdm_set_ton(var, &caller_data.dnis.type);
} else {
caller_data.dnis.type = outbound_profile->destination_number_ton;
}
@ -1586,8 +1591,18 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-DNIS-Plan", "%d", channel_caller_data->dnis.plan);
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS", "%s", channel_caller_data->rdnis.digits);
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-TON", "%d", channel_caller_data->rdnis.type);
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-NADI", "%d", channel_caller_data->rdnis.type);
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-Plan", "%d", channel_caller_data->rdnis.plan);
var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_rdnis_screen_ind");
if (!ftdm_strlen_zero(var_value)) {
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-Screen", "%d", var_value);
}
var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_rdnis_pres_ind");
if (!ftdm_strlen_zero(var_value)) {
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-Presentation", "%d", channel_caller_data->rdnis.plan);
}
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-Screen", "%d", channel_caller_data->screen);
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-Presentation", "%d", channel_caller_data->pres);

View File

@ -996,11 +996,15 @@ static ftdm_status_t ftdm_sangoma_isdn_start(ftdm_span_t *span)
ftdm_clear_flag(span, FTDM_SPAN_STOP_THREAD);
ftdm_clear_flag(span, FTDM_SPAN_IN_THREAD);
if (signal_data->raw_trace_q921 == SNGISDN_OPT_TRUE) {
if (signal_data->trace_q921 == SNGISDN_OPT_TRUE ||
signal_data->raw_trace_q921 == SNGISDN_OPT_TRUE) {
sngisdn_activate_trace(span, SNGISDN_TRACE_Q921);
}
if (signal_data->raw_trace_q931 == SNGISDN_OPT_TRUE) {
if (signal_data->trace_q931 == SNGISDN_OPT_TRUE ||
signal_data->raw_trace_q931 == SNGISDN_OPT_TRUE) {
sngisdn_activate_trace(span, SNGISDN_TRACE_Q931);
}

View File

@ -213,6 +213,8 @@ typedef struct sngisdn_span_data {
int8_t facility_timeout;
uint8_t num_local_numbers;
uint8_t ignore_cause_value;
uint8_t trace_q931; /* TODO: combine with trace_flags */
uint8_t trace_q921; /* TODO: combine with trace_flags */
uint8_t raw_trace_q931; /* TODO: combine with trace_flags */
uint8_t raw_trace_q921; /* TODO: combine with trace_flags */
uint8_t timer_t3;

View File

@ -369,6 +369,10 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_
parse_yesno(var, val, &signal_data->facility_ie_decode);
} else if (!strcasecmp(var, "ignore-cause-value")) {
parse_yesno(var, val, &signal_data->ignore_cause_value);
} else if (!strcasecmp(var, "q931-trace")) {
parse_yesno(var, val, &signal_data->trace_q931);
} else if (!strcasecmp(var, "q921-trace")) {
parse_yesno(var, val, &signal_data->trace_q921);
} else if (!strcasecmp(var, "q931-raw-trace")) {
parse_yesno(var, val, &signal_data->raw_trace_q931);
} else if (!strcasecmp(var, "q921-raw-trace")) {

View File

@ -185,17 +185,7 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ
SS7_INFO_CHAN(ftdmchan,"No Called party (DNIS) information in IAM!%s\n", " ");
}
/* fill in rdnis information*/
if (siConEvnt->redirgNum.eh.pres) {
if (siConEvnt->redirgNum.addrSig.pres) {
/* fill in the rdnis digits */
copy_tknStr_from_sngss7(siConEvnt->redirgNum.addrSig,
ftdmchan->caller_data.rdnis.digits,
siConEvnt->cgPtyNum.oddEven);
}
} else {
SS7_DEBUG_CHAN(ftdmchan,"No RDNIS party information in IAM!%s\n", " ");
}
copy_redirgNum_from_sngss7(ftdmchan, &siConEvnt->redirgNum);
/* fill in the TMR/bearer capability */
if (siConEvnt->txMedReq.eh.pres) {
@ -609,6 +599,7 @@ ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);
break;
/**************************************************************************/
case FTDM_CHANNEL_STATE_RING:
case FTDM_CHANNEL_STATE_RINGING:
case FTDM_CHANNEL_STATE_PROGRESS:
case FTDM_CHANNEL_STATE_PROGRESS_MEDIA:
case FTDM_CHANNEL_STATE_UP:

View File

@ -785,11 +785,12 @@ int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *spa
ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const char *data);
/* in ftmod_sangoma_ss7_support.c */
uint8_t copy_cgPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum);
uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum);
uint8_t copy_cdPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum);
uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum);
ftdm_status_t copy_cgPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cgPtyNum);
ftdm_status_t copy_cgPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cgPtyNum);
ftdm_status_t copy_cdPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cdPtyNum);
ftdm_status_t copy_cdPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cdPtyNum);
ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum);
ftdm_status_t copy_redirgNum_from_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum);
ftdm_status_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven);

View File

@ -180,10 +180,10 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
} /* if ANSI */
/* copy down the called number information */
copy_cdPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cdPtyNum);
copy_cdPtyNum_to_sngss7 (ftdmchan, &iam.cdPtyNum);
/* copy down the calling number information */
copy_cgPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cgPtyNum);
copy_cgPtyNum_to_sngss7 (ftdmchan, &iam.cgPtyNum);
/* check if the user would like a custom NADI value for the calling Pty Num */
clg_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_clg_nadi");

View File

@ -91,15 +91,16 @@ FTDM_ENUM_NAMES(BLK_FLAGS_NAMES, BLK_FLAGS_STRING)
FTDM_STR2ENUM(ftmod_ss7_blk_state2flag, ftmod_ss7_blk_flag2str, sng_ckt_block_flag_t, BLK_FLAGS_NAMES, 31)
/* FUNCTIONS ******************************************************************/
uint8_t copy_cgPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum)
ftdm_status_t copy_cgPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cgPtyNum)
{
return 0;
return FTDM_SUCCESS;
}
/******************************************************************************/
uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum)
ftdm_status_t copy_cgPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cgPtyNum)
{
const char *val;
int k;
int j;
int flag;
@ -108,24 +109,38 @@ uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum)
uint8_t lower;
uint8_t upper;
/**************************************************************************/
ftdm_caller_data_t *ftdm = &ftdmchan->caller_data;
cgPtyNum->eh.pres = PRSNT_NODEF;
/**************************************************************************/
cgPtyNum->natAddrInd.pres = PRSNT_NODEF;
cgPtyNum->natAddrInd.val = 0x03;
/**************************************************************************/
cgPtyNum->scrnInd.pres = PRSNT_NODEF;
cgPtyNum->scrnInd.val = ftdm->screen;
/**************************************************************************/
val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_screen_ind");
if (!ftdm_strlen_zero(val)) {
cgPtyNum->scrnInd.val = atoi(val);
} else {
cgPtyNum->scrnInd.val = ftdm->screen;
}
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Calling Party Number Screening Ind %d\n", cgPtyNum->scrnInd.val);
cgPtyNum->presRest.pres = PRSNT_NODEF;
cgPtyNum->presRest.val = ftdm->pres;
/**************************************************************************/
val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_pres_ind");
if (!ftdm_strlen_zero(val)) {
cgPtyNum->presRest.val = atoi(val);
} else {
cgPtyNum->presRest.val = ftdm->pres;
}
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Calling Party Number Presentation Ind %d\n", cgPtyNum->presRest.val);
cgPtyNum->numPlan.pres = PRSNT_NODEF;
cgPtyNum->numPlan.val = 0x01;
/**************************************************************************/
cgPtyNum->niInd.pres = PRSNT_NODEF;
cgPtyNum->niInd.val = 0x00;
/**************************************************************************/
cgPtyNum->addrSig.pres = PRSNT_NODEF;
/* atoi will search through memory starting from the pointer it is given until
@ -207,18 +222,18 @@ uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum)
cgPtyNum->oddEven.pres = PRSNT_NODEF;
cgPtyNum->oddEven.val = odd;
/**************************************************************************/
return 0;
return FTDM_SUCCESS;
}
/******************************************************************************/
uint8_t copy_cdPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum)
ftdm_status_t copy_cdPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cdPtyNum)
{
return 0;
return FTDM_SUCCESS;
}
/******************************************************************************/
uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum)
ftdm_status_t copy_cdPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cdPtyNum)
{
int k;
int j;
@ -228,6 +243,8 @@ uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum)
uint8_t lower;
uint8_t upper;
ftdm_caller_data_t *ftdm = &ftdmchan->caller_data;
/**************************************************************************/
cdPtyNum->eh.pres = PRSNT_NODEF;
/**************************************************************************/
@ -389,13 +406,56 @@ ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *red
return copy_tknStr_to_sngss7(caller_data->rdnis.digits, &redirgNum->addrSig, &redirgNum->oddEven);
}
ftdm_status_t copy_redirgNum_from_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum)
{
char val[20];
sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;
ftdm_caller_data_t *caller_data = &ftdmchan->caller_data;
if (redirgNum->eh.pres != PRSNT_NODEF || redirgNum->addrSig.pres != PRSNT_NODEF) {
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No Redirecting Number available\n");
return FTDM_SUCCESS;
}
copy_tknStr_from_sngss7(redirgNum->addrSig, ftdmchan->caller_data.rdnis.digits, redirgNum->oddEven);
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number:%s\n", ftdmchan->caller_data.rdnis.digits);
if (redirgNum->natAddr.pres == PRSNT_NODEF) {
snprintf(val, sizeof(val), "%d", redirgNum->natAddr.val);
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number NADI:%s\n", val);
sngss7_add_var(sngss7_info, "ss7_rdnis_nadi", val);
caller_data->rdnis.type = redirgNum->natAddr.val;
}
if (redirgNum->scrInd.pres == PRSNT_NODEF) {
snprintf(val, sizeof(val), "%d", redirgNum->scrInd.val);
SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Screening Ind:%s\n", val);
sngss7_add_var(sngss7_info, "ss7_rdnis_screen_ind", val);
}
if (redirgNum->presRest.pres == PRSNT_NODEF) {
snprintf(val, sizeof(val), "%d", redirgNum->presRest.val);
SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Presentation Ind:%s\n", val);
sngss7_add_var(sngss7_info, "ss7_rdnis_pres_ind", val);
}
if (redirgNum->numPlan.pres == PRSNT_NODEF) {
snprintf(val, sizeof(val), "%d", redirgNum->numPlan.val);
SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Numbering plan:%s\n", val);
sngss7_add_var(sngss7_info, "ss7_rdnis_plan", val);
caller_data->rdnis.plan = redirgNum->numPlan.val;
}
return FTDM_SUCCESS;
}
ftdm_status_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven)
{
uint8_t i;
uint8_t j;
/* check if the token string is present */
if (str.pres == 1) {
j = 0;