[Asterisk-code-review] app_originate: Allow variables to be set (asterisk[16])

George Joseph asteriskteam at digium.com
Thu May 27 08:39:53 CDT 2021


George Joseph has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/15940 )

Change subject: app_originate: Allow variables to be set
......................................................................


Patch Set 2: Code-Review-1

(3 comments)

https://gerrit.asterisk.org/c/asterisk/+/15940/2/apps/app_originate.c 
File apps/app_originate.c:

https://gerrit.asterisk.org/c/asterisk/+/15940/2/apps/app_originate.c@100 
PS2, Line 100: 					<argument name="var1" required="false" argsep="=">
             : 						<argument name="name" multiple="true" required="true" />
             : 						<argument name="value" required="true" />
             : 					</argument>
This XML results in something that looks like this "v([name[=...]=value])" which isn't what you want.  Take a look at the XML for the MSet() application which is in main/pbx_variables.c.  If you copy that and change "parameter" to "argument" you'll get something like "v(name1=value1[^name2=value2[^...]])"


https://gerrit.asterisk.org/c/asterisk/+/15940/2/apps/app_originate.c@244 
PS2, Line 244: 	
Whitespace.


https://gerrit.asterisk.org/c/asterisk/+/15940/2/apps/app_originate.c@252 
PS2, Line 252: 			tmp = strchr(text, '='); /* use = sign to separate var value from name */
             : 			if (!tmp) {
             : 				ast_log(LOG_ERROR, "Variable syntax error: %s\n", tmp);
             : 				goto return_cleanup;
             : 			}
             : 			*tmp = '\0';
             : 			varname = text;
             : 			tmp = ast_skip_blanks(tmp + 1);
             : 			varvalue = tmp;
             : 			tmp = strchr(varvalue, '^'); /* start of the next variable, if there is one */
             : 			if (tmp) {
             : 				*tmp = '\0';
             : 				text = ast_skip_blanks(tmp + 1); /* for the next variable */
             : 			} else {
             : 				text = NULL; /* this was the last variable */
             : 			}
Take a look at ast_strsep().  It does some of this work for you.  Also take a look at app.h.  There are helpers like ast_app_separate_args that can also do this.



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

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: Ia64cfe97d2792bcbf4775b3126cad662922a8b66
Gerrit-Change-Number: 15940
Gerrit-PatchSet: 2
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Comment-Date: Thu, 27 May 2021 13:39:53 +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/20210527/038604cb/attachment.html>


More information about the asterisk-code-review mailing list