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

Joshua C. Colp asteriskteam at digium.com
Thu Dec 19 18:40:17 CST 2019


Joshua C. Colp has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/13471 )

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: I1cbe09e8d2169c0962c1195133ff260d291f2074
---
M apps/app_chanisavail.c
1 file changed, 11 insertions(+), 2 deletions(-)

Approvals:
  Friendly Automation: Verified
  Joshua C. Colp: Looks good to me, approved; Approved for Submit
  Richard Mudgett: Looks good to me, but someone else must approve



diff --git a/apps/app_chanisavail.c b/apps/app_chanisavail.c
index 446bce1..1c7c1ec 100644
--- a/apps/app_chanisavail.c
+++ b/apps/app_chanisavail.c
@@ -134,6 +134,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 */
@@ -179,7 +181,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;
@@ -212,4 +216,9 @@
 		AST_MODULE_LOAD_DECLINE : AST_MODULE_LOAD_SUCCESS;
 }
 
-AST_MODULE_INFO_STANDARD_EXTENDED(ASTERISK_GPL_KEY, "Check channel availability");
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Check channel availability",
+	.support_level = AST_MODULE_SUPPORT_EXTENDED,
+	.load = load_module,
+	.unload = unload_module,
+	.optional_modules = "func_cdr"
+);

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I1cbe09e8d2169c0962c1195133ff260d291f2074
Gerrit-Change-Number: 13471
Gerrit-PatchSet: 1
Gerrit-Owner: Frederic LE FOLL <frederic.lefoll at c-s.fr>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua C. Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20191219/f644265e/attachment.html>


More information about the asterisk-code-review mailing list