mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-14 09:58:17 +00:00
add vars
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6499 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -37,8 +37,11 @@
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(switch_core_session_t *session, switch_codec_t *codec)
|
||||
{
|
||||
switch_event_t *event;
|
||||
switch_channel_t *channel;
|
||||
char tmp[30];
|
||||
|
||||
assert(session != NULL);
|
||||
channel = switch_core_session_get_channel(session);
|
||||
|
||||
if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_event_set_data(session->channel, event);
|
||||
@@ -50,6 +53,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(switch_core_s
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
|
||||
switch_channel_set_variable(channel, "read_codec", codec->implementation->iananame);
|
||||
snprintf(tmp, sizeof(tmp), "%d", codec->implementation->actual_samples_per_second);
|
||||
switch_channel_set_variable(channel, "read_rate", tmp);
|
||||
|
||||
session->read_codec = codec;
|
||||
session->raw_read_frame.codec = session->read_codec;
|
||||
session->raw_write_frame.codec = session->read_codec;
|
||||
@@ -67,7 +74,12 @@ SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_read_codec(switch_core_
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_set_write_codec(switch_core_session_t *session, switch_codec_t *codec)
|
||||
{
|
||||
switch_event_t *event;
|
||||
switch_channel_t *channel;
|
||||
char tmp[30];
|
||||
|
||||
assert(session != NULL);
|
||||
channel = switch_core_session_get_channel(session);
|
||||
|
||||
|
||||
if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_event_set_data(session->channel, event);
|
||||
@@ -79,6 +91,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_write_codec(switch_core_
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
|
||||
switch_channel_set_variable(channel, "write_codec", codec->implementation->iananame);
|
||||
snprintf(tmp, sizeof(tmp), "%d", codec->implementation->actual_samples_per_second);
|
||||
switch_channel_set_variable(channel, "write_rate", tmp);
|
||||
|
||||
session->write_codec = codec;
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
Reference in New Issue
Block a user