[asterisk-commits] phsultan: branch phsultan/jingle-support r230420 - /team/phsultan/jingle-supp...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Nov 17 15:10:31 CST 2009
Author: phsultan
Date: Tue Nov 17 15:10:26 2009
New Revision: 230420
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=230420
Log:
Advertize our Jingle/Gtalk in presence packets, thus conforming to XEP-115.
Modified:
team/phsultan/jingle-support/res/res_jabber.c
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=230420&r1=230419&r2=230420
==============================================================================
--- team/phsultan/jingle-support/res/res_jabber.c (original)
+++ team/phsultan/jingle-support/res/res_jabber.c Tue Nov 17 15:10:26 2009
@@ -1758,17 +1758,16 @@
} else
resource->cap->jingle = 0;
} else if (pak->subtype == IKS_TYPE_GET) {
- iks *iq, *disco, *ident, *google, *query, *jingle, *jingletransport, *jingleappsrtp, *jingleappsrtpaudio;
+ iks *iq, *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) {
+ if (iq && ident && google && jingle && jingletransport && jingleappsrtp && jingleappsrtpaudio) {
iks_insert_attrib(iq, "from", client->jid->full);
iks_insert_attrib(iq, "to", pak->from->full);
iks_insert_attrib(iq, "type", "result");
@@ -1777,7 +1776,6 @@
iks_insert_attrib(ident, "category", "client");
iks_insert_attrib(ident, "type", "pc");
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");
@@ -1790,7 +1788,6 @@
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
ast_log(LOG_ERROR, "Out of Memory.\n");
@@ -1799,7 +1796,6 @@
iks_delete(query);
iks_delete(ident);
iks_delete(google);
- iks_delete(disco);
} else if (pak->subtype == IKS_TYPE_ERROR) {
ast_log(LOG_NOTICE, "User %s does not support discovery.\n", pak->from->full);
}
@@ -2845,24 +2841,6 @@
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)
@@ -2873,9 +2851,22 @@
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, "hash", "sha-1");
+ /* Our Jingle/Gtalk capabilities are advertized using the ver
+ * attribute, as described in XEP-115.
+ * The value of this attribute depends on the features that we
+ * send in reply to a disco request, that is :
+ *
+ * http://www.google.com/xmpp/protocol/voice/v1
+ * urn:xmpp:jingle:1
+ * urn:xmpp:jingle:transports:ice-udp:1
+ * urn:xmpp:jingle:apps:rtp:1
+ * urn:xmpp:jingle:apps:rtp:audio
+ *
+ * Check the aji_client_info_handler (client mode) and
+ * aji_dinfo_handler functions.
+ */
+ iks_insert_attrib(cnode, "ver", "iFFUHdNdm7GzklOonY8TEIPWcpM=");
iks_insert_attrib(cnode, "ext", "voice-v1");
iks_insert_attrib(cnode, "xmlns", "http://jabber.org/protocol/caps");
iks_insert_node(presence, cnode);
More information about the asterisk-commits
mailing list