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
commit 4d9135500c
14 changed files with 67 additions and 35 deletions

3
.gitignore vendored
View File

@ -5,6 +5,8 @@
*.a
*.la
*.loT
*.orig
*.rej
.libs
.deps
.\#*
@ -31,6 +33,7 @@
*.ilk
*.bsc
*.pch
core.*
/Path
/w32/Library/lastversion
/w32/Library/tmpVersion.Bat

2
libs/.gitignore vendored
View File

@ -1,3 +1,5 @@
/libg723_1/
/libg729/
/apr-util/.make.dirs
/apr-util/Makefile
/apr-util/apr-util.pc

View File

@ -603,6 +603,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
assert(tech_pvt != NULL);
if (switch_test_flag(tech_pvt, TFLAG_DEAD)) {
ftdm_log(FTDM_LOG_DEBUG, "TFLAG_DEAD is set\n");
return SWITCH_STATUS_FALSE;
}
@ -636,6 +637,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
}
if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
ftdm_log(FTDM_LOG_DEBUG, "TFLAG_IO is not set\n");
goto fail;
}
@ -643,6 +645,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
status = ftdm_channel_wait(tech_pvt->ftdmchan, &wflags, chunk);
if (status == FTDM_FAIL) {
ftdm_log(FTDM_LOG_WARNING, "failed to wait for I/O\n");
goto fail;
}
@ -650,19 +653,21 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
if (!switch_test_flag(tech_pvt, TFLAG_HOLD)) {
total_to -= chunk;
if (total_to <= 0) {
ftdm_log(FTDM_LOG_WARNING, "Too many timeouts while waiting for I/O\n");
goto fail;
}
}
goto top;
}
if (!(wflags & FTDM_READ)) {
ftdm_log(FTDM_LOG_WARNING, "I/O waiting returned status %d but nothing to read is available\n", status);
goto fail;
}
len = tech_pvt->read_frame.buflen;
if (ftdm_channel_read(tech_pvt->ftdmchan, tech_pvt->read_frame.data, &len) != FTDM_SUCCESS) {
ftdm_log(FTDM_LOG_WARNING, "failed to read from device\n");
goto fail;
}

View File

@ -1157,31 +1157,27 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_set_state(const char *file, const char *f
int waitms = DEFAULT_WAIT_TIME;
if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_READY)) {
ftdm_log(file, func, line, FTDM_LOG_LEVEL_ERROR, "%d:%d Ignored state change request from %s to %s, the channel is not ready\n",
ftdmchan->span_id, ftdmchan->chan_id,
ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_ERROR, "Ignored state change request from %s to %s, the channel is not ready\n",
ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state));
return FTDM_FAIL;
}
if (ftdm_test_flag(ftdmchan->span, FTDM_SPAN_SUSPENDED)) {
if (state != FTDM_CHANNEL_STATE_RESTART && state != FTDM_CHANNEL_STATE_DOWN) {
ftdm_log(file, func, line, FTDM_LOG_LEVEL_ERROR, "%d:%d Ignored state change request from %s to %s, span %s is suspended\n",
ftdmchan->span_id, ftdmchan->chan_id,
ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_ERROR, "Ignored state change request from %s to %s, span %s is suspended\n",
ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state), ftdmchan->span->name);
return FTDM_FAIL;
}
}
if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) {
ftdm_log(file, func, line, FTDM_LOG_LEVEL_ERROR, "%d:%d Ignored state change request from %s to %s, the previous state change has not been processed yet\n",
ftdmchan->span_id, ftdmchan->chan_id,
ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_ERROR, "Ignored state change request from %s to %s, the previous state change has not been processed yet\n",
ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state));
return FTDM_FAIL;
}
if (ftdmchan->state == state) {
ftdm_log(file, func, line, FTDM_LOG_LEVEL_WARNING, "%d:%d Why bother changing state from %s to %s\n",
ftdmchan->span_id, ftdmchan->chan_id, ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state));
ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_WARNING, "Why bother changing state from %s to %s\n", ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state));
return FTDM_FAIL;
}
@ -1270,8 +1266,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_set_state(const char *file, const char *f
end:
if (ok) {
ftdm_log(file, func, line, FTDM_LOG_LEVEL_DEBUG, "%d:%d Changed state from %s to %s\n",
ftdmchan->span_id, ftdmchan->chan_id, ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state));
ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_DEBUG, "Changed state from %s to %s\n", ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state));
ftdmchan->last_state = ftdmchan->state;
ftdmchan->state = state;
ftdm_set_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE);
@ -1283,8 +1278,7 @@ end:
}
ftdm_mutex_unlock(ftdmchan->span->mutex);
} else {
ftdm_log(file, func, line, FTDM_LOG_LEVEL_WARNING, "%d:%d VETO state change from %s to %s\n",
ftdmchan->span_id, ftdmchan->chan_id, ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state));
ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_WARNING, "VETO state change from %s to %s\n", ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state));
}
/* there is an inherent race here between set and check of the change flag but we do not care because
@ -1311,8 +1305,8 @@ end:
}
if (waitms <= 0) {
ftdm_log(file, func, line, FTDM_LOG_LEVEL_WARNING, "%d:%d state change from %s to %s was most likely not processed after aprox %dms\n",
ftdmchan->span_id, ftdmchan->chan_id, ftdm_channel_state2str(ftdmchan->last_state), ftdm_channel_state2str(state), DEFAULT_WAIT_TIME);
ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_WARNING, "state change from %s to %s was most likely not processed after aprox %dms\n",
ftdm_channel_state2str(ftdmchan->last_state), ftdm_channel_state2str(state), DEFAULT_WAIT_TIME);
}
return ok ? FTDM_SUCCESS : FTDM_FAIL;

View File

@ -561,6 +561,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_chan(ftdm_channel_t *ftdmchan);
#define ftdm_channel_lock(chan) ftdm_mutex_lock(chan->mutex)
#define ftdm_channel_unlock(chan) ftdm_mutex_unlock(chan->mutex)
#define ftdm_log_chan_ex(fchan, file, func, line, level, format, ...) ftdm_log(file, func, line, level, "s%dc%d " format, fchan->span_id, fchan->chan_id, __VA_ARGS__)
#define ftdm_log_chan(fchan, level, format, ...) ftdm_log(level, "s%dc%d " format, fchan->span_id, fchan->chan_id, __VA_ARGS__)
#define ftdm_log_chan_msg(fchan, level, msg) ftdm_log(level, "s%dc%d " msg, fchan->span_id, fchan->chan_id)

View File

@ -11,3 +11,14 @@ config.*
configure
libtool
aclocal.m4
detect_dtmf
detect_tones
testanalog
testapp
testboost
testcid
testisdn
testpri
testr2
testtones

View File

@ -256,7 +256,7 @@
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\..\..\Debug"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\..\..\..\bin\Debug/pocketsphinx.pdb"
ProgramDatabaseFile="$(IntDir)/pocketsphinx.pdb"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
@ -348,7 +348,7 @@
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\..\..\Debug"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\..\..\..\bin\Debug/pocketsphinx.pdb"
ProgramDatabaseFile="$(IntDir)/pocketsphinx.pdb"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"

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;

View File

@ -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");

View File

@ -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)) {

View File

@ -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;
}

View File

@ -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;

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);
}

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);