aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_gtalk.c
diff options
context:
space:
mode:
authorphsultan <phsultan@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-24 11:49:36 +0000
committerphsultan <phsultan@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-24 11:49:36 +0000
commita742ddbae5b58889f9b4d4d4a28b12cf387f0b7c (patch)
tree296a7e33ba768c20f58e53126b0316b1f00ed4ae /channels/chan_gtalk.c
parent652b0b33acb626aee657d9429c40b34c928ddf3e (diff)
Merged revisions 80661 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r80661 | phsultan | 2007-08-24 13:42:46 +0200 (Fri, 24 Aug 2007) | 9 lines Closes issue #10509 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: http://svn.digium.com/svn/asterisk/trunk@80662 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_gtalk.c')
-rw-r--r--channels/chan_gtalk.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/channels/chan_gtalk.c b/channels/chan_gtalk.c
index 22d8a29b6..42e8401a0 100644
--- a/channels/chan_gtalk.c
+++ b/channels/chan_gtalk.c
@@ -622,6 +622,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;
@@ -1571,8 +1595,10 @@ static int gtalk_parser(void *data, ikspak *pak)
ast_debug(3, "About to add candidate!\n");
gtalk_add_candidate(client, pak);
ast_debug(3, "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")) {