[Asterisk-code-review] app_senddtmf: Add receive mode to AMI Action PlayDTMF (asterisk[16])

Benjamin Keith Ford asteriskteam at digium.com
Wed Nov 13 12:49:36 CST 2019


Benjamin Keith Ford has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/13163 )

Change subject: app_senddtmf: Add receive mode to AMI Action PlayDTMF
......................................................................


Patch Set 1: Code-Review-1

(1 comment)

https://gerrit.asterisk.org/c/asterisk/+/13163/1/apps/app_senddtmf.c 
File apps/app_senddtmf.c:

https://gerrit.asterisk.org/c/asterisk/+/13163/1/apps/app_senddtmf.c@175 
PS1, Line 175: 	if (ast_strlen_zero(receive_s)) {
             : 		receive = 0;
             : 	} else {
             : 		receive = abs(ast_true(receive_s));
             : 	}
             : 
             : 	if (receive) {
This can be simplified down to one if statement, like so:

if (ast_true(receive_s)) {
    struct ast_frame f = { AST_FRAME_DTMF, };
    ...

The reason this is possible is because ast_true will return 0 if receive_s is NULL or does not contain a value that evaluates to true. Similarly, you won't need abs because as long as the return value from ast_true is not zero, it will evaluate to true. You won't need the receive variable anymore, either.



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

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I183501297ae1dc294ae56b34acac9b0343eb2664
Gerrit-Change-Number: 13163
Gerrit-PatchSet: 1
Gerrit-Owner: lvl <digium at lvlconsultancy.nl>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Comment-Date: Wed, 13 Nov 2019 18:49:36 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20191113/8e549e5e/attachment.html>


More information about the asterisk-code-review mailing list