[asterisk-commits] phsultan: branch phsultan/jingle-support r229907 - in /team/phsultan/jingle-s...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Nov 13 05:39:42 CST 2009


Author: phsultan
Date: Fri Nov 13 05:39:39 2009
New Revision: 229907

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=229907
Log:
Fix advertized content and send our Jingle features list when asked.

Modified:
    team/phsultan/jingle-support/channels/chan_jingle.c
    team/phsultan/jingle-support/res/res_jabber.c

Modified: team/phsultan/jingle-support/channels/chan_jingle.c
URL: http://svnview.digium.com/svn/asterisk/team/phsultan/jingle-support/channels/chan_jingle.c?view=diff&rev=229907&r1=229906&r2=229907
==============================================================================
--- team/phsultan/jingle-support/channels/chan_jingle.c (original)
+++ team/phsultan/jingle-support/channels/chan_jingle.c Fri Nov 13 05:39:39 2009
@@ -411,7 +411,7 @@
 	iks_insert_attrib(jingle, JINGLE_SID, tmp->sid);
 
 	iks_insert_attrib(content, "creator", "initiator");
-	iks_insert_attrib(content, "name", "A");
+	iks_insert_attrib(content, "name", p->audio_content_name);
 	iks_insert_attrib(content, "senders", "both");
 
 	/* insert nodes */

Modified: team/phsultan/jingle-support/res/res_jabber.c
URL: http://svnview.digium.com/svn/asterisk/team/phsultan/jingle-support/res/res_jabber.c?view=diff&rev=229907&r1=229906&r2=229907
==============================================================================
--- team/phsultan/jingle-support/res/res_jabber.c (original)
+++ team/phsultan/jingle-support/res/res_jabber.c Fri Nov 13 05:39:39 2009
@@ -1758,12 +1758,16 @@
 		} else
 			resource->cap->jingle = 0;
 	} else if (pak->subtype == IKS_TYPE_GET) {
-		iks *iq, *disco, *ident, *google, *query;
+		iks *iq, *disco, *ident, *google, *query, *jingle, *jingletransport, *jingleappsrtp, *jingleappsrtpaudio;
 		iq = iks_new("iq");
 		query = iks_new("query");
 		ident = iks_new("identity");
 		disco = iks_new("feature");
 		google = iks_new("feature");
+		jingle = iks_new("feature");
+		jingletransport = iks_new("feature");
+		jingleappsrtp = iks_new("feature");
+		jingleappsrtpaudio = iks_new("feature");
 		if (iq && ident && disco && google) {
 			iks_insert_attrib(iq, "from", client->jid->full);
 			iks_insert_attrib(iq, "to", pak->from->full);
@@ -1775,9 +1779,17 @@
 			iks_insert_attrib(ident, "name", "asterisk");
 			iks_insert_attrib(disco, "var", "http://jabber.org/protocol/disco#info");
 			iks_insert_attrib(google, "var", "http://www.google.com/xmpp/protocol/voice/v1");
+			iks_insert_attrib(jingle, "var", "urn:xmpp:jingle:1");
+			iks_insert_attrib(jingletransport, "var", "urn:xmpp:jingle:transports:ice-udp:1");
+			iks_insert_attrib(jingleappsrtp, "var", "urn:xmpp:jingle:apps:rtp:1");
+			iks_insert_attrib(jingleappsrtpaudio, "var", "urn:xmpp:jingle:apps:rtp:audio");
 			iks_insert_node(iq, query);
 			iks_insert_node(query, ident);
 			iks_insert_node(query, google);
+			iks_insert_node(query, jingle);
+			iks_insert_node(query, jingletransport);
+			iks_insert_node(query, jingleappsrtp);
+			iks_insert_node(query, jingleappsrtpaudio);
 			iks_insert_node(query, disco);
 			ast_aji_send(client, iq);
 		} else
@@ -2833,6 +2845,24 @@
 	iks *cnode = iks_new("c");
 	iks *priority = iks_new("priority");
 	char priorityS[10];
+	char buf[40];
+	char disco[] = "http://jabber.org/protocol/disco#info";
+	char google[] = "http://www.google.com/xmpp/protocol/voice/v1";
+	char jingle[] = "urn:xmpp:jingle:1";
+	char jingleiceudp[] = "urn:xmpp:jingle:transports:ice-udp:1";
+	char jingleappsrtp[] = "urn:xmpp:jingle:apps:rtp:1";
+	char jingleappsrtpaudio[] = "urn:xmpp:jingle:apps:rtp:audio";
+	char features[6*256];
+	//uint8_t sha1[20];
+
+	/* compute capabilities hash according to XEP-115 */
+	snprintf(features, sizeof(features), "%s<%s<%s<%s<%s<%s", disco, google, jingle, jingleiceudp, jingleappsrtp, jingleappsrtpaudio);
+
+	/* cannot use ast_sha1_hash since we need a 20 bytes output according
+	 * to XEP-115 */
+	//ast_sha1_hash_raw(sha1, features);
+	//ast_base64encode(buf, (const unsigned char *)sha1, 20, 30);	
+	ast_sha1_hash(buf, features);
 
 	if (presence && cnode && client && priority) {
 		if (to)
@@ -2843,6 +2873,8 @@
 		iks_insert_cdata(priority, priorityS, strlen(priorityS));
 		iks_insert_node(presence, priority);
 		iks_insert_attrib(cnode, "node", "http://www.asterisk.org/xmpp/client/caps");
+	//	iks_insert_attrib(cnode, "hash", "sha-1");
+//		iks_insert_attrib(cnode, "ver", buf);
 		iks_insert_attrib(cnode, "ver", "asterisk-xmpp");
 		iks_insert_attrib(cnode, "ext", "voice-v1");
 		iks_insert_attrib(cnode, "xmlns", "http://jabber.org/protocol/caps");




More information about the asterisk-commits mailing list