freetdm: add bearer capability and layer1 pass-thru for boost

This commit is contained in:
Moises Silva 2010-08-10 18:51:06 -04:00
parent 018f4d61bf
commit 07b81760cb
3 changed files with 29 additions and 1 deletions

View File

@ -1221,7 +1221,21 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
caller_data.pres = (uint8_t)atoi(sipvar);
}
}
if (session) {
/* take out some other values from the session if they're present */
switch_channel_t *channel = switch_core_session_get_channel(session);
const char *freetdmvar;
freetdmvar = switch_channel_get_variable(channel, "freetdm_bearer_capability");
if (freetdmvar) {
caller_data.bearer_capability = (uint8_t)atoi(freetdmvar);
}
freetdmvar = switch_channel_get_variable(channel, "freetdm_bearer_layer1");
if (freetdmvar) {
caller_data.bearer_layer1 = (uint8_t)atoi(freetdmvar);
}
}
if (switch_test_flag(outbound_profile, SWITCH_CPF_SCREEN)) {
caller_data.screen = 1;
}
@ -1467,6 +1481,8 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session
switch_channel_set_variable(channel, "freetdm_span_name", ftdm_channel_get_span_name(sigmsg->channel));
switch_channel_set_variable_printf(channel, "freetdm_span_number", "%d", spanid);
switch_channel_set_variable_printf(channel, "freetdm_chan_number", "%d", chanid);
switch_channel_set_variable_printf(channel, "freetdm_bearer_capability", "%d", channel_caller_data->bearer_capability);
switch_channel_set_variable_printf(channel, "freetdm_bearer_layer1", "%d", channel_caller_data->bearer_layer1);
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-SpanNumber", "%d", spanid);

View File

@ -427,6 +427,10 @@ static FIO_CHANNEL_REQUEST_FUNCTION(sangoma_boost_channel_request)
event.called.ton = caller_data->dnis.type;
event.called.npi = caller_data->dnis.plan;
/* we're making a contract now that FreeTDM values for capability, layer 1 and such will be the same as for boost */
event.bearer.capability = caller_data->bearer_capability;
event.bearer.uil1p = caller_data->bearer_layer1;
if (caller_data->raw_data_len) {
ftdm_set_string(event.custom_data, caller_data->raw_data);
event.custom_data_size = (uint16_t)caller_data->raw_data_len;
@ -1055,6 +1059,9 @@ tryagain:
ftdmchan->caller_data.screen = event->calling.screening_ind;
ftdmchan->caller_data.pres = event->calling.presentation_ind;
ftdmchan->caller_data.bearer_capability = event->bearer.capability;
ftdmchan->caller_data.bearer_layer1 = event->bearer.uil1p;
/* more info about custom data: http://www.ss7box.com/smg_manual.html#ISUP-IN-RDNIS-NEW */
if (event->custom_data_size) {
char* p = NULL;

View File

@ -254,6 +254,11 @@ typedef struct ftdm_caller_data {
int hangup_cause; /*!< Hangup cause */
char raw_data[1024]; /*!< Protocol specific raw caller data */
uint32_t raw_data_len; /* !< Raw data length */
/* these 2 are undocumented right now, only used by boost: */
/* bearer capability */
uint8_t bearer_capability;
/* user information layer 1 protocol */
uint8_t bearer_layer1;
} ftdm_caller_data_t;
/*! \brief Tone type */