[Asterisk-code-review] chan pjsip: add a new function PJSIP DTMF MODE (asterisk[13])

Alexei Gradinari asteriskteam at digium.com
Fri Jun 30 09:27:10 CDT 2017


Alexei Gradinari has posted comments on this change. ( https://gerrit.asterisk.org/5909 )

Change subject: chan_pjsip: add a new function PJSIP_DTMF_MODE
......................................................................


Patch Set 4:

(2 comments)

https://gerrit.asterisk.org/#/c/5909/4/channels/pjsip/dialplan_functions.c
File channels/pjsip/dialplan_functions.c:

https://gerrit.asterisk.org/#/c/5909/4/channels/pjsip/dialplan_functions.c@1070
PS4, Line 1070: 	switch (channel->session->dtmf) {
              : 		case AST_SIP_DTMF_NONE:
              : 			strncpy(buf, "none", len);
              : 			break;
              : 		case AST_SIP_DTMF_RFC_4733:
              : 			strncpy(buf, "rfc4733", len);
              : 			break;
              : 		case AST_SIP_DTMF_INBAND:
              : 			strncpy(buf, "inband", len);
              : 			break;
              : 		case AST_SIP_DTMF_INFO:
              : 			strncpy(buf, "info", len);
              : 			break;
              : 		case AST_SIP_DTMF_AUTO:
              : 			strncpy(buf, "auto", len);
              : 			break;
              : 		case AST_SIP_DTMF_AUTO_INFO:
              : 			strncpy(buf, "info", len);
              : 			break;
              : 		default:
              : 			ast_log(LOG_WARNING, "Unknown DTMF mode %d on PJSIP channel %s\n", channel->session->dtmf, ast_channel_name(chan));
              : 			buf[0] = '\0';
              : 			return -1;
              : 	}
Would be better to move the code of DTMF->string and string->DTMF into the new functions, like ast_dtmf_to_str and ast_str_to_dtmf.
Then use these functions in this file and pjsip_configuration.c


https://gerrit.asterisk.org/#/c/5909/4/channels/pjsip/dialplan_functions.c@1116
PS4, Line 1116: 	if (!strcasecmp(value, "info")) {
              : 		channel->session->dtmf= AST_SIP_DTMF_INFO;
              : 	} else if (!strcasecmp(value, "rfc2833")) {
              : 		channel->session->dtmf= AST_SIP_DTMF_RFC_4733;
              : 	} else if (!strcasecmp(value, "inband")) {
              : 		channel->session->dtmf= AST_SIP_DTMF_INBAND;
              : 	} else if (!strcasecmp(value, "none")) {
              : 		channel->session->dtmf= AST_SIP_DTMF_NONE;
              : 	} else if (!strcasecmp(value, "auto")) {
              : 		channel->session->dtmf= AST_SIP_DTMF_AUTO;
              : 	} else if (!strcasecmp(value, "auto")) {
              : 		channel->session->dtmf= AST_SIP_DTMF_AUTO_INFO;
              : 	} else {
              : 		ast_log(LOG_WARNING, "I don't know about this dtmf mode: %s\n", value);
              : 	}
The same... ast_str_to_dtmf



-- 
To view, visit https://gerrit.asterisk.org/5909
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: comment
Gerrit-Change-Id: I20eef5da3e5d1d3e58b304416bc79683f87e7612
Gerrit-Change-Number: 5909
Gerrit-PatchSet: 4
Gerrit-Owner: Torrey Searle <tsearle at gmail.com>
Gerrit-Reviewer: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Comment-Date: Fri, 30 Jun 2017 14:27:10 +0000
Gerrit-HasComments: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20170630/f2b0694a/attachment.html>


More information about the asterisk-code-review mailing list