]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Closes issue #10509
authorPhilippe Sultan <philippe.sultan@gmail.com>
Fri, 24 Aug 2007 11:42:46 +0000 (11:42 +0000)
committerPhilippe Sultan <philippe.sultan@gmail.com>
Fri, 24 Aug 2007 11:42:46 +0000 (11:42 +0000)
Googletalk calls are answered too early, which results in CDRs wrongly
stating that a call was ANSWERED when the calling party cancelled a
call before before being established.

We must not answer the call upon reception of a 'transport-accept' iq
packet, but this packet still needs to be acknowledged, otherwise the
remote peer would close the call (like in #8970).

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@80661 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_gtalk.c

index 1e13521fd14b88f1aa8a8054572351e2dc31a59d..3f25acd6af13470a6997773b1e55cd74bfdb9b9e 100644 (file)
@@ -623,6 +623,30 @@ static int gtalk_is_answered(struct gtalk *client, ikspak *pak)
        return 1;
 }
 
+static int gtalk_is_accepted(struct gtalk *client, ikspak *pak)
+{
+       struct gtalk_pvt *tmp;
+       char *from;
+
+       ast_log(LOG_DEBUG, "The client is %s\n", client->name);
+       /* find corresponding call */
+       for (tmp = client->p; tmp; tmp = tmp->next) {
+               if (iks_find_with_attrib(pak->x, "session", "id", tmp->sid))
+                       break;
+       }
+
+       from = iks_find_attrib(pak->x, "to");
+       if(!from)
+               from = client->connection->jid->full;
+
+       if (!tmp)
+               ast_log(LOG_NOTICE, "Whoa, didn't find call!\n");
+
+       /* answer 'iq' packet to let the remote peer know that we're alive */
+       gtalk_response(client, from, pak, NULL, NULL);
+       return 1;
+}
+
 static int gtalk_handle_dtmf(struct gtalk *client, ikspak *pak)
 {
        struct gtalk_pvt *tmp;
@@ -1568,8 +1592,10 @@ static int gtalk_parser(void *data, ikspak *pak)
                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") || iks_find_with_attrib(pak->x, "session", "type", "transport-accept")) {
+       } else if (iks_find_with_attrib(pak->x, "session", "type", "accept")) {
                gtalk_is_answered(client, pak);
+       } else if (iks_find_with_attrib(pak->x, "session", "type", "transport-accept")) {
+               gtalk_is_accepted(client, pak);
        } else if (iks_find_with_attrib(pak->x, "session", "type", "content-info")) {
                gtalk_handle_dtmf(client, pak);
        } else if (iks_find_with_attrib(pak->x, "session", "type", "terminate")) {