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);
/*! \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