mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-27 06:31:54 +00:00
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/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@318868 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -3448,6 +3448,7 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast
|
|||||||
struct ast_cdr *new_chan_cdr = NULL; /* the proper chan cdr, if there are forked cdrs */
|
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_cdr *new_peer_cdr = NULL; /* the proper chan cdr, if there are forked cdrs */
|
||||||
struct ast_silence_generator *silgen = NULL;
|
struct ast_silence_generator *silgen = NULL;
|
||||||
|
const char *h_context;
|
||||||
|
|
||||||
if (chan && peer) {
|
if (chan && peer) {
|
||||||
pbx_builtin_setvar_helper(chan, "BRIDGEPEER", peer->name);
|
pbx_builtin_setvar_helper(chan, "BRIDGEPEER", peer->name);
|
||||||
@@ -3843,12 +3844,23 @@ before_you_go:
|
|||||||
* if it were, then chan belongs to a different thread now, and might have been hung up long
|
* if it were, then chan belongs to a different thread now, and might have been hung up long
|
||||||
* ago.
|
* ago.
|
||||||
*/
|
*/
|
||||||
if (!ast_test_flag(&(config->features_caller),AST_FEATURE_NO_H_EXTEN)
|
if (ast_test_flag(&config->features_caller, AST_FEATURE_NO_H_EXTEN)) {
|
||||||
&& ast_exists_extension(chan, chan->context, "h", 1,
|
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))) {
|
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;
|
struct ast_cdr *swapper = NULL;
|
||||||
char savelastapp[AST_MAX_EXTENSION];
|
char savelastapp[AST_MAX_EXTENSION];
|
||||||
char savelastdata[AST_MAX_EXTENSION];
|
char savelastdata[AST_MAX_EXTENSION];
|
||||||
|
char save_context[AST_MAX_CONTEXT];
|
||||||
char save_exten[AST_MAX_EXTENSION];
|
char save_exten[AST_MAX_EXTENSION];
|
||||||
int save_prio;
|
int save_prio;
|
||||||
int found = 0; /* set if we find at least one match */
|
int found = 0; /* set if we find at least one match */
|
||||||
@@ -3869,8 +3881,12 @@ before_you_go:
|
|||||||
ast_copy_string(savelastdata, bridge_cdr->lastdata, sizeof(bridge_cdr->lastdata));
|
ast_copy_string(savelastdata, bridge_cdr->lastdata, sizeof(bridge_cdr->lastdata));
|
||||||
chan->cdr = bridge_cdr;
|
chan->cdr = bridge_cdr;
|
||||||
}
|
}
|
||||||
|
ast_copy_string(save_context, chan->context, sizeof(save_context));
|
||||||
ast_copy_string(save_exten, chan->exten, sizeof(save_exten));
|
ast_copy_string(save_exten, chan->exten, sizeof(save_exten));
|
||||||
save_prio = chan->priority;
|
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));
|
ast_copy_string(chan->exten, "h", sizeof(chan->exten));
|
||||||
chan->priority = 1;
|
chan->priority = 1;
|
||||||
ast_channel_unlock(chan);
|
ast_channel_unlock(chan);
|
||||||
@@ -3889,6 +3905,7 @@ before_you_go:
|
|||||||
|
|
||||||
/* swap it back */
|
/* swap it back */
|
||||||
ast_channel_lock(chan);
|
ast_channel_lock(chan);
|
||||||
|
ast_copy_string(chan->context, save_context, sizeof(chan->context));
|
||||||
ast_copy_string(chan->exten, save_exten, sizeof(chan->exten));
|
ast_copy_string(chan->exten, save_exten, sizeof(chan->exten));
|
||||||
chan->priority = save_prio;
|
chan->priority = save_prio;
|
||||||
if (bridge_cdr) {
|
if (bridge_cdr) {
|
||||||
|
|||||||
Reference in New Issue
Block a user