forked from Mirrors/freeswitch
Merge remote branch 'origin/jz.SPIROU' into releases.3.4.bridge_hack
This commit is contained in:
commit
9fc8395b31
@ -115,6 +115,8 @@ struct private_object {
|
||||
ftdm_channel_t *ftdmchan;
|
||||
uint32_t write_error;
|
||||
uint32_t read_error;
|
||||
char network_peer_uuid[SWITCH_UUID_FORMATTED_LENGTH + 1];
|
||||
|
||||
};
|
||||
|
||||
/* private data attached to FTDM channels (only FXS for now) */
|
||||
@ -504,6 +506,9 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session)
|
||||
int chan_id = 0;
|
||||
const char *name = NULL;
|
||||
|
||||
ftdm_usrmsg_t usrmsg;
|
||||
memset(&usrmsg, 0, sizeof(ftdm_usrmsg_t));
|
||||
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
assert(channel != NULL);
|
||||
@ -572,11 +577,19 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session)
|
||||
case FTDM_CHAN_TYPE_CAS:
|
||||
case FTDM_CHAN_TYPE_B:
|
||||
{
|
||||
const char *sipvar;
|
||||
ftdm_call_cause_t hcause = switch_channel_get_cause_q850(channel);
|
||||
if (hcause < 1 || hcause > 127) {
|
||||
hcause = FTDM_CAUSE_DESTINATION_OUT_OF_ORDER;
|
||||
}
|
||||
sipvar = switch_channel_get_variable(channel, "ss7_rel_loc");
|
||||
if (sipvar) {
|
||||
ftdm_usrmsg_add_var(&usrmsg, "ss7_rel_loc", sipvar);
|
||||
}
|
||||
/*
|
||||
ftdm_channel_call_hangup_with_cause(tech_pvt->ftdmchan, hcause);
|
||||
*/
|
||||
ftdm_channel_call_hangup_with_cause_ex(tech_pvt->ftdmchan, hcause, &usrmsg);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -1246,6 +1259,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||
int argc = 0;
|
||||
const char *var;
|
||||
const char *dest_num = NULL, *callerid_num = NULL;
|
||||
const char *network_peer_uuid = NULL;
|
||||
ftdm_hunting_scheme_t hunting;
|
||||
ftdm_usrmsg_t usrmsg;
|
||||
|
||||
@ -1336,6 +1350,9 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||
if (session && globals.sip_headers) {
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
const char *sipvar;
|
||||
|
||||
network_peer_uuid = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-TransUUID");
|
||||
|
||||
sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-CallerName");
|
||||
if (sipvar) {
|
||||
ftdm_set_string(caller_data.cid_name, sipvar);
|
||||
@ -1506,6 +1523,10 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||
caller_data.pres = FTDM_PRES_RESTRICTED;
|
||||
}
|
||||
|
||||
if ((var = channel_get_variable(session, var_event, "freetdm_iam_fwd_ind_isdn_access_ind"))) {
|
||||
ftdm_usrmsg_add_var(&usrmsg, "iam_fwd_ind_isdn_access_ind", var);
|
||||
}
|
||||
|
||||
if ((var = channel_get_variable(session, var_event, "freetdm_bearer_capability"))) {
|
||||
caller_data.bearer_capability = (uint8_t)atoi(var);
|
||||
}
|
||||
@ -1592,6 +1613,20 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (network_peer_uuid) {
|
||||
switch_core_session_t *network_peer = switch_core_session_locate(network_peer_uuid);
|
||||
if (network_peer) {
|
||||
const char *my_uuid = switch_core_session_get_uuid(*new_session);
|
||||
private_t *peer_private = switch_core_session_get_private(network_peer);
|
||||
switch_set_string(tech_pvt->network_peer_uuid, network_peer_uuid);
|
||||
switch_set_string(peer_private->network_peer_uuid, my_uuid);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Session %s is network-bridged with %s\n", my_uuid, network_peer_uuid);
|
||||
|
||||
switch_core_session_rwunlock(network_peer);
|
||||
}
|
||||
}
|
||||
|
||||
caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
|
||||
caller_profile->destination_number = switch_core_strdup(caller_profile->pool, switch_str_nil(dest_num));
|
||||
caller_profile->caller_id_number = switch_core_strdup(caller_profile->pool, switch_str_nil(callerid_num));
|
||||
@ -1634,7 +1669,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||
} else {
|
||||
cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
|
||||
}
|
||||
goto fail;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
return SWITCH_CAUSE_SUCCESS;
|
||||
@ -1763,6 +1798,7 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session
|
||||
|
||||
if (globals.sip_headers) {
|
||||
switch_channel_set_variable(channel, "sip_h_X-FreeTDM-SpanName", ftdm_channel_get_span_name(sigmsg->channel));
|
||||
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-TransUUID", "%s",switch_core_session_get_uuid(session));
|
||||
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-SpanNumber", "%d", spanid);
|
||||
switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-ChanNumber", "%d", chanid);
|
||||
|
||||
|
@ -108,6 +108,21 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan)
|
||||
} else if (sngss7_info->circuit->transparent_iam &&
|
||||
sngss7_retrieve_iam(ftdmchan, &iam) == FTDM_SUCCESS) {
|
||||
SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx IAM (Transparent)\n", sngss7_info->circuit->cic);
|
||||
|
||||
/* Called Number information */
|
||||
copy_cdPtyNum_to_sngss7(ftdmchan, &iam.cdPtyNum);
|
||||
|
||||
/* Redirecting Number */
|
||||
copy_redirgNum_to_sngss7(ftdmchan, &iam.redirgNum);
|
||||
|
||||
/* Redirecting Information */
|
||||
copy_redirgInfo_to_sngss7(ftdmchan, &iam.redirInfo);
|
||||
|
||||
/* Location Number information */
|
||||
copy_locPtyNum_to_sngss7(ftdmchan, &iam.cgPtyNum1);
|
||||
|
||||
/* Forward Call Indicators */
|
||||
copy_fwdCallInd_to_sngss7(ftdmchan, &iam.fwdCallInd);
|
||||
} else {
|
||||
/* Nature of Connection Indicators */
|
||||
copy_natConInd_to_sngss7(ftdmchan, &iam.natConInd);
|
||||
@ -300,6 +315,7 @@ void ft_to_sngss7_anm (ftdm_channel_t * ftdmchan)
|
||||
/******************************************************************************/
|
||||
void ft_to_sngss7_rel (ftdm_channel_t * ftdmchan)
|
||||
{
|
||||
const char *loc_ind = NULL;
|
||||
SS7_FUNC_TRACE_ENTER (__FUNCTION__);
|
||||
|
||||
sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;
|
||||
@ -309,7 +325,15 @@ void ft_to_sngss7_rel (ftdm_channel_t * ftdmchan)
|
||||
|
||||
rel.causeDgn.eh.pres = PRSNT_NODEF;
|
||||
rel.causeDgn.location.pres = PRSNT_NODEF;
|
||||
rel.causeDgn.location.val = 0x01;
|
||||
|
||||
loc_ind = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rel_loc");
|
||||
if (!ftdm_strlen_zero(loc_ind)) {
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied location indicator in REL, value \"%s\"\n", loc_ind);
|
||||
rel.causeDgn.location.val = atoi(loc_ind);
|
||||
} else {
|
||||
rel.causeDgn.location.val = 0x01;
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied location indicator in REL, using 0x01\"%s\"\n", "");
|
||||
}
|
||||
rel.causeDgn.cdeStand.pres = PRSNT_NODEF;
|
||||
rel.causeDgn.cdeStand.val = 0x00;
|
||||
rel.causeDgn.recommend.pres = NOTPRSNT;
|
||||
|
@ -243,15 +243,20 @@ ftdm_status_t copy_locPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *loc
|
||||
{
|
||||
const char *val = NULL;
|
||||
const char *loc_nadi = NULL;
|
||||
int pres_val = PRSNT_NODEF;
|
||||
|
||||
sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;
|
||||
ftdm_caller_data_t *caller_data = &ftdmchan->caller_data;
|
||||
|
||||
locPtyNum->eh.pres = PRSNT_NODEF;
|
||||
locPtyNum->natAddrInd.pres = PRSNT_NODEF;
|
||||
if (!strcasecmp(caller_data->loc.digits, "NULL")) {
|
||||
pres_val = NOTPRSNT;
|
||||
}
|
||||
|
||||
locPtyNum->eh.pres = pres_val;
|
||||
locPtyNum->natAddrInd.pres = pres_val;
|
||||
locPtyNum->natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].loc_nadi;
|
||||
|
||||
locPtyNum->scrnInd.pres = PRSNT_NODEF;
|
||||
locPtyNum->scrnInd.pres = pres_val;
|
||||
val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_loc_screen_ind");
|
||||
if (!ftdm_strlen_zero(val)) {
|
||||
locPtyNum->scrnInd.val = atoi(val);
|
||||
@ -260,7 +265,7 @@ ftdm_status_t copy_locPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *loc
|
||||
}
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Location Reference Code Screening Ind %d\n", locPtyNum->scrnInd.val);
|
||||
|
||||
locPtyNum->presRest.pres = PRSNT_NODEF;
|
||||
locPtyNum->presRest.pres = pres_val;
|
||||
val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_pres_ind");
|
||||
if (!ftdm_strlen_zero(val)) {
|
||||
locPtyNum->presRest.val = atoi(val);
|
||||
@ -269,10 +274,10 @@ ftdm_status_t copy_locPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *loc
|
||||
}
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Calling Party Number Presentation Ind %d\n", locPtyNum->presRest.val);
|
||||
|
||||
locPtyNum->numPlan.pres = PRSNT_NODEF;
|
||||
locPtyNum->numPlan.pres = pres_val;
|
||||
locPtyNum->numPlan.val = 0x01;
|
||||
|
||||
locPtyNum->niInd.pres = PRSNT_NODEF;
|
||||
locPtyNum->niInd.pres = pres_val;
|
||||
locPtyNum->niInd.val = 0x00;
|
||||
|
||||
/* check if the user would like a custom NADI value for the Location Reference */
|
||||
@ -439,6 +444,13 @@ ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *red
|
||||
return FTDM_FAIL;
|
||||
}
|
||||
} else {
|
||||
|
||||
val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rdnis_pres_ind");
|
||||
if (!ftdm_strlen_zero(val)) {
|
||||
redirgNum->presRest.val = atoi(val);
|
||||
}
|
||||
ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number Address Presentation Restricted Ind:%d\n", redirgNum->presRest.val);
|
||||
|
||||
ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Redirection Number\n");
|
||||
return FTDM_SUCCESS;
|
||||
}
|
||||
@ -753,6 +765,8 @@ ftdm_status_t copy_natConInd_to_sngss7(ftdm_channel_t *ftdmchan, SiNatConInd *na
|
||||
|
||||
ftdm_status_t copy_fwdCallInd_to_sngss7(ftdm_channel_t *ftdmchan, SiFwdCallInd *fwdCallInd)
|
||||
{
|
||||
const char *val = NULL;
|
||||
int acc_val = ISDNACC_ISDN;
|
||||
sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;
|
||||
|
||||
fwdCallInd->eh.pres = PRSNT_NODEF;
|
||||
@ -769,7 +783,13 @@ ftdm_status_t copy_fwdCallInd_to_sngss7(ftdm_channel_t *ftdmchan, SiFwdCallInd *
|
||||
fwdCallInd->isdnUsrPrtPrfInd.pres = PRSNT_NODEF;
|
||||
fwdCallInd->isdnUsrPrtPrfInd.val = PREF_PREFAW;
|
||||
fwdCallInd->isdnAccInd.pres = PRSNT_NODEF;
|
||||
fwdCallInd->isdnAccInd.val = ISDNACC_ISDN;
|
||||
|
||||
val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "iam_fwd_ind_isdn_access_ind");
|
||||
if (!ftdm_strlen_zero(val)) {
|
||||
acc_val = (int)atoi(val);
|
||||
}
|
||||
|
||||
fwdCallInd->isdnAccInd.val = acc_val;
|
||||
fwdCallInd->sccpMethInd.pres = PRSNT_NODEF;
|
||||
fwdCallInd->sccpMethInd.val = SCCPMTH_NOIND;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user