aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_gtalk.c
diff options
context:
space:
mode:
authorqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-02-21 20:27:08 +0000
committerqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-02-21 20:27:08 +0000
commita3a21c937074e52d17ffc84e7c07b0aab6b5bf36 (patch)
tree34a59b82b150ccabc925487ddb545fbdcf175ae9 /channels/chan_gtalk.c
parent24a8aab4de415da7b0ddad12a6a8b03068f9f0f4 (diff)
Fix locking issue, and accept "transport-accept" as a valid accept message.
This should solve issues 8970 and 8503. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@55954 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_gtalk.c')
-rw-r--r--channels/chan_gtalk.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/channels/chan_gtalk.c b/channels/chan_gtalk.c
index c3ba0d9f1..509f7f436 100644
--- a/channels/chan_gtalk.c
+++ b/channels/chan_gtalk.c
@@ -257,6 +257,7 @@ static struct gtalk *find_gtalk(char *name, char *connection)
{
struct gtalk *gtalk = NULL;
char *domain = NULL , *s = NULL;
+
if(strchr(connection, '@')) {
s = ast_strdupa(connection);
domain = strsep(&s, "@");
@@ -268,20 +269,20 @@ static struct gtalk *find_gtalk(char *name, char *connection)
if (!gtalk) { /* guest call */
ASTOBJ_CONTAINER_TRAVERSE(&gtalk_list, 1, {
- ASTOBJ_WRLOCK(iterator);
+ ASTOBJ_RDLOCK(iterator);
if (!strcasecmp(iterator->name, "guest")) {
if (!strcasecmp(iterator->connection->jid->partial, connection)) {
gtalk = iterator;
- break;
} else if (!strcasecmp(iterator->connection->name, connection)) {
gtalk = iterator;
- break;
} else if (iterator->connection->component && !strcasecmp(iterator->connection->user,domain)) {
gtalk = iterator;
- break;
}
}
ASTOBJ_UNLOCK(iterator);
+
+ if (gtalk)
+ break;
});
}
@@ -1490,10 +1491,12 @@ static struct ast_channel *gtalk_request(const char *type, int format, void *dat
ast_log(LOG_WARNING, "Could not find recipient.\n");
return NULL;
}
+ ASTOBJ_WRLOCK(client);
p = gtalk_alloc(client, strchr(sender, '@') ? sender : client->connection->jid->full, strchr(to, '@') ? to : client->user, NULL);
if (p)
chan = gtalk_new(client, p, AST_STATE_DOWN, to);
+ ASTOBJ_UNLOCK(client);
return chan;
}
@@ -1523,13 +1526,13 @@ static int gtalk_parser(void *data, ikspak *pak)
if (iks_find_with_attrib(pak->x, "session", "type", "initiate")) {
/* New call */
gtalk_newcall(client, pak);
- } else if (iks_find_with_attrib(pak->x, "session", "type", "candidates") || iks_find_with_attrib(pak->x, "session", "type", "transport-info") ) {
+ } else if (iks_find_with_attrib(pak->x, "session", "type", "candidates") || iks_find_with_attrib(pak->x, "session", "type", "transport-info")) {
if (option_debug > 2)
ast_log(LOG_DEBUG, "About to add candidate!\n");
gtalk_add_candidate(client, pak);
if (option_debug > 2)
ast_log(LOG_DEBUG, "Candidate Added!\n");
- } else if (iks_find_with_attrib(pak->x, "session", "type", "accept")) {
+ } else if (iks_find_with_attrib(pak->x, "session", "type", "accept") || iks_find_with_attrib(pak->x, "session", "type", "transport-accept")) {
gtalk_is_answered(client, pak);
} else if (iks_find_with_attrib(pak->x, "session", "type", "content-info")) {
gtalk_handle_dtmf(client, pak);