mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 17:38:59 +00:00
Merge branch 'nsg-4.3' of ssh://git.sangoma.com/smg_freeswitch into nsg-4.3
This commit is contained in:
@@ -178,6 +178,7 @@ static const char* channel_get_variable(switch_core_session_t *session, switch_e
|
||||
ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session_t **sp);
|
||||
void dump_chan(ftdm_span_t *span, uint32_t chan_id, switch_stream_handle_t *stream);
|
||||
void dump_chan_xml(ftdm_span_t *span, uint32_t chan_id, switch_stream_handle_t *stream);
|
||||
void ctdm_init(switch_loadable_module_interface_t *module_interface);
|
||||
|
||||
static switch_core_session_t *ftdm_channel_get_session(ftdm_channel_t *channel, int32_t id)
|
||||
{
|
||||
@@ -5359,6 +5360,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_freetdm_load)
|
||||
SWITCH_ADD_APP(app_interface, "disable_dtmf", "Disable DTMF Detection", "Disable DTMF Detection", disable_dtmf_function, "", SAF_NONE);
|
||||
SWITCH_ADD_APP(app_interface, "enable_dtmf", "Enable DTMF Detection", "Enable DTMF Detection", enable_dtmf_function, "", SAF_NONE);
|
||||
|
||||
ctdm_init(*module_interface);
|
||||
|
||||
/* indicate that the module should continue to be loaded */
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
@@ -38,6 +38,7 @@ void ctdm_init(switch_loadable_module_interface_t *module_interface);
|
||||
|
||||
#define kSPAN_ID "span"
|
||||
#define kCHAN_ID "chan"
|
||||
#define kSPAN_NAME "span_name"
|
||||
|
||||
static struct {
|
||||
switch_memory_pool_t *pool;
|
||||
@@ -96,8 +97,8 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||
switch_memory_pool_t **pool,
|
||||
switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
|
||||
{
|
||||
const char *szspanid = switch_event_get_header(var_event, kSPAN_ID),
|
||||
*szchanid = switch_event_get_header(var_event, kCHAN_ID);
|
||||
const char *szchanid = switch_event_get_header(var_event, kCHAN_ID),
|
||||
*span_name = switch_event_get_header(var_event, kSPAN_NAME);
|
||||
int chan_id;
|
||||
int span_id;
|
||||
|
||||
@@ -111,14 +112,21 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||
|
||||
ctdm_private_t *tech_pvt = NULL;
|
||||
|
||||
if (zstr(szchanid) || zstr(szspanid)) {
|
||||
if (zstr(szchanid) || zstr(span_name)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Both ["kSPAN_ID"] and ["kCHAN_ID"] have to be set.\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
chan_id = atoi(szchanid);
|
||||
span_id = atoi(szspanid);
|
||||
|
||||
|
||||
if (ftdm_span_find_by_name(span_name, &span) == FTDM_SUCCESS) {
|
||||
span_id = ftdm_span_get_id(span);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find span [%s]\n", span_name);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
if (!(*new_session = switch_core_session_request(ctdm.endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, 0, pool))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't request session.\n");
|
||||
@@ -262,9 +270,9 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session)
|
||||
if (tech_pvt->write_codec.implementation) {
|
||||
switch_core_codec_destroy(&tech_pvt->write_codec);
|
||||
}
|
||||
|
||||
ftdm_channel_close(&tech_pvt->ftdm_channel);
|
||||
}
|
||||
|
||||
ftdm_channel_close(&tech_pvt->ftdm_channel);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
Reference in New Issue
Block a user