[Asterisk-code-review] chan_dahdi: Add POLARITY function. (asterisk[master])

Kevin Harwell asteriskteam at digium.com
Mon May 2 16:07:00 CDT 2022


Attention is currently required from: N A.
Kevin Harwell has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/18362 )

Change subject: chan_dahdi: Add POLARITY function.
......................................................................


Patch Set 1:

(2 comments)

File channels/chan_dahdi.c:

https://gerrit.asterisk.org/c/asterisk/+/18362/comment/f4e9d06b_0a9a43f6 
PS1, Line 195: 			<para>However, when read, the function will always return 0 or 1.</para>
It seems "idle" and "reverse" are just synonyms for "0" and "1", correct?


https://gerrit.asterisk.org/c/asterisk/+/18362/comment/ed03c145_5a631e03 
PS1, Line 2675: 	int res;
              : 	struct dahdi_params dahdip;
              : 	struct dahdi_pvt *pvt;
              : 
              : 	if (strcasecmp(ast_channel_tech(chan)->type, "DAHDI")) {
              : 		ast_log(LOG_WARNING, "%s is not a DAHDI channel\n", ast_channel_name(chan));
              : 		return -1;
              : 	}
              : 
              : 	memset(&dahdip, 0, sizeof(dahdip));
              : 	res = ioctl(ast_channel_fd(chan, 0), DAHDI_GET_PARAMS, &dahdip);
              : 
              : 	if (res) {
              : 		ast_log(LOG_WARNING, "Unable to get parameters of %s: %s\n", ast_channel_name(chan), strerror(errno));
              : 		return -1;
              : 	}
              : 	if (!(dahdip.sigtype & __DAHDI_SIG_FXO)) {
              : 		ast_log(LOG_WARNING, "%s is not an FXS Channel\n", ast_channel_name(chan));
              : 		return -1;
              : 	}
              : 
              : 	pvt = ast_channel_tech_pvt(chan);
              : 	if (!dahdi_analog_lib_handles(pvt->sig, 0, 0)) {
              : 		ast_log(LOG_WARNING, "Channel signalling is not analog");
              : 		return -1;
              : 	}
This code looks duped below. If you wanted you could move this to a separate "verify" function shared by both calls.



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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: If6f50998f723e4484bf68e2473f5cedfeaf9b8f1
Gerrit-Change-Number: 18362
Gerrit-PatchSet: 1
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-CC: Kevin Harwell <kharwell at digium.com>
Gerrit-Attention: N A <mail at interlinked.x10host.com>
Gerrit-Comment-Date: Mon, 02 May 2022 21:07:00 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220502/719752b3/attachment-0001.html>


More information about the asterisk-code-review mailing list