[asterisk-commits] rmudgett: branch 1.8 r318868 - /branches/1.8/main/features.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri May 13 11:28:33 CDT 2011
Author: rmudgett
Date: Fri May 13 11:28:26 2011
New Revision: 318868
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=318868
Log:
CDR's are being written immediately on caller hangup.
CDR's are being written immediately on caller hangup. The dialplan is not
able to modify it in the h exten. The h exten in the initial context is
not run before closing CDR's when the bridge is unlinked if a macro is
active and does not have an h exten.
* Make ast_bridge_call() check for an h exten in the current context and
if a macro is active then the initial context. The first h exten found is
then run before closing the CDR.
(closes issue #18212)
Reported by: leearcher
Patches:
issue18212_v1.8.patch uploaded by rmudgett (license 664)
Tested by: rmudgett
Review: https://reviewboard.asterisk.org/r/1206/
Modified:
branches/1.8/main/features.c
Modified: branches/1.8/main/features.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/features.c?view=diff&rev=318868&r1=318867&r2=318868
==============================================================================
--- branches/1.8/main/features.c (original)
+++ branches/1.8/main/features.c Fri May 13 11:28:26 2011
@@ -3448,6 +3448,7 @@
struct ast_cdr *new_chan_cdr = NULL; /* the proper chan cdr, if there are forked cdrs */
struct ast_cdr *new_peer_cdr = NULL; /* the proper chan cdr, if there are forked cdrs */
struct ast_silence_generator *silgen = NULL;
+ const char *h_context;
if (chan && peer) {
pbx_builtin_setvar_helper(chan, "BRIDGEPEER", peer->name);
@@ -3843,12 +3844,23 @@
* if it were, then chan belongs to a different thread now, and might have been hung up long
* ago.
*/
- if (!ast_test_flag(&(config->features_caller),AST_FEATURE_NO_H_EXTEN)
- && ast_exists_extension(chan, chan->context, "h", 1,
+ if (ast_test_flag(&config->features_caller, AST_FEATURE_NO_H_EXTEN)) {
+ h_context = NULL;
+ } else if (ast_exists_extension(chan, chan->context, "h", 1,
+ S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) {
+ h_context = chan->context;
+ } else if (!ast_strlen_zero(chan->macrocontext)
+ && ast_exists_extension(chan, chan->macrocontext, "h", 1,
S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) {
+ h_context = chan->macrocontext;
+ } else {
+ h_context = NULL;
+ }
+ if (h_context) {
struct ast_cdr *swapper = NULL;
char savelastapp[AST_MAX_EXTENSION];
char savelastdata[AST_MAX_EXTENSION];
+ char save_context[AST_MAX_CONTEXT];
char save_exten[AST_MAX_EXTENSION];
int save_prio;
int found = 0; /* set if we find at least one match */
@@ -3869,8 +3881,12 @@
ast_copy_string(savelastdata, bridge_cdr->lastdata, sizeof(bridge_cdr->lastdata));
chan->cdr = bridge_cdr;
}
+ ast_copy_string(save_context, chan->context, sizeof(save_context));
ast_copy_string(save_exten, chan->exten, sizeof(save_exten));
save_prio = chan->priority;
+ if (h_context != chan->context) {
+ ast_copy_string(chan->context, h_context, sizeof(chan->context));
+ }
ast_copy_string(chan->exten, "h", sizeof(chan->exten));
chan->priority = 1;
ast_channel_unlock(chan);
@@ -3889,6 +3905,7 @@
/* swap it back */
ast_channel_lock(chan);
+ ast_copy_string(chan->context, save_context, sizeof(chan->context));
ast_copy_string(chan->exten, save_exten, sizeof(chan->exten));
chan->priority = save_prio;
if (bridge_cdr) {
More information about the asterisk-commits
mailing list