From b46e1b45e4a1c466c89c59065abf760cc278714a Mon Sep 17 00:00:00 2001
From: Joshua Colp <jcolp@digium.com>
Date: Mon, 9 Jul 2012 19:05:25 +0000
Subject: [PATCH] Force the clock rate of G.722 to be 16000 when using the
 Google transports as it is 8000 elsewhere.

(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 | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/channels/chan_motif.c b/channels/chan_motif.c
index 60d201e06f..d7238cec5e 100644
--- a/channels/chan_motif.c
+++ b/channels/chan_motif.c
@@ -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;
-- 
GitLab