Merge branch 'master' of ssh://git@git.freeswitch.org/freeswitch

This commit is contained in:
Di-Shi Sun
2010-06-03 10:01:36 +08:00
14 changed files with 67 additions and 35 deletions
+1
View File
@@ -1006,6 +1006,7 @@ typedef enum {
CF_BROADCAST_DROP_MEDIA,
CF_EARLY_HANGUP,
CF_MEDIA_SET,
CF_CONSUME_ON_ORIGINATE,
/* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
CF_FLAG_MAX
} switch_channel_flag_t;
@@ -4387,6 +4387,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
switch_console_set_complete("add uuid_loglevel ::console::list_uuid info");
switch_console_set_complete("add uuid_loglevel ::console::list_uuid debug");
switch_console_set_complete("add uuid_media ::console::list_uuid");
switch_console_set_complete("add uuid_media off ::console::list_uuid");
switch_console_set_complete("add uuid_park ::console::list_uuid");
switch_console_set_complete("add uuid_phone_event ::console::list_uuid talk");
switch_console_set_complete("add uuid_phone_event ::console::list_uuid hold");
@@ -198,16 +198,16 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_spandsp_init)
SWITCH_ADD_APP(app_interface, "spandsp_stop_dtmf", "stop inband dtmf", "Stop detecting inband dtmf.", stop_dtmf_session_function, "", SAF_NONE);
SWITCH_ADD_APP(app_interface, "spandsp_start_dtmf", "Detect dtmf", "Detect inband dtmf on the session", dtmf_session_function, "", SAF_MEDIA_TAP);
SWITCH_ADD_APP(app_interface, "start_tone_detect", "Start background tone detection with cadence", "", start_tone_detect_app, "[name]", SAF_NONE);
SWITCH_ADD_APP(app_interface, "stop_tone_detect", "Stop background tone detection with cadence", "", stop_tone_detect_app, "", SAF_NONE);
SWITCH_ADD_API(api_interface, "start_tone_detect", "Start background tone detection with cadence", start_tone_detect_api, "[name]");
SWITCH_ADD_API(api_interface, "stop_tone_detect", "Stop background tone detection with cadence", stop_tone_detect_api, "");
mod_spandsp_fax_load(pool);
mod_spandsp_codecs_load(module_interface, pool);
if (mod_spandsp_dsp_load(module_interface, pool) != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_FALSE;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't load or process spandsp.conf, not adding tone_detect applications\n");
} else {
SWITCH_ADD_APP(app_interface, "start_tone_detect", "Start background tone detection with cadence", "", start_tone_detect_app, "[name]", SAF_NONE);
SWITCH_ADD_APP(app_interface, "stop_tone_detect", "Stop background tone detection with cadence", "", stop_tone_detect_app, "", SAF_NONE);
SWITCH_ADD_API(api_interface, "start_tone_detect", "Start background tone detection with cadence", start_tone_detect_api, "[name]");
SWITCH_ADD_API(api_interface, "stop_tone_detect", "Stop background tone detection with cadence", stop_tone_detect_api, "");
}
if ((switch_event_bind_removable(modname, SWITCH_EVENT_RELOADXML, NULL, event_handler, NULL, &NODE) != SWITCH_STATUS_SUCCESS)) {
@@ -509,7 +509,7 @@ static switch_status_t do_config(void)
switch_status_t status = SWITCH_STATUS_SUCCESS;
switch_xml_t cfg = NULL, xml = NULL, callprogress = NULL, xdescriptor = NULL;
if (!(xml = switch_xml_open_cfg("spandsp.conf", &cfg, NULL))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not open tone_detect.conf\n");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not open spandsp.conf\n");
status = SWITCH_STATUS_FALSE;
goto done;
}
@@ -3042,7 +3042,7 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p
greet_key_press:
if (switch_stristr(buf, profile->login_keys)) {
voicemail_check_main(session, profile, domain_name, id, 0);
} else if (!strcasecmp(buf, profile->operator_key) && !zstr(profile->operator_key)) {
} else if (!zstr(profile->operator_ext) && !zstr(profile->operator_key) && !strcasecmp(buf, profile->operator_key) ) {
int argc;
char *argv[4];
char *mycmd;
+16 -4
View File
@@ -51,7 +51,8 @@ typedef enum {
TFLAG_CNG = (1 << 3),
TFLAG_BRIDGE = (1 << 4),
TFLAG_BOWOUT = (1 << 5),
TFLAG_BLEG = (1 << 6)
TFLAG_BLEG = (1 << 6),
TFLAG_APP = (1 << 7)
} TFLAGS;
struct private_object {
@@ -258,6 +259,11 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
//switch_ivr_transfer_variable(session, tech_pvt->other_session, "process_cdr");
switch_ivr_transfer_variable(session, tech_pvt->other_session, NULL);
if (switch_test_flag(tech_pvt, TFLAG_APP)) {
switch_set_flag(b_tech_pvt, TFLAG_APP);
switch_clear_flag(tech_pvt, TFLAG_APP);
}
switch_channel_set_variable(channel, "other_loopback_leg_uuid", switch_channel_get_uuid(b_channel));
switch_channel_set_variable(b_channel, "other_loopback_leg_uuid", switch_channel_get_uuid(channel));
@@ -313,10 +319,13 @@ static switch_status_t channel_on_routing(switch_core_session_t *session)
do_reset(tech_pvt);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL ROUTING\n", switch_channel_get_name(channel));
if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND) && (app = switch_channel_get_variable(channel, "loopback_app"))) {
if (switch_test_flag(tech_pvt, TFLAG_APP) && !switch_test_flag(tech_pvt, TFLAG_OUTBOUND) &&
(app = switch_channel_get_variable(channel, "loopback_app"))) {
switch_caller_extension_t *extension = NULL;
switch_clear_flag(tech_pvt, TFLAG_APP);
arg = switch_channel_get_variable(channel, "loopback_app_arg");
extension = switch_caller_extension_new(session, app, app);
switch_caller_extension_add_application(session, extension, "pre_answer", NULL);
@@ -862,10 +871,13 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
}
switch_channel_set_variable(channel, "loopback_app", app);
if (arg) {
switch_channel_set_variable(channel, "loopback_app_arg", arg);
}
switch_set_flag(tech_pvt, TFLAG_APP);
caller_profile->destination_number = switch_core_strdup(caller_profile->pool, app);
}
+7 -5
View File
@@ -39,10 +39,9 @@ static switch_status_t originate_on_consume_media_transmit(switch_core_session_t
{
switch_channel_t *channel = switch_core_session_get_channel(session);
/* testing out not using this, we probably don't need it anymore now that we have audio sync */
#if 0
if (!switch_channel_test_flag(channel, CF_PROXY_MODE)) {
while (switch_channel_get_state(channel) == CS_CONSUME_MEDIA && !switch_channel_test_flag(channel, CF_TAGGED)) {
if (!switch_channel_test_flag(channel, CF_PROXY_MODE) && switch_channel_test_flag(channel, CF_CONSUME_ON_ORIGINATE)) {
while (switch_channel_test_flag(channel, CF_ORIGINATING) &&
switch_channel_get_state(channel) == CS_CONSUME_MEDIA && !switch_channel_test_flag(channel, CF_TAGGED)) {
if (!switch_channel_media_ready(channel)) {
switch_yield(10000);
} else {
@@ -50,7 +49,6 @@ static switch_status_t originate_on_consume_media_transmit(switch_core_session_t
}
}
}
#endif
switch_channel_clear_state_handler(channel, &originate_state_handlers);
@@ -2612,6 +2610,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
if (table) {
switch_channel_add_state_handler(originate_status[i].peer_channel, table);
}
if (oglobals.monitor_early_media_ring || oglobals.monitor_early_media_fail) {
switch_channel_set_flag(originate_status[i].peer_channel, CF_CONSUME_ON_ORIGINATE);
}
switch_channel_add_state_handler(originate_status[i].peer_channel, &originate_state_handlers);