]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
app_chanisavail/cdr: ChanIsAvail sometimes fails to deactivate CDR.
authorFrederic LE FOLL <frederic.lefoll@c-s.fr>
Mon, 16 Dec 2019 21:27:44 +0000 (22:27 +0100)
committerFrederic LE FOLL <frederic.lefoll@c-s.fr>
Mon, 16 Dec 2019 21:43:01 +0000 (22:43 +0100)
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

apps/app_chanisavail.c

index 539a530e6c086f4b938cc2427f1011afeb07bc11..568a815431676a4922d23a923ec85a958f8d7888 100644 (file)
@@ -136,6 +136,8 @@ static int chanavail_exec(struct ast_channel *chan, const char *data)
        }
        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 @@ static int chanavail_exec(struct ast_channel *chan, const char *data)
                                        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;