forked from Mirrors/freeswitch
freetdm: export and import boost custom data
This commit is contained in:
parent
b9adfee0ea
commit
edb2d58285
@ -1155,6 +1155,11 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||
} else {
|
||||
caller_data.dnis.type = outbound_profile->destination_number_ton;
|
||||
}
|
||||
|
||||
if ((var = switch_event_get_header(var_event, "freetdm_custom_call_data")) || (var = switch_core_get_variable("freetdm_custom_call_data"))) {
|
||||
ftdm_set_string(caller_data.raw_data, var);
|
||||
caller_data.raw_data_len = strlen(var);
|
||||
}
|
||||
|
||||
caller_data.dnis.plan = outbound_profile->destination_number_numplan;
|
||||
|
||||
@ -1273,7 +1278,7 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session
|
||||
switch_channel_t *channel = NULL;
|
||||
uint32_t spanid, chanid;
|
||||
char name[128];
|
||||
ftdm_caller_data_t *channel_caller_data = sigmsg->raw_data;
|
||||
ftdm_caller_data_t *channel_caller_data = ftdm_channel_get_caller_data(sigmsg->channel);
|
||||
|
||||
*sp = NULL;
|
||||
|
||||
@ -1350,6 +1355,9 @@ 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);
|
||||
if (channel_caller_data->raw_data_len) {
|
||||
switch_channel_set_variable_printf(channel, "freetdm_custom_call_data", "%s", channel_caller_data->raw_data);
|
||||
}
|
||||
|
||||
switch_channel_set_state(channel, CS_INIT);
|
||||
if (switch_core_session_thread_launch(session) != SWITCH_STATUS_SUCCESS) {
|
||||
@ -1440,7 +1448,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_fxo_signal)
|
||||
|
||||
spanid = ftdm_channel_get_span_id(sigmsg->channel);
|
||||
chanid = ftdm_channel_get_id(sigmsg->channel);
|
||||
callerdata = sigmsg->raw_data;
|
||||
callerdata = ftdm_channel_get_caller_data(sigmsg->channel);
|
||||
|
||||
ftdm_log(FTDM_LOG_DEBUG, "got FXO sig %d:%d [%s]\n", spanid, chanid, ftdm_signal_event2str(sigmsg->event_id));
|
||||
|
||||
@ -1727,7 +1735,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_r2_signal)
|
||||
switch_core_session_t *session = NULL;
|
||||
switch_channel_t *channel = NULL;
|
||||
ftdm_status_t status = FTDM_SUCCESS;
|
||||
ftdm_caller_data_t *caller_data = sigmsg->raw_data;
|
||||
ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(sigmsg->channel);
|
||||
|
||||
phyid = ftdm_channel_get_ph_id(sigmsg->channel);
|
||||
chanid = ftdm_channel_get_id(sigmsg->channel);
|
||||
@ -1845,7 +1853,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_clear_channel_signal)
|
||||
|
||||
ftdm_log(FTDM_LOG_DEBUG, "got clear channel sig [%s]\n", ftdm_signal_event2str(sigmsg->event_id));
|
||||
|
||||
caller_data = sigmsg->raw_data;
|
||||
caller_data = ftdm_channel_get_caller_data(sigmsg->channel);
|
||||
chanid = ftdm_channel_get_id(sigmsg->channel);
|
||||
spanid = ftdm_channel_get_span_id(sigmsg->channel);
|
||||
|
||||
|
@ -4131,7 +4131,6 @@ FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t
|
||||
break;
|
||||
|
||||
case FTDM_SIGEVENT_START:
|
||||
sigmsg->raw_data = &sigmsg->channel->caller_data;
|
||||
/* when cleaning up the public API I added this because mod_freetdm.c on_fxs_signal was
|
||||
* doing it during SIGEVENT_START, but now that flags are private they can't, wonder if
|
||||
* is needed at all?
|
||||
@ -4139,10 +4138,6 @@ FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t
|
||||
ftdm_clear_flag(sigmsg->channel, FTDM_CHANNEL_HOLD);
|
||||
break;
|
||||
|
||||
case FTDM_SIGEVENT_STOP:
|
||||
sigmsg->raw_data = &sigmsg->channel->caller_data;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
|
@ -427,6 +427,11 @@ static FIO_CHANNEL_REQUEST_FUNCTION(sangoma_boost_channel_request)
|
||||
event.called.ton = caller_data->dnis.type;
|
||||
event.called.npi = caller_data->dnis.plan;
|
||||
|
||||
if (caller_data->raw_data_len) {
|
||||
ftdm_set_string(event.custom_data, caller_data->raw_data);
|
||||
event.custom_data_size = caller_data->raw_data_len;
|
||||
}
|
||||
|
||||
OUTBOUND_REQUESTS[r].status = BST_WAITING;
|
||||
OUTBOUND_REQUESTS[r].span = span;
|
||||
|
||||
@ -1036,6 +1041,7 @@ static void handle_call_start(ftdm_span_t *span, sangomabc_connection_t *mcon, s
|
||||
ftdmchan->caller_data.screen = event->calling.screening_ind;
|
||||
ftdmchan->caller_data.pres = event->calling.presentation_ind;
|
||||
|
||||
/* more info about custom data: http://www.ss7box.com/smg_manual.html#ISUP-IN-RDNIS-NEW */
|
||||
if (event->custom_data_size) {
|
||||
char* p = NULL;
|
||||
|
||||
@ -1522,6 +1528,11 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan)
|
||||
event.called.ton = ftdmchan->caller_data.dnis.type;
|
||||
event.called.npi = ftdmchan->caller_data.dnis.plan;
|
||||
|
||||
if (ftdmchan->caller_data.raw_data_len) {
|
||||
ftdm_set_string(event.custom_data, ftdmchan->caller_data.raw_data);
|
||||
event.custom_data_size = ftdmchan->caller_data.raw_data_len;
|
||||
}
|
||||
|
||||
OUTBOUND_REQUESTS[r].status = BST_WAITING;
|
||||
OUTBOUND_REQUESTS[r].span = ftdmchan->span;
|
||||
OUTBOUND_REQUESTS[r].ftdmchan = ftdmchan;
|
||||
|
@ -267,7 +267,9 @@ typedef struct ftdm_caller_data {
|
||||
uint8_t screen; /*!< Screening */
|
||||
uint8_t pres; /*!< Presentation*/
|
||||
char collected[25]; /*!< Collected digits so far */
|
||||
int hangup_cause; /*! Hangup cause */
|
||||
int hangup_cause; /*!< Hangup cause */
|
||||
char raw_data[1024]; /*!< Protocol specific raw caller data */
|
||||
uint32_t raw_data_len; /* !< Raw data length */
|
||||
} ftdm_caller_data_t;
|
||||
|
||||
/*! \brief Tone type */
|
||||
|
Loading…
Reference in New Issue
Block a user