Force the clock rate of G.722 to be 16000 when using the Google transports as it...
authorJoshua Colp <jcolp@digium.com>
Mon, 9 Jul 2012 19:05:25 +0000 (19:05 +0000)
committerJoshua Colp <jcolp@digium.com>
Mon, 9 Jul 2012 19:05:25 +0000 (19:05 +0000)
(closes issue ASTERISK-20105)
Reported by: Malcolm Davenport

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369838 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_motif.c

index 60d201e..d7238ce 100644 (file)
@@ -1142,8 +1142,13 @@ static int jingle_add_payloads_to_description(struct jingle_session *session, st
                iks_insert_attrib(payload, "id", tmp);
                iks_insert_attrib(payload, "name", ast_rtp_lookup_mime_subtype2(1, &format, 0, 0));
                iks_insert_attrib(payload, "channels", "1");
-               snprintf(tmp, sizeof(tmp), "%d", ast_rtp_lookup_sample_rate2(1, &format, 0));
-               iks_insert_attrib(payload, "clockrate", tmp);
+
+               if ((format.id == AST_FORMAT_G722) && ((session->transport == JINGLE_TRANSPORT_GOOGLE_V1) || (session->transport == JINGLE_TRANSPORT_GOOGLE_V2))) {
+                       iks_insert_attrib(payload, "clockrate", "16000");
+               } else {
+                       snprintf(tmp, sizeof(tmp), "%d", ast_rtp_lookup_sample_rate2(1, &format, 0));
+                       iks_insert_attrib(payload, "clockrate", tmp);
+               }
 
                iks_insert_node(description, payload);
                payloads[i++] = payload;