From 07b81760cb4cd3a676a8b95516349056c888a2f1 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Tue, 10 Aug 2010 18:51:06 -0400 Subject: [PATCH] freetdm: add bearer capability and layer1 pass-thru for boost --- libs/freetdm/mod_freetdm/mod_freetdm.c | 18 +++++++++++++++++- .../ftmod_sangoma_boost/ftmod_sangoma_boost.c | 7 +++++++ libs/freetdm/src/include/freetdm.h | 5 +++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 852914bf36..25010d9b25 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -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); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c index b5121b995b..b35596cbb2 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c @@ -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; diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 791cdd813c..af55370338 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -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 */