[asterisk-commits] mjordan: trunk r394290 - in /trunk/main: bridging.c cdr.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sat Jul 13 18:28:25 CDT 2013
Author: mjordan
Date: Sat Jul 13 18:28:23 2013
New Revision: 394290
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=394290
Log:
Fix FRACK message from external redirects; handle outbound channels better
This patch does the following:
* It simplifies the Dial handling in CDRs. As a rule, the caller in a dial
relationship is always the Party A. There was some logic present in the
handling of the dial message that could, conceivably, pick the caller
as Party A for the beginning of the dial and the peer as Party A for the
end of the dial. This shouldn't have happened if the code in the bridging
framework was doing its job; however, that was broken and it led to the
FRACK. As it is, this code was overly ocmplex and not needed: the caller,
if present, should always be Party A. Period.
* It properly checks to see if a channel will continue on in the dialplan.
ast_check_hangup - much like cake at the end - is a lie. It will tell
you that you are hungup when you are not. Do not believe it.
I would make this function tell the truth, but I'm nervous that we've been
depending on it sitting on its throne of lies for far too long, and it would
probably break lots of things. So I'm just checking the "internal" soft
hangup flags, like everyone else.
(closes issue ASTERISK-22060)
Reported by: Mark Michelson
(issue ASTERISK-21831)
Reported by: Matt Jordan
Modified:
trunk/main/bridging.c
trunk/main/cdr.c
Modified: trunk/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/bridging.c?view=diff&rev=394290&r1=394289&r2=394290
==============================================================================
--- trunk/main/bridging.c (original)
+++ trunk/main/bridging.c Sat Jul 13 18:28:23 2013
@@ -707,7 +707,8 @@
* outgoing channel, clear the outgoing flag.
*/
if (ast_test_flag(ast_channel_flags(bridge_channel->chan), AST_FLAG_OUTGOING)
- && (!ast_check_hangup(bridge_channel->chan))) {
+ && (ast_channel_softhangup_internal_flag(bridge_channel->chan) &
+ (AST_SOFTHANGUP_ASYNCGOTO | AST_SOFTHANGUP_UNBRIDGE))) {
ast_clear_flag(ast_channel_flags(bridge_channel->chan), AST_FLAG_OUTGOING);
}
Modified: trunk/main/cdr.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/cdr.c?view=diff&rev=394290&r1=394289&r2=394290
==============================================================================
--- trunk/main/cdr.c (original)
+++ trunk/main/cdr.c Sat Jul 13 18:28:23 2013
@@ -918,8 +918,15 @@
if (strcmp(new_snapshot->context, old_snapshot->context)
|| strcmp(new_snapshot->exten, old_snapshot->exten)
- || new_snapshot->priority != old_snapshot->priority
- || strcmp(new_snapshot->appl, old_snapshot->appl)) {
+ || new_snapshot->priority != old_snapshot->priority) {
+ return 1;
+ }
+
+ /* When Party A is originated to an application and the application exits, the stack
+ * will attempt to clear the application and restore the dummy originate application
+ * of "AppDialX". Ignore application changes to AppDialX as a result.
+ */
+ if (strcmp(new_snapshot->appl, old_snapshot->appl) && strncasecmp(new_snapshot->appl, "appdial", 7)) {
return 1;
}
@@ -1784,15 +1791,10 @@
static void handle_dial_message(void *data, struct stasis_subscription *sub, struct stasis_topic *topic, struct stasis_message *message)
{
RAII_VAR(struct module_config *, mod_cfg, ao2_global_obj_ref(module_configs), ao2_cleanup);
- RAII_VAR(struct cdr_object *, cdr_caller, NULL, ao2_cleanup);
- RAII_VAR(struct cdr_object *, cdr_peer, NULL, ao2_cleanup);
struct cdr_object *cdr;
struct ast_multi_channel_blob *payload = stasis_message_data(message);
struct ast_channel_snapshot *caller;
struct ast_channel_snapshot *peer;
- struct ast_channel_snapshot *party_a_snapshot;
- struct ast_channel_snapshot *party_b_snapshot;
- struct cdr_object_snapshot *party_a;
struct cdr_object *it_cdr;
struct ast_json *dial_status_blob;
const char *dial_status = NULL;
@@ -1817,32 +1819,9 @@
/* Figure out who is running this show */
if (caller) {
- cdr_caller = ao2_find(active_cdrs_by_channel, caller->name, OBJ_KEY);
- }
- if (peer) {
- cdr_peer = ao2_find(active_cdrs_by_channel, peer->name, OBJ_KEY);
- }
- if (cdr_caller && cdr_peer) {
- party_a = cdr_object_pick_party_a(&cdr_caller->last->party_a, &cdr_peer->last->party_a);
- if (!strcmp(party_a->snapshot->name, cdr_caller->last->party_a.snapshot->name)) {
- cdr = cdr_caller;
- party_a_snapshot = caller;
- party_b_snapshot = peer;
- } else {
- cdr = cdr_peer;
- party_a_snapshot = peer;
- party_b_snapshot = caller;
- }
- } else if (cdr_caller) {
- cdr = cdr_caller;
- party_a_snapshot = caller;
- party_b_snapshot = NULL;
- } else if (cdr_peer) {
- cdr = cdr_peer;
- party_a_snapshot = NULL;
- party_b_snapshot = peer;
+ cdr = ao2_find(active_cdrs_by_channel, caller->name, OBJ_KEY);
} else {
- return;
+ cdr = ao2_find(active_cdrs_by_channel, peer->name, OBJ_KEY);
}
ao2_lock(cdr);
@@ -1853,22 +1832,22 @@
}
CDR_DEBUG(mod_cfg, "%p - Processing Dial Begin message for channel %s, peer %s\n",
cdr,
- party_a_snapshot ? party_a_snapshot->name : "(none)",
- party_b_snapshot ? party_b_snapshot->name : "(none)");
+ caller ? caller->name : "(none)",
+ peer ? peer->name : "(none)");
res &= it_cdr->fn_table->process_dial_begin(it_cdr,
- party_a_snapshot,
- party_b_snapshot);
+ caller,
+ peer);
} else {
if (!it_cdr->fn_table->process_dial_end) {
continue;
}
CDR_DEBUG(mod_cfg, "%p - Processing Dial End message for channel %s, peer %s\n",
cdr,
- party_a_snapshot ? party_a_snapshot->name : "(none)",
- party_b_snapshot ? party_b_snapshot->name : "(none)");
+ caller ? caller->name : "(none)",
+ peer ? peer->name : "(none)");
it_cdr->fn_table->process_dial_end(it_cdr,
- party_a_snapshot,
- party_b_snapshot,
+ caller,
+ peer,
dial_status);
}
}
@@ -1882,8 +1861,8 @@
return;
}
new_cdr->fn_table->process_dial_begin(new_cdr,
- party_a_snapshot,
- party_b_snapshot);
+ caller,
+ peer);
}
ao2_unlock(cdr);
}
More information about the asterisk-commits
mailing list