[Asterisk-code-review] app_chanisavail/cdr: ChanIsAvail sometimes fails to deactivate CDR. (asterisk[13])

Frederic LE FOLL asteriskteam at digium.com
Mon Dec 16 15:27:30 CST 2019


Frederic LE FOLL has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/13449 )


Change subject: app_chanisavail/cdr: ChanIsAvail sometimes fails to deactivate CDR.
......................................................................

app_chanisavail/cdr: ChanIsAvail sometimes fails to deactivate CDR.

Temporary channel lifespan is very short and CDR deactivation request
through ast_cdr_set_property() may happen when CDR is not available
yet. Use CDR_PROP() dialplan function instead, it will first wait
for pending CDR insertion requests to be processed.

ASTERISK-28636

Change-Id: I1a25c0670e4db96d5d19f50076b24e7c2ec4ff05
---
M apps/app_chanisavail.c
1 file changed, 5 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/49/13449/1

diff --git a/apps/app_chanisavail.c b/apps/app_chanisavail.c
index 539a530..568a815 100644
--- a/apps/app_chanisavail.c
+++ b/apps/app_chanisavail.c
@@ -136,6 +136,8 @@
 	}
 	peers = args.reqchans;
 	if (peers) {
+		struct ast_custom_function *cdr_prop_func = ast_custom_function_find("CDR_PROP");
+
 		cur = peers;
 		do {
 			/* remember where to start next time */
@@ -181,7 +183,9 @@
 					ast_str_append(&tmp_availcause, 0, "%s%s", ast_str_strlen(tmp_availcause) ? "&" : "", tmp);
 
 					/* Disable CDR for this temporary channel. */
-					ast_cdr_set_property(ast_channel_name(tempchan), AST_CDR_FLAG_DISABLE_ALL);
+					if (cdr_prop_func) {
+						ast_func_write(tempchan, "CDR_PROP(disable)", "1");
+					}
 
 					ast_hangup(tempchan);
 					tempchan = NULL;

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/13449
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I1a25c0670e4db96d5d19f50076b24e7c2ec4ff05
Gerrit-Change-Number: 13449
Gerrit-PatchSet: 1
Gerrit-Owner: Frederic LE FOLL <frederic.lefoll at c-s.fr>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20191216/39f4ff02/attachment-0001.html>


More information about the asterisk-code-review mailing list