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

Richard Mudgett asteriskteam at digium.com
Wed Dec 11 16:37:29 CST 2019


Richard Mudgett has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/13310 )

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


Patch Set 2: Code-Review-1

(2 comments)

https://gerrit.asterisk.org/c/asterisk/+/13310/2/apps/app_chanisavail.c 
File apps/app_chanisavail.c:

https://gerrit.asterisk.org/c/asterisk/+/13310/2/apps/app_chanisavail.c@31 
PS2, Line 31: <depend>func_cdr</depend>
> This is not a "true" dependance, since app_chanisavail can work without it. […]
This "depend" is a not hard dependency so it should not be listed here.  ChanIsAvail checks for the dialplan CDR_PROP function's existence before using it.


https://gerrit.asterisk.org/c/asterisk/+/13310/2/apps/app_chanisavail.c@183 
PS2, Line 183: 				if (ast_custom_function_find("CDR_PROP") != NULL)
             : 						ast_func_write(tempchan, "CDR_PROP(disable)", "1");
Guidelines: Always use curly braces.

Also you don't need to explicitly check for not NULL.  Just

if (ast_custom_function_find(...)) {
}

One thing you probably should do is to pull the call to ast_custom_function_find() out of the current do-while loop and save the result.  This way Asterisk doesn't have to look up CDR_PROP so many times for this ChanIsAvail execution.



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

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I1cbe09e8d2169c0962c1195133ff260d291f2074
Gerrit-Change-Number: 13310
Gerrit-PatchSet: 2
Gerrit-Owner: Frederic LE FOLL <frederic.lefoll at c-s.fr>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Comment-Date: Wed, 11 Dec 2019 22:37:29 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Frederic LE FOLL <frederic.lefoll at c-s.fr>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20191211/5c115bdd/attachment.html>


More information about the asterisk-code-review mailing list