[asterisk-commits] phsultan: branch 1.6.0 r118645 - in /branches/1.6.0: ./ channels/ include/ast...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 28 09:13:17 CDT 2008


Author: phsultan
Date: Wed May 28 09:13:16 2008
New Revision: 118645

URL: http://svn.digium.com/view/asterisk?view=rev&rev=118645
Log:
Merged revisions 118644 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
r118644 | phsultan | 2008-05-28 16:10:48 +0200 (Wed, 28 May 2008) | 10 lines

Changed to temporary namespaces to match with latest XEPs. As soon as
Jingle is completely standardized, we can set those namespaces to their
final values.

Added two attributes to the jingle_pvt struct to store the content
name attributes. Reported by Robert McQueen on Telepathy's framework
mailing list :
http://lists.freedesktop.org/archives/telepathy/2008-May/001971.html

Keeping working on our Jingle stack!
........

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/channels/chan_jingle.c
    branches/1.6.0/include/asterisk/jingle.h

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/channels/chan_jingle.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/channels/chan_jingle.c?view=diff&rev=118645&r1=118644&r2=118645
==============================================================================
--- branches/1.6.0/channels/chan_jingle.c (original)
+++ branches/1.6.0/channels/chan_jingle.c Wed May 28 09:13:16 2008
@@ -111,7 +111,9 @@
 	char cid_name[80];               /*!< Caller ID name */
 	char exten[80];                  /*!< Called extension */
 	struct ast_channel *owner;       /*!< Master Channel */
+	char audio_content_name[100];    /*!< name attribute of content tag */
 	struct ast_rtp *rtp;             /*!< RTP audio session */
+	char video_content_name[100];    /*!< name attribute of content tag */
 	struct ast_rtp *vrtp;            /*!< RTP video session */
 	int jointcapability;             /*!< Supported capability at both ends (codecs ) */
 	int peercapability;
@@ -955,7 +957,7 @@
 	struct jingle_pvt *p, *tmp = client->p;
 	struct ast_channel *chan;
 	int res;
-	iks *codec;
+	iks *codec, *content, *description;
 
 	/* Make sure our new call doesn't exist yet */
 	while (tmp) {
@@ -984,14 +986,41 @@
 				sizeof(p->sid));
 	}
 	
-	/* codec points to the first <payload-type/> tag */	
-	codec = iks_child(iks_child(iks_child(iks_child(pak->x))));
-	while (codec) {
-		ast_rtp_set_m_type(p->rtp, atoi(iks_find_attrib(codec, "id")));
-		ast_rtp_set_rtpmap_type(p->rtp, atoi(iks_find_attrib(codec, "id")), "audio", iks_find_attrib(codec, "name"), 0);
-		codec = iks_next(codec);
-	}
-	
+	/* content points to the first <content/> tag */	
+	content = iks_child(iks_child(pak->x));
+	while (content) {
+		description = iks_find_with_attrib(content, "description", "xmlns", JINGLE_AUDIO_RTP_NS);
+		if (description) {
+			/* audio content found */
+			codec = iks_child(iks_child(content));
+		        ast_copy_string(p->audio_content_name, iks_find_attrib(content, "name"), sizeof(p->audio_content_name));
+
+			while (codec) {
+				ast_rtp_set_m_type(p->rtp, atoi(iks_find_attrib(codec, "id")));
+				ast_rtp_set_rtpmap_type(p->rtp, atoi(iks_find_attrib(codec, "id")), "audio", iks_find_attrib(codec, "name"), 0);
+				codec = iks_next(codec);
+			}
+		}
+		
+		description = NULL;
+		codec = NULL;
+
+		description = iks_find_with_attrib(content, "description", "xmlns", JINGLE_VIDEO_RTP_NS);
+		if (description) {
+			/* video content found */
+			codec = iks_child(iks_child(content));
+		        ast_copy_string(p->video_content_name, iks_find_attrib(content, "name"), sizeof(p->video_content_name));
+
+			while (codec) {
+				ast_rtp_set_m_type(p->rtp, atoi(iks_find_attrib(codec, "id")));
+				ast_rtp_set_rtpmap_type(p->rtp, atoi(iks_find_attrib(codec, "id")), "audio", iks_find_attrib(codec, "name"), 0);
+				codec = iks_next(codec);
+			}
+		}
+		
+		content = iks_next(content);
+	}
+
 	ast_mutex_unlock(&p->lock);
 	ast_setstate(chan, AST_STATE_RING);
 	res = ast_pbx_start(chan);
