[asterisk-commits] murf: branch murf/cdr-debug-1.4 r175128 - in /team/murf/cdr-debug-1.4: ./ app...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Feb 12 11:07:49 CST 2009
Author: murf
Date: Thu Feb 12 11:07:48 2009
New Revision: 175128
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=175128
Log:
Merged revisions 174885,174985-174986,174997,175029,175124 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r174885 | tilghman | 2009-02-11 13:54:18 -0700 (Wed, 11 Feb 2009) | 13 lines
Restore a behavior that was recently changed, when we fixed issue #13962 and
issue #13363 (related to issue #6176). When a hangup occurs during a Macro
execution in earlier 1.4, the h extension would execute within the Macro
context, whereas it was always supposed to execute only within the main context
(where Macro was called). So this fix checks for an "h" extension in the
deepest macro context where a hangup occurred; if it exists, that "h" extension
executes, otherwise the main context "h" is executed.
(closes issue #14122)
Reported by: wetwired
Patches:
20090210__bug14122.diff.txt uploaded by Corydon76 (license 14)
Tested by: andrew
........
r174985 | russell | 2009-02-11 16:56:37 -0700 (Wed, 11 Feb 2009) | 2 lines
Fixify infinite DTMF in the case that no RFC2833 END event is ever received
........
r174986 | russell | 2009-02-11 17:01:02 -0700 (Wed, 11 Feb 2009) | 2 lines
Clear out the current event after forcing the end of a digit
........
r174997 | file | 2009-02-11 17:19:30 -0700 (Wed, 11 Feb 2009) | 2 lines
Revert RTP changes for continuation of DTMF. Proxy commit by russell via SMS.
........
r175029 | phsultan | 2009-02-12 03:16:21 -0700 (Thu, 12 Feb 2009) | 12 lines
Set the initiator attribute to lowercase in our replies when receiving calls.
This attribute contains a JID that identifies the initiator of the GoogleTalk
voice session. The GoogleTalk client discards Asterisk's replies if the
initiator attribute contains uppercase characters.
(closes issue #13984)
Reported by: jcovert
Patches:
chan_gtalk.2.patch uploaded by jcovert (license 551)
Tested by: jcovert
........
r175124 | russell | 2009-02-12 09:51:13 -0700 (Thu, 12 Feb 2009) | 27 lines
Don't send DTMF for infinite time if we do not receive an END event.
I thought that this was going to end up being a pretty gnarly fix, but it turns
out that there was actually already a configuration option in rtp.conf,
dtmftimeout, that was intended to handle this situation. However, in between
Asterisk 1.2 and Asterisk 1.4, the code that processed the option got lost.
So, this commit brings it back to life.
The default timeout is 3 seconds. However, it is worth noting that having
this be configurable at all is not really the recommended behavior in RFC 2833.
From Section 3.5 of RFC 2833:
Limiting the time period of extending the tone is necessary
to avoid that a tone "gets stuck". Regardless of the
algorithm used, the tone SHOULD NOT be extended by more than
three packet interarrival times. A slight extension of tone
durations and shortening of pauses is generally harmless.
Three seconds will pretty much _always_ be far more than three packet
interarrival times. However, that behavior is not required, so I'm going to
leave it with our legacy behavior for now.
Code from svn/asterisk/team/russell/issue_14460
(closes issue #14460)
Reported by: moliveras
........
Modified:
team/murf/cdr-debug-1.4/ (props changed)
team/murf/cdr-debug-1.4/apps/app_macro.c
team/murf/cdr-debug-1.4/channels/chan_gtalk.c
team/murf/cdr-debug-1.4/main/pbx.c
team/murf/cdr-debug-1.4/main/rtp.c
Propchange: team/murf/cdr-debug-1.4/
------------------------------------------------------------------------------
automerge = yes
Propchange: team/murf/cdr-debug-1.4/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Feb 12 11:07:48 2009
@@ -1,1 +1,1 @@
-/branches/1.4:1-174669
+/branches/1.4:1-175125
Modified: team/murf/cdr-debug-1.4/apps/app_macro.c
URL: http://svn.digium.com/svn-view/asterisk/team/murf/cdr-debug-1.4/apps/app_macro.c?view=diff&rev=175128&r1=175127&r2=175128
==============================================================================
--- team/murf/cdr-debug-1.4/apps/app_macro.c (original)
+++ team/murf/cdr-debug-1.4/apps/app_macro.c Thu Feb 12 11:07:48 2009
@@ -477,6 +477,23 @@
chan->macropriority = 0;
}
+ /*!\note
+ * This section is used to restore a behavior that we mistakenly
+ * changed in issue #6176, then mistakenly reverted in #13962 and
+ * #13363. A corresponding change is made in main/pbx.c, where we
+ * check this variable for existence, then look for the "h" extension
+ * in that context.
+ */
+ if (ast_check_hangup(chan) || res < 0) {
+ /* Don't need to lock the channel, as we aren't dereferencing emc.
+ * The intent here is to grab the deepest context, without overwriting
+ * in any above context. */
+ const char *emc = pbx_builtin_getvar_helper(chan, "EXIT_MACRO_CONTEXT");
+ if (!emc) {
+ pbx_builtin_setvar_helper(chan, "EXIT_MACRO_CONTEXT", fullmacro);
+ }
+ }
+
if (!strcasecmp(chan->context, fullmacro)) {
/* If we're leaving the macro normally, restore original information */
chan->priority = oldpriority;
Modified: team/murf/cdr-debug-1.4/channels/chan_gtalk.c
URL: http://svn.digium.com/svn-view/asterisk/team/murf/cdr-debug-1.4/channels/chan_gtalk.c?view=diff&rev=175128&r1=175127&r2=175128
==============================================================================
--- team/murf/cdr-debug-1.4/channels/chan_gtalk.c (original)
+++ team/murf/cdr-debug-1.4/channels/chan_gtalk.c Thu Feb 12 11:07:48 2009
@@ -49,6 +49,7 @@
#include <sys/signal.h>
#include <iksemel.h>
#include <pthread.h>
+#include <ctype.h>
#ifdef HAVE_GNUTLS
#include <gcrypt.h>
@@ -411,6 +412,7 @@
int pref_codec = 0;
int alreadysent = 0;
int codecs_num = 0;
+ char *lowerto = NULL;
iq = iks_new("iq");
gtalk = iks_new("session");
@@ -462,7 +464,14 @@
iks_insert_attrib(gtalk, "xmlns", "http://www.google.com/session");
iks_insert_attrib(gtalk, "type",initiator ? "initiate": "accept");
- iks_insert_attrib(gtalk, "initiator", initiator ? from : to);
+ /* put the initiator attribute to lower case if we receive the call
+ * otherwise GoogleTalk won't establish the session */
+ if (!initiator) {
+ char c;
+ char *t = lowerto = ast_strdupa(to);
+ while (((c = *t) != '/') && (*t++ = tolower(c)));
+ }
+ iks_insert_attrib(gtalk, "initiator", initiator ? from : lowerto);
iks_insert_attrib(gtalk, "id", sid);
iks_insert_node(iq, gtalk);
iks_insert_node(gtalk, dcodecs);
@@ -481,6 +490,8 @@
static int gtalk_invite_response(struct gtalk_pvt *p, char *to , char *from, char *sid, int initiator)
{
iks *iq, *session, *transport;
+ char *lowerto = NULL;
+
iq = iks_new("iq");
session = iks_new("session");
transport = iks_new("transport");
@@ -501,7 +512,14 @@
ast_aji_increment_mid(p->parent->connection->mid);
iks_insert_attrib(session, "type", "transport-accept");
iks_insert_attrib(session, "id", sid);
- iks_insert_attrib(session, "initiator", initiator ? from : to);
+ /* put the initiator attribute to lower case if we receive the call
+ * otherwise GoogleTalk won't establish the session */
+ if (!initiator) {
+ char c;
+ char *t = lowerto = ast_strdupa(to);
+ while (((c = *t) != '/') && (*t++ = tolower(c)));
+ }
+ iks_insert_attrib(session, "initiator", initiator ? from : lowerto);
iks_insert_attrib(session, "xmlns", "http://www.google.com/session");
iks_insert_attrib(transport, "xmlns", "http://www.google.com/transport/p2p");
iks_insert_node(iq,session);
@@ -795,6 +813,7 @@
struct in_addr us;
iks *iq, *gtalk, *candidate, *transport;
char user[17], pass[17], preference[5], port[7];
+ char *lowerfrom = NULL;
iq = iks_new("iq");
@@ -873,7 +892,14 @@
ast_aji_increment_mid(c->mid);
iks_insert_attrib(gtalk, "type", "transport-info");
iks_insert_attrib(gtalk, "id", sid);
- iks_insert_attrib(gtalk, "initiator", (p->initiator) ? to : from);
+ /* put the initiator attribute to lower case if we receive the call
+ * otherwise GoogleTalk won't establish the session */
+ if (!p->initiator) {
+ char c;
+ char *t = lowerfrom = ast_strdupa(from);
+ while (((c = *t) != '/') && (*t++ = tolower(c)));
+ }
+ iks_insert_attrib(gtalk, "initiator", (p->initiator) ? to : lowerfrom);
iks_insert_attrib(gtalk, "xmlns", GOOGLE_NS);
iks_insert_attrib(candidate, "name", tmp->name);
iks_insert_attrib(candidate, "address", tmp->ip);
@@ -1074,6 +1100,7 @@
{
iks *request, *session = NULL;
int res = -1;
+ char *lowerthem = NULL;
request = iks_new("iq");
if (request) {
@@ -1086,7 +1113,14 @@
if (session) {
iks_insert_attrib(session, "type", action);
iks_insert_attrib(session, "id", p->sid);
- iks_insert_attrib(session, "initiator", p->initiator ? p->us : p->them);
+ /* put the initiator attribute to lower case if we receive the call
+ * otherwise GoogleTalk won't establish the session */
+ if (!p->initiator) {
+ char c;
+ char *t = lowerthem = ast_strdupa(p->them);
+ while (((c = *t) != '/') && (*t++ = tolower(c)));
+ }
+ iks_insert_attrib(session, "initiator", p->initiator ? p->us : lowerthem);
iks_insert_attrib(session, "xmlns", "http://www.google.com/session");
iks_insert_node(request, session);
iks_send(client->connection->p, request);
@@ -1500,6 +1534,7 @@
struct gtalk *client = p->parent;
iks *iq, *gtalk, *dtmf;
char buffer[2] = {digit, '\0'};
+ char *lowerthem = NULL;
iq = iks_new("iq");
gtalk = iks_new("gtalk");
dtmf = iks_new("dtmf");
@@ -1521,7 +1556,14 @@
ast_aji_increment_mid(client->connection->mid);
iks_insert_attrib(gtalk, "xmlns", "http://jabber.org/protocol/gtalk");
iks_insert_attrib(gtalk, "action", "session-info");
- iks_insert_attrib(gtalk, "initiator", p->initiator ? p->us: p->them);
+ /* put the initiator attribute to lower case if we receive the call
+ * otherwise GoogleTalk won't establish the session */
+ if (!p->initiator) {
+ char c;
+ char *t = lowerthem = ast_strdupa(p->them);
+ while (((c = *t) != '/') && (*t++ = tolower(c)));
+ }
+ iks_insert_attrib(gtalk, "initiator", p->initiator ? p->us: lowerthem);
iks_insert_attrib(gtalk, "sid", p->sid);
iks_insert_attrib(dtmf, "xmlns", "http://jabber.org/protocol/gtalk/info/dtmf");
iks_insert_attrib(dtmf, "code", buffer);
Modified: team/murf/cdr-debug-1.4/main/pbx.c
URL: http://svn.digium.com/svn-view/asterisk/team/murf/cdr-debug-1.4/main/pbx.c?view=diff&rev=175128&r1=175127&r2=175128
==============================================================================
--- team/murf/cdr-debug-1.4/main/pbx.c (original)
+++ team/murf/cdr-debug-1.4/main/pbx.c Thu Feb 12 11:07:48 2009
@@ -2367,6 +2367,7 @@
int res = 0;
int autoloopflag;
int error = 0; /* set an error conditions */
+ const char *emc;
/* A little initial setup here */
if (c->pbx) {
@@ -2548,7 +2549,15 @@
if (res != AST_PBX_KEEPALIVE)
ast_softhangup(c, c->hangupcause ? c->hangupcause : AST_CAUSE_NORMAL_CLEARING);
ast_log(LOG_NOTICE,"==== in PBX LOOP: About to consider the H extension\n");
- if ((res != AST_PBX_KEEPALIVE) && !ast_test_flag(c, AST_FLAG_BRIDGE_HANGUP_RUN) && ast_exists_extension(c, c->context, "h", 1, c->cid.cid_num)) {
+ ast_channel_lock(c);
+ if ((emc = pbx_builtin_getvar_helper(c, "EXIT_MACRO_CONTEXT"))) {
+ emc = ast_strdupa(emc);
+ }
+ ast_channel_unlock(c);
+ if ((res != AST_PBX_KEEPALIVE) && !ast_test_flag(c, AST_FLAG_BRIDGE_HANGUP_RUN) &&
+ ((emc && ast_exists_extension(c, emc, "h", 1, c->cid.cid_num)) ||
+ (ast_exists_extension(c, c->context, "h", 1, c->cid.cid_num) && (emc = c->context)))) {
+ ast_copy_string(c->context, emc, sizeof(c->context));
set_ext_pri(c, "h", 1);
if (c->cdr && ast_opt_end_cdr_before_h_exten) {
ast_cdr_end(c->cdr);
Modified: team/murf/cdr-debug-1.4/main/rtp.c
URL: http://svn.digium.com/svn-view/asterisk/team/murf/cdr-debug-1.4/main/rtp.c?view=diff&rev=175128&r1=175127&r2=175128
==============================================================================
--- team/murf/cdr-debug-1.4/main/rtp.c (original)
+++ team/murf/cdr-debug-1.4/main/rtp.c Thu Feb 12 11:07:48 2009
@@ -1298,6 +1298,21 @@
/* Record received timestamp as last received now */
rtp->lastrxts = timestamp;
+
+ if (rtp->dtmfcount) {
+ rtp->dtmfcount -= (timestamp - rtp->lastrxts);
+
+ if (rtp->dtmfcount < 0) {
+ rtp->dtmfcount = 0;
+ }
+
+ if (rtp->resp && !rtp->dtmfcount) {
+ struct ast_frame *f;
+ f = send_dtmf(rtp, AST_FRAME_DTMF_END);
+ rtp->resp = 0;
+ return f;
+ }
+ }
rtp->f.mallocd = 0;
rtp->f.datalen = res - hdrlen;
More information about the asterisk-commits
mailing list