freetdm: SS7 - Support for receiving RDNIS variables

This commit is contained in:
root 2011-04-26 14:52:53 -04:00
parent 6558b9bba9
commit f235d95537
4 changed files with 57 additions and 13 deletions

View File

@ -1591,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

@ -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) {

View File

@ -790,6 +790,7 @@ 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_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

@ -389,13 +389,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;