@@ -1317,6 +1346,8 @@
 	payload_pcmu = iks_new("payload-type");
 	payload_eg711u = iks_new("payload-type");
 
+	ast_copy_string(p->audio_content_name, "asterisk-audio-content", sizeof(p->audio_content_name));
+
 	iks_insert_attrib(iq, "type", "set");
 	iks_insert_attrib(iq, "to", p->them);
 	iks_insert_attrib(iq, "from", client->jid->full);
@@ -1326,8 +1357,10 @@
 	iks_insert_attrib(jingle, JINGLE_SID, p->sid);
 	iks_insert_attrib(jingle, "initiator", client->jid->full);
 	iks_insert_attrib(jingle, "xmlns", JINGLE_NS);
+
+	/* For now, we only send one audio based content */
 	iks_insert_attrib(content, "creator", "initiator");
-	iks_insert_attrib(content, "name", "asterisk-audio-content");
+	iks_insert_attrib(content, "name", p->audio_content_name);
 	iks_insert_attrib(content, "profile", "RTP/AVP");
 	iks_insert_attrib(description, "xmlns", JINGLE_AUDIO_RTP_NS);
 	iks_insert_attrib(transport, "xmlns", JINGLE_ICE_UDP_NS);
@@ -1335,7 +1368,6 @@
 	iks_insert_attrib(payload_pcmu, "name", "PCMU");
 	iks_insert_attrib(payload_eg711u, "id", "100");
 	iks_insert_attrib(payload_eg711u, "name", "EG711U");
-
 	iks_insert_node(description, payload_pcmu);
 	iks_insert_node(description, payload_eg711u);
 	iks_insert_node(content, description);

Modified: branches/1.6.0/include/asterisk/jingle.h
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/include/asterisk/jingle.h?view=diff&rev=118645&r1=118644&r2=118645
==============================================================================
--- branches/1.6.0/include/asterisk/jingle.h (original)
+++ branches/1.6.0/include/asterisk/jingle.h Wed May 28 09:13:16 2008
@@ -37,11 +37,12 @@
 #define JINGLE_NODE "jingle"
 #define GOOGLE_NODE "session"
 
-#define JINGLE_NS "http://www.xmpp.org/extensions/xep-0166.html#ns"
-#define JINGLE_AUDIO_RTP_NS "http://www.xmpp.org/extensions/xep-0167.html#ns"
-#define JINGLE_ICE_UDP_NS "http://www.xmpp.org/extensions/xep-0176.html#ns-udp"
-#define JINGLE_DTMF_NS "http://www.xmpp.org/extensions/xep-0181.html#ns"
-#define JINGLE_DTMF_NS_ERRORS "http://www.xmpp.org/extensions/xep-0181.html#ns-errors"
+#define JINGLE_NS "urn:xmpp:tmp:jingle"
+#define JINGLE_AUDIO_RTP_NS "urn:xmpp:tmp:jingle:apps:audio-rtp"
+#define JINGLE_VIDEO_RTP_NS "urn:xmpp:tmp:jingle:apps:video"
+#define JINGLE_ICE_UDP_NS "urn:xmpp:tmp:jingle:transports:ice-udp"
+#define JINGLE_DTMF_NS "urn:xmpp:tmp:jingle:dtmf"
+
 #define GOOGLE_NS "http://www.google.com/session"
 
 #define JINGLE_SID "sid"




More information about the asterisk-commits mailing list