[Freeswitch-svn] [commit] r9040 - in freeswitch/trunk: conf/autoload_configs libs libs/curl/lib libs/libedit libs/xmlrpc-c libs/xmlrpc-c/include/xmlrpc-c libs/yaml libs/yaml/include libs/yaml/src libs/yaml/tests src src/include src/mod/asr_tts src/mod/asr_tts/mod_flite src/mod/asr_tts/mod_pocketsphinx src/mod/languages/mod_lua src/mod/languages/mod_lua/lua src/mod/languages/mod_perl src/mod/languages/mod_python src/mod/languages/mod_yaml
Freeswitch SVN
anthm at freeswitch.org
Tue Jul 15 13:39:17 EDT 2008
Author: anthm
Date: Tue Jul 15 13:39:16 2008
New Revision: 9040
Added:
freeswitch/trunk/conf/autoload_configs/python.conf.xml
Modified:
freeswitch/trunk/libs/ (props changed)
freeswitch/trunk/libs/curl/lib/ (props changed)
freeswitch/trunk/libs/libedit/ (props changed)
freeswitch/trunk/libs/xmlrpc-c/ (props changed)
freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/ (props changed)
freeswitch/trunk/libs/yaml/ (props changed)
freeswitch/trunk/libs/yaml/include/ (props changed)
freeswitch/trunk/libs/yaml/src/ (props changed)
freeswitch/trunk/libs/yaml/tests/ (props changed)
freeswitch/trunk/src/include/ (props changed)
freeswitch/trunk/src/include/switch_core.h
freeswitch/trunk/src/mod/asr_tts/ (props changed)
freeswitch/trunk/src/mod/asr_tts/mod_flite/ (props changed)
freeswitch/trunk/src/mod/asr_tts/mod_pocketsphinx/ (props changed)
freeswitch/trunk/src/mod/languages/mod_lua/ (props changed)
freeswitch/trunk/src/mod/languages/mod_lua/lua/ (props changed)
freeswitch/trunk/src/mod/languages/mod_perl/ (props changed)
freeswitch/trunk/src/mod/languages/mod_python/ (props changed)
freeswitch/trunk/src/mod/languages/mod_yaml/ (props changed)
freeswitch/trunk/src/switch_core_codec.c
freeswitch/trunk/src/switch_core_session.c
freeswitch/trunk/src/switch_ivr_async.c
freeswitch/trunk/src/switch_ivr_originate.c
freeswitch/trunk/src/switch_ivr_play_say.c
Log:
update
Added: freeswitch/trunk/conf/autoload_configs/python.conf.xml
==============================================================================
--- (empty file)
+++ freeswitch/trunk/conf/autoload_configs/python.conf.xml Tue Jul 15 13:39:16 2008
@@ -0,0 +1,6 @@
+<configuration name="python.conf" description="PYTHON Configuration">
+ <settings>
+ <!--<param name="xml-handler-script" value="dp"/>-->
+ <!--<param name="xml-handler-bindings" value="dialplan"/>-->
+ </settings>
+</configuration>
Modified: freeswitch/trunk/src/include/switch_core.h
==============================================================================
--- freeswitch/trunk/src/include/switch_core.h (original)
+++ freeswitch/trunk/src/include/switch_core.h Tue Jul 15 13:39:16 2008
@@ -1122,6 +1122,8 @@
*/
SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(_In_ switch_core_session_t *session, switch_codec_t *codec);
+SWITCH_DECLARE(void) switch_core_session_unset_read_codec(_In_ switch_core_session_t *session);
+
/*!
\brief Retrieve the read codec from a given session
\param session session to retrieve from
Modified: freeswitch/trunk/src/switch_core_codec.c
==============================================================================
--- freeswitch/trunk/src/switch_core_codec.c (original)
+++ freeswitch/trunk/src/switch_core_codec.c Tue Jul 15 13:39:16 2008
@@ -42,6 +42,11 @@
return CODEC_ID++;
}
+SWITCH_DECLARE(void) switch_core_session_unset_read_codec(switch_core_session_t *session)
+{
+ session->real_read_codec = session->read_codec = NULL;
+}
+
SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(switch_core_session_t *session, switch_codec_t *codec)
{
@@ -49,52 +54,55 @@
switch_channel_t *channel = switch_core_session_get_channel(session);
char tmp[30];
- if (!codec || !codec->implementation) {
+ if (codec && !codec->implementation) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot set ININITILIZED codec!\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if (!codec || codec == session->real_read_codec) {
if (session->real_read_codec) {
session->read_codec = session->real_read_codec;
- session->real_read_codec = NULL;
} else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot set NULL codec!\n");
return SWITCH_STATUS_FALSE;
}
- } else if (session->read_codec) {
- if (session->real_read_codec) {
- if (codec == session->real_read_codec) {
- session->read_codec = codec;
- session->real_read_codec = NULL;
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot double-set codec!\n");
- return SWITCH_STATUS_FALSE;
- }
- } else {
- session->real_read_codec = session->read_codec;
- session->read_codec = codec;
+ } else if (codec) {
+ if (session->read_codec != session->real_read_codec) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot double-set codec!\n");
+ return SWITCH_STATUS_FALSE;
}
- } else {
+
session->read_codec = codec;
- }
- if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) {
- switch_channel_event_set_data(session->channel, event);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-name", "%s", session->read_codec->implementation->iananame);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-rate", "%d", session->read_codec->implementation->actual_samples_per_second);
- if (session->read_codec->implementation->actual_samples_per_second != session->read_codec->implementation->samples_per_second) {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-reported-read-codec-rate", "%d", session->read_codec->implementation->samples_per_second);
+ if (!session->real_read_codec) {
+ session->real_read_codec = session->read_codec;
}
- switch_event_fire(&event);
}
- switch_channel_set_variable(channel, "read_codec", session->read_codec->implementation->iananame);
- switch_snprintf(tmp, sizeof(tmp), "%d", session->read_codec->implementation->actual_samples_per_second);
- switch_channel_set_variable(channel, "read_rate", tmp);
+ if (session->read_codec && session->read_codec->implementation) {
+ if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_event_set_data(session->channel, event);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-name", "%s", session->read_codec->implementation->iananame);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-rate", "%d", session->read_codec->implementation->actual_samples_per_second);
+ if (session->read_codec->implementation->actual_samples_per_second != session->read_codec->implementation->samples_per_second) {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-reported-read-codec-rate", "%d", session->read_codec->implementation->samples_per_second);
+ }
+ switch_event_fire(&event);
+ }
+ switch_channel_set_variable(channel, "read_codec", session->read_codec->implementation->iananame);
+ switch_snprintf(tmp, sizeof(tmp), "%d", session->read_codec->implementation->actual_samples_per_second);
+ switch_channel_set_variable(channel, "read_rate", tmp);
- session->raw_read_frame.codec = session->read_codec;
- session->raw_write_frame.codec = session->read_codec;
- session->enc_read_frame.codec = session->read_codec;
- session->enc_write_frame.codec = session->read_codec;
- return SWITCH_STATUS_SUCCESS;
+ session->raw_read_frame.codec = session->read_codec;
+ session->raw_write_frame.codec = session->read_codec;
+ session->enc_read_frame.codec = session->read_codec;
+ session->enc_write_frame.codec = session->read_codec;
+ return SWITCH_STATUS_SUCCESS;
+ }
+
+ return SWITCH_STATUS_FALSE;
+
}
SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_effective_read_codec(switch_core_session_t *session)
Modified: freeswitch/trunk/src/switch_core_session.c
==============================================================================
--- freeswitch/trunk/src/switch_core_session.c (original)
+++ freeswitch/trunk/src/switch_core_session.c Tue Jul 15 13:39:16 2008
@@ -666,6 +666,8 @@
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_size_t has;
+ switch_core_session_set_read_codec(session, NULL);
+
/* clear resamplers */
switch_mutex_lock(session->resample_mutex);
switch_resample_destroy(&session->read_resampler);
Modified: freeswitch/trunk/src/switch_ivr_async.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_async.c (original)
+++ freeswitch/trunk/src/switch_ivr_async.c Tue Jul 15 13:39:16 2008
@@ -732,7 +732,6 @@
switch_core_session_rwunlock(tsession);
status = SWITCH_STATUS_SUCCESS;
- switch_core_session_set_read_codec(session, read_codec);
switch_core_session_reset(session, SWITCH_TRUE);
}
Modified: freeswitch/trunk/src/switch_ivr_originate.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_originate.c (original)
+++ freeswitch/trunk/src/switch_ivr_originate.c Tue Jul 15 13:39:16 2008
@@ -444,11 +444,9 @@
switch_buffer_destroy(&ringback.audio_buffer);
}
- if (!pass && write_codec.implementation) {
- if (read_codec && !ringback.asis) {
- switch_core_session_set_read_codec(session, read_codec);
- switch_core_session_reset(session, SWITCH_TRUE);
- }
+ switch_core_session_reset(session, SWITCH_TRUE);
+
+ if (write_codec.implementation) {
switch_core_codec_destroy(&write_codec);
}
@@ -1403,15 +1401,12 @@
switch_buffer_destroy(&ringback.audio_buffer);
}
- if (!pass && write_codec.implementation) {
- if (read_codec && !ringback.asis) {
- switch_core_session_set_read_codec(session, read_codec);
- switch_core_session_reset(session, SWITCH_FALSE);
- }
+ switch_core_session_reset(session, SWITCH_FALSE);
+
+ if (write_codec.implementation) {
switch_core_codec_destroy(&write_codec);
}
-
for (i = 0; i < and_argc; i++) {
if (!peer_channels[i]) {
continue;
Modified: freeswitch/trunk/src/switch_ivr_play_say.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_play_say.c (original)
+++ freeswitch/trunk/src/switch_ivr_play_say.c Tue Jul 15 13:39:16 2008
@@ -567,7 +567,6 @@
}
}
- switch_core_session_set_read_codec(session, read_codec);
switch_core_file_close(fh);
switch_core_session_reset(session, SWITCH_TRUE);
return status;
@@ -1316,7 +1315,7 @@
}
}
- switch_core_session_set_read_codec(session, NULL);
+ switch_core_session_reset(session, SWITCH_FALSE);
switch_core_codec_destroy(&raw_codec);
end:
More information about the Freeswitch-svn
mailing list