main/pbx: Move variable routines to pbx_variables.c.

This is the third patch in a series meant to reduce the bulk of pbx.c.
This moves channel and global variable routines to their own source.

Change-Id: Ibe8fb4647db11598591d443a99e3f99200a56bc6
This commit is contained in:
Corey Farrell
2016-01-04 17:22:59 -05:00
parent f42036bf6b
commit 7fdcfd7724
5 changed files with 1187 additions and 1114 deletions

View File

@@ -19,6 +19,7 @@ int load_modules(unsigned int); /*!< Provided by loader.c */
int load_pbx(void); /*!< Provided by pbx.c */ int load_pbx(void); /*!< Provided by pbx.c */
int load_pbx_builtins(void); /*!< Provided by pbx_builtins.c */ int load_pbx_builtins(void); /*!< Provided by pbx_builtins.c */
int load_pbx_functions_cli(void); /*!< Provided by pbx_functions.c */ int load_pbx_functions_cli(void); /*!< Provided by pbx_functions.c */
int load_pbx_variables(void); /*!< Provided by pbx_variables.c */
int init_logger(void); /*!< Provided by logger.c */ int init_logger(void); /*!< Provided by logger.c */
void close_logger(void); /*!< Provided by logger.c */ void close_logger(void); /*!< Provided by logger.c */
void logger_queue_start(void); /*!< Provided by logger.c */ void logger_queue_start(void); /*!< Provided by logger.c */

View File

@@ -4653,6 +4653,11 @@ static void asterisk_daemon(int isroot, const char *runuser, const char *rungrou
exit(1); exit(1);
} }
if (load_pbx_variables()) {
printf("Failed: load_pbx_variables\n%s", term_quit());
exit(1);
}
if (ast_local_init()) { if (ast_local_init()) {
printf("Failed: ast_local_init\n%s", term_quit()); printf("Failed: ast_local_init\n%s", term_quit());
exit(1); exit(1);

1051
main/pbx.c

File diff suppressed because it is too large Load Diff

View File

@@ -552,66 +552,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
<ref type="application">SayNumber</ref> <ref type="application">SayNumber</ref>
</see-also> </see-also>
</application> </application>
<application name="Set" language="en_US">
<synopsis>
Set channel variable or function value.
</synopsis>
<syntax argsep="=">
<parameter name="name" required="true" />
<parameter name="value" required="true" />
</syntax>
<description>
<para>This function can be used to set the value of channel variables or dialplan functions.
When setting variables, if the variable name is prefixed with <literal>_</literal>,
the variable will be inherited into channels created from the current channel.
If the variable name is prefixed with <literal>__</literal>, the variable will be
inherited into channels created from the current channel and all children channels.</para>
<note><para>If (and only if), in <filename>/etc/asterisk/asterisk.conf</filename>, you have
a <literal>[compat]</literal> category, and you have <literal>app_set = 1.4</literal> under that, then
the behavior of this app changes, and strips surrounding quotes from the right hand side as
it did previously in 1.4.
The advantages of not stripping out quoting, and not caring about the separator characters (comma and vertical bar)
were sufficient to make these changes in 1.6. Confusion about how many backslashes would be needed to properly
protect separators and quotes in various database access strings has been greatly
reduced by these changes.</para></note>
</description>
<see-also>
<ref type="application">MSet</ref>
<ref type="function">GLOBAL</ref>
<ref type="function">SET</ref>
<ref type="function">ENV</ref>
</see-also>
</application>
<application name="MSet" language="en_US">
<synopsis>
Set channel variable(s) or function value(s).
</synopsis>
<syntax>
<parameter name="set1" required="true" argsep="=">
<argument name="name1" required="true" />
<argument name="value1" required="true" />
</parameter>
<parameter name="set2" multiple="true" argsep="=">
<argument name="name2" required="true" />
<argument name="value2" required="true" />
</parameter>
</syntax>
<description>
<para>This function can be used to set the value of channel variables or dialplan functions.
When setting variables, if the variable name is prefixed with <literal>_</literal>,
the variable will be inherited into channels created from the current channel
If the variable name is prefixed with <literal>__</literal>, the variable will be
inherited into channels created from the current channel and all children channels.
MSet behaves in a similar fashion to the way Set worked in 1.2/1.4 and is thus
prone to doing things that you may not expect. For example, it strips surrounding
double-quotes from the right-hand side (value). If you need to put a separator
character (comma or vert-bar), you will need to escape them by inserting a backslash
before them. Avoid its use if possible.</para>
</description>
<see-also>
<ref type="application">Set</ref>
</see-also>
</application>
<application name="SetAMAFlags" language="en_US"> <application name="SetAMAFlags" language="en_US">
<synopsis> <synopsis>
Set the AMA Flags. Set the AMA Flags.
@@ -1464,8 +1404,6 @@ struct pbx_builtin {
{ "SayDigits", pbx_builtin_saydigits }, { "SayDigits", pbx_builtin_saydigits },
{ "SayNumber", pbx_builtin_saynumber }, { "SayNumber", pbx_builtin_saynumber },
{ "SayPhonetic", pbx_builtin_sayphonetic }, { "SayPhonetic", pbx_builtin_sayphonetic },
{ "Set", pbx_builtin_setvar },
{ "MSet", pbx_builtin_setvar_multiple },
{ "SetAMAFlags", pbx_builtin_setamaflags }, { "SetAMAFlags", pbx_builtin_setamaflags },
{ "Wait", pbx_builtin_wait }, { "Wait", pbx_builtin_wait },
{ "WaitExten", pbx_builtin_waitexten } { "WaitExten", pbx_builtin_waitexten }

1180
main/pbx_variables.c Normal file

File diff suppressed because it is too large Load Diff