aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-11-08 18:07:16 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-11-08 18:07:16 +0000
commit4693d1b90ba8e7017e7b6ee19e8f0bb78d1b3832 (patch)
treee60a63946c213f91106d403c4040488a915d36d3 /channels
parent78fd6a941396e46e89d1046298e32433c8df6199 (diff)
add simple fix for SDP to report proper sample rate for G.722 media sessions
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@47333 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index ff915c70f..2064fe6ff 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -5976,6 +5976,8 @@ static void add_noncodec_to_sdp(const struct sip_pvt *p, int format, int sample_
ast_build_string(a_buf, a_size, "a=fmtp:%d 0-16\r\n", rtp_code);
}
+#define SDP_SAMPLE_RATE(x) (x == AST_FORMAT_G722) ? 16000 : 8000
+
/*! \brief Add Session Description Protocol message */
static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p)
{
@@ -6119,31 +6121,33 @@ static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p)
Note that p->prefcodec can include video codecs, so mask them out
*/
if (capability & p->prefcodec) {
- add_codec_to_sdp(p, p->prefcodec & AST_FORMAT_AUDIO_MASK, 8000,
+ int codec = p->prefcodec & AST_FORMAT_AUDIO_MASK;
+
+ add_codec_to_sdp(p, codec, SDP_SAMPLE_RATE(codec),
&m_audio_next, &m_audio_left,
&a_audio_next, &a_audio_left,
debug, &min_audio_packet_size);
- alreadysent |= p->prefcodec & AST_FORMAT_AUDIO_MASK;
+ alreadysent |= codec;
}
/* Start by sending our preferred audio codecs */
for (x = 0; x < 32; x++) {
- int pref_codec;
+ int codec;
- if (!(pref_codec = ast_codec_pref_index(&p->prefs, x)))
+ if (!(codec = ast_codec_pref_index(&p->prefs, x)))
break;
- if (!(capability & pref_codec))
+ if (!(capability & codec))
continue;
- if (alreadysent & pref_codec)
+ if (alreadysent & codec)
continue;
- add_codec_to_sdp(p, pref_codec, 8000,
+ add_codec_to_sdp(p, codec, SDP_SAMPLE_RATE(codec),
&m_audio_next, &m_audio_left,
&a_audio_next, &a_audio_left,
debug, &min_audio_packet_size);
- alreadysent |= pref_codec;
+ alreadysent |= codec;
}
/* Now send any other common audio and video codecs, and non-codec formats: */
@@ -6155,7 +6159,7 @@ static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p)
continue;
if (x <= AST_FORMAT_MAX_AUDIO)
- add_codec_to_sdp(p, x, 8000,
+ add_codec_to_sdp(p, x, SDP_SAMPLE_RATE(x),
&m_audio_next, &m_audio_left,
&a_audio_next, &a_audio_left,
debug, &min_audio_packet_size);