[asterisk-commits] file: branch group/pimp_my_sip r379272 - in /team/group/pimp_my_sip: channels...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jan 16 13:57:51 CST 2013
Author: file
Date: Wed Jan 16 13:57:47 2013
New Revision: 379272
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=379272
Log:
Apply codec preferences and configured formats in general on the channel.
Modified:
team/group/pimp_my_sip/channels/chan_gulp.c
team/group/pimp_my_sip/include/asterisk/res_sip.h
team/group/pimp_my_sip/res/res_sip_sdp_audio.c
Modified: team/group/pimp_my_sip/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/channels/chan_gulp.c?view=diff&rev=379272&r1=379271&r2=379272
==============================================================================
--- team/group/pimp_my_sip/channels/chan_gulp.c (original)
+++ team/group/pimp_my_sip/channels/chan_gulp.c Wed Jan 16 13:57:47 2013
@@ -54,6 +54,7 @@
#include "asterisk/musiconhold.h"
#include "asterisk/causes.h"
+#include "asterisk/res_sip.h"
#include "asterisk/res_sip_session.h"
static const char desc[] = "Gulp SIP Channel";
@@ -130,6 +131,7 @@
static struct ast_channel *gulp_new(struct ast_sip_session *session, int state, const char *exten, const char *title, const char *linkedid, const char *cid_name)
{
struct ast_channel *chan;
+ struct ast_format fmt;
/* TODO: Fix channel name generation */
if (!(chan = ast_channel_alloc(1, state, "", S_OR(cid_name, ""), "", "", "", linkedid, 0, "Gulp/%04lx", ast_random() & 0xffff))) {
@@ -138,6 +140,14 @@
ast_channel_tech_set(chan, &gulp_tech);
ast_channel_tech_pvt_set(chan, session);
+
+ ast_format_cap_copy(ast_channel_nativeformats(chan), session->endpoint->codecs);
+ ast_codec_choose(&session->endpoint->prefs, session->endpoint->codecs, 1, &fmt);
+
+ ast_format_copy(ast_channel_writeformat(chan), &fmt);
+ ast_format_copy(ast_channel_rawwriteformat(chan), &fmt);
+ ast_format_copy(ast_channel_readformat(chan), &fmt);
+ ast_format_copy(ast_channel_rawreadformat(chan), &fmt);
if (state == AST_STATE_RING) {
ast_channel_rings_set(chan, 1);
Modified: team/group/pimp_my_sip/include/asterisk/res_sip.h
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/include/asterisk/res_sip.h?view=diff&rev=379272&r1=379271&r2=379272
==============================================================================
--- team/group/pimp_my_sip/include/asterisk/res_sip.h (original)
+++ team/group/pimp_my_sip/include/asterisk/res_sip.h Wed Jan 16 13:57:47 2013
@@ -154,6 +154,8 @@
struct ast_sip_transport *transport;
/*! Address of record for incoming registrations */
struct ast_sip_aor *aor;
+ /*! Codec preferences */
+ struct ast_codec_pref prefs;
/*! Configured codecs */
struct ast_format_cap *codecs;
/*! DTMF mode to use with this endpoint */
Modified: team/group/pimp_my_sip/res/res_sip_sdp_audio.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/res/res_sip_sdp_audio.c?view=diff&rev=379272&r1=379271&r2=379272
==============================================================================
--- team/group/pimp_my_sip/res/res_sip_sdp_audio.c (original)
+++ team/group/pimp_my_sip/res/res_sip_sdp_audio.c Wed Jan 16 13:57:47 2013
@@ -80,6 +80,8 @@
ast_channel_set_fd(session->channel, 0, ast_rtp_instance_fd(session->media.audio, 0));
ast_channel_set_fd(session->channel, 1, ast_rtp_instance_fd(session->media.audio, 1));
+
+ ast_rtp_codecs_packetization_set(ast_rtp_instance_get_codecs(session->media.audio), session->media.audio, &session->endpoint->prefs);
return 0;
}
@@ -172,7 +174,7 @@
/* Apply the new formats to the channel, potentially changing read/write formats while doing so */
ast_format_cap_copy(ast_channel_nativeformats(session->channel), cap);
- ast_codec_choose(NULL, cap, 1, &fmt);
+ ast_codec_choose(&session->endpoint->prefs, cap, 1, &fmt);
ast_set_read_format(session->channel, &fmt);
ast_set_write_format(session->channel, &fmt);
More information about the asterisk-commits
mailing list