Fixes chan_gtalk to work with gmail client

This patch was written by Philippe Sultan (phsultan). Thanks
for keeping this up to date!



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@290479 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
David Vossel
2010-10-05 22:00:43 +00:00
parent 4760667e95
commit f87133b078
4 changed files with 182 additions and 97 deletions

View File

@@ -569,8 +569,16 @@ static struct aji_resource *aji_find_resource(struct aji_buddy *buddy, char *nam
static int gtalk_yuck(iks *node)
{
if (iks_find_with_attrib(node, "c", "node", "http://www.google.com/xmpp/client/caps")) {
ast_debug(1, "Found resource with Googletalk voice capabilities\n");
return 1;
} else if (iks_find_with_attrib(node, "caps:c", "ext", "pmuc-v1 sms-v1 camera-v1 video-v1 voice-v1")) {
ast_debug(1, "Found resource with Gmail voice/video chat capabilities\n");
return 1;
} else if (iks_find_with_attrib(node, "caps:c", "ext", "pmuc-v1 sms-v1 video-v1 voice-v1")) {
ast_debug(1, "Found resource with Gmail voice/video chat capabilities (no camera)\n");
return 1;
}
return 0;
}
@@ -1577,6 +1585,23 @@ static int aji_act_hook(void *data, int type, iks *node)
pak = iks_packet(node);
/* work around iksemel's impossibility to recognize node names
* containing a semicolon. Set the namespace of the corresponding
* node accordingly. */
if (iks_has_children(node) && strchr(iks_name(iks_child(node)), ':')) {
char *node_ns = NULL;
char attr[AJI_MAX_ATTRLEN];
char *node_name = iks_name(iks_child(node));
char *aux = strchr(node_name, ':') + 1;
snprintf(attr, strlen("xmlns:") + (strlen(node_name) - strlen(aux)), "xmlns:%s", node_name);
node_ns = iks_find_attrib(iks_child(node), attr);
if (node_ns) {
pak->ns = node_ns;
pak->query = iks_child(node);
}
}
if (!client->component) { /*client */
switch (type) {
case IKS_NODE_START:
@@ -2405,7 +2430,7 @@ static void aji_handle_presence(struct aji_client *client, ikspak *pak)
if (gtalk_yuck(pak->x)) { /* gtalk should do discover */
found->cap->jingle = 1;
}
if (found->cap->jingle && option_debug > 4) {
if (found->cap->jingle) {
ast_debug(1, "Special case for google till they support discover.\n");
} else {
iks *iq, *query;