From: Moises Silva Date: Mon, 28 Feb 2011 17:47:27 +0000 (-0500) Subject: Merge branch 'netborder' X-Git-Tag: v1.2-rc1~181^2~4^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4793c697bde6768dec8fab881d62330d1410fc99;p=thirdparty%2Ffreeswitch.git Merge branch 'netborder' Conflicts: libs/freetdm/mod_freetdm/mod_freetdm.c libs/freetdm/src/ftdm_io.c libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2_io_mf_lib.h libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c libs/freetdm/src/include/freetdm.h libs/freetdm/src/include/private/ftdm_core.h --- 4793c697bde6768dec8fab881d62330d1410fc99 diff --cc libs/freetdm/mod_freetdm/mod_freetdm.c index 4dc6cfcfd2,8e56a5b1e1..a52abc0cec --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@@ -1579,16 -1573,14 +1573,14 @@@ ftdm_status_t ftdm_channel_from_event(f 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); } - if (channel_caller_data->raw_data_len) { - switch_channel_set_variable_printf(channel, "freetdm_custom_call_data", "%s", channel_caller_data->raw_data); - } - ++ /* Add any call variable to the dial plan */ - iter = ftdm_call_get_var_iterator(channel_caller_data, iter); + iter = ftdm_sigmsg_get_var_iterator(sigmsg, iter); for (curr = iter ; curr; curr = ftdm_iterator_next(curr)) { - ftdm_call_get_current_var(curr, &var_name, &var_value); + ftdm_get_current_var(curr, &var_name, &var_value); snprintf(name, sizeof(name), FREETDM_VAR_PREFIX "%s", var_name); switch_channel_set_variable_printf(channel, name, "%s", var_value); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Call Variable: %s=%s\n", name, var_value); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Call Variable: %s = %s\n", name, var_value); } ftdm_iterator_free(iter); diff --cc libs/freetdm/src/ftdm_io.c index cd2c4850a4,765a3b3431..ce345b2e28 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@@ -2630,6 -2649,7 +2647,7 @@@ static ftdm_status_t ftdm_channel_done( ftdm_buffer_destroy(&ftdmchan->pre_buffer); ftdmchan->pre_buffer_size = 0; ftdm_mutex_unlock(ftdmchan->pre_buffer_mutex); - ++ if (ftdmchan->hangup_timer) { ftdm_sched_cancel_timer(globals.timingsched, ftdmchan->hangup_timer); } diff --cc libs/freetdm/src/include/private/ftdm_core.h index 0de52727da,464b1c0209..cd66afe9db --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@@ -624,27 -630,56 +629,55 @@@ FT_DECLARE(ftdm_status_t) ftdm_span_tri /*! \brief clear the tone detector state */ FT_DECLARE(void) ftdm_channel_clear_detected_tones(ftdm_channel_t *ftdmchan); - /* start/stop echo cancelling at the beginning/end of a call */ + /*! \brief adjust echocanceller for beginning of call */ FT_DECLARE(void) ftdm_set_echocancel_call_begin(ftdm_channel_t *chan); + + /*! \brief adjust echocanceller for end of call */ FT_DECLARE(void) ftdm_set_echocancel_call_end(ftdm_channel_t *chan); - /*! \brief Clear all variables attached to the call - * \note Variables are cleared at the end of each call back, so it is not necessary for the user to call this function. - * \todo Document which signaling variables are available - * */ - FT_DECLARE(ftdm_status_t) ftdm_call_clear_vars(ftdm_caller_data_t *caller_data); - + /*! \brief save data from user */ + FT_DECLARE(ftdm_status_t) ftdm_channel_save_usrmsg(ftdm_channel_t *ftdmchan, ftdm_usrmsg_t *usrmsg); - /*! \brief Remove a variable attached to the call - * \note Removes a variable that was attached to the call. - * \todo Document which call variables are available - * */ - FT_DECLARE(ftdm_status_t) ftdm_call_remove_var(ftdm_caller_data_t *caller_data, const char *var_name); + /*! \brief free usrmsg and variables/raw data attached to it */ + FT_DECLARE(ftdm_status_t) ftdm_usrmsg_free(ftdm_usrmsg_t **usrmsg); - /*! \brief Clears all the temporary data attached to this call - * \note Clears caller_data->variables and caller_data->raw_data. + /*! \brief Get a custom variable from the user message + * \note The variable pointer returned is only valid while the before the event is processed and it'll be destroyed once the event is processed. */ + FT_DECLARE(const char *) ftdm_usrmsg_get_var(ftdm_usrmsg_t *usrmsg, const char *var_name); + + /*! \brief Get raw data from user message + * \param usrmsg The message structure containing the variables + * \param data data will point to available data pointer if available + * \param datalen datalen will be set to length of data available + * \retval FTDM_SUCCESS data is available + * \retval FTDM_FAIL no data available + * \note data is only valid within the duration of the callback, to receive a data pointer that does not get + * \note destroyed when callback returns, see ftdm_sigmsg_get_raw_data_detached + */ + FT_DECLARE(ftdm_status_t) ftdm_usrmsg_get_raw_data(ftdm_usrmsg_t *usrmsg, void **data, ftdm_size_t *datalen); + + /*! \brief free sigmsg and variables/raw data attached to it */ + FT_DECLARE(ftdm_status_t) ftdm_sigmsg_free(ftdm_sigmsg_t **sigmsg); + + /*! \brief Add a custom variable to the event + * \note This variables may be used by signaling modules to override signaling parameters + * \todo Document which signaling variables are available * */ - FT_DECLARE(void) ftdm_call_clear_data(ftdm_caller_data_t *caller_data); - + FT_DECLARE(ftdm_status_t) ftdm_sigmsg_add_var(ftdm_sigmsg_t *sigmsg, const char *var_name, const char *value); + + /*! \brief Remove a custom variable from the event + * \note The variable pointer returned is only valid while the before the event is processed and it'll be destroyed once the event is processed. */ + FT_DECLARE(ftdm_status_t) ftdm_sigmsg_remove_var(ftdm_sigmsg_t *sigmsg, const char *var_name); + + /*! \brief Attach raw data to sigmsg + * \param sigmsg The message structure containing the variables + * \param data pointer to data + * \param datalen datalen length of data + * \retval FTDM_SUCCESS success, data was successfully saved + * \retval FTDM_FAIL failed, event already had data attached to it. + * \note data must have been allocated using ftdm_calloc, FreeTDM will free data once the usrmsg is processed. + */ + FT_DECLARE(ftdm_status_t) ftdm_sigmsg_set_raw_data(ftdm_sigmsg_t *sigmsg, void *data, ftdm_size_t datalen); /*! \brief Assert condition