update
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9040 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
266a56391e
commit
bc2fc3fa14
|
@ -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>
|
|
@ -1122,6 +1122,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_destroy(switch_codec_t *codec)
|
|||
*/
|
||||
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
|
||||
|
|
|
@ -42,6 +42,11 @@ SWITCH_DECLARE(uint32_t) switch_core_codec_next_id(void)
|
|||
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_DECLARE(switch_status_t) switch_core_session_set_read_codec(switch_core_s
|
|||
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;
|
||||
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;
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_effective_read_codec(switch_core_session_t *session)
|
||||
|
|
|
@ -666,6 +666,8 @@ SWITCH_DECLARE(void) switch_core_session_reset(switch_core_session_t *session, s
|
|||
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);
|
||||
|
|
|
@ -732,7 +732,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -444,11 +444,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t
|
|||
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_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
|||
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;
|
||||
|
|
|
@ -567,7 +567,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
|
|||
}
|
||||
}
|
||||
|
||||
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_DECLARE(switch_status_t) switch_ivr_wait_for_silence(switch_core_session_
|
|||
}
|
||||
}
|
||||
|
||||
switch_core_session_set_read_codec(session, NULL);
|
||||
switch_core_session_reset(session, SWITCH_FALSE);
|
||||
switch_core_codec_destroy(&raw_codec);
|
||||
|
||||
end:
|
||||
|
|
Loading…
Reference in New Issue