#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "asterisk.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/logger.h"
#include "asterisk/utils.h"
#include "asterisk/app.h"
#include "asterisk/config.h"
Include dependency graph for func_logic.c:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Functions | |
static char * | builtin_function_exists (struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len) |
static char * | builtin_function_if (struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len) |
static char * | builtin_function_iftime (struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len) |
static char * | builtin_function_isnull (struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len) |
static char * | builtin_function_set (struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len) |
Variables | |
static struct ast_custom_function | exists_function |
static struct ast_custom_function | if_function |
static struct ast_custom_function | if_time_function |
static struct ast_custom_function | isnull_function |
static struct ast_custom_function | set_function |
Definition in file func_logic.c.
|
Definition at line 44 of file func_logic.c.
|
|
Definition at line 90 of file func_logic.c. References ast_log(), ast_strdupa, ast_strip_quoted(), ast_strlen_zero(), ast_true(), LOG_WARNING, and strsep(). 00091 { 00092 char *ret; 00093 char *expr; 00094 char *iftrue; 00095 char *iffalse; 00096 00097 if (!(data = ast_strdupa(data))) { 00098 ast_log(LOG_WARNING, "Memory Error!\n"); 00099 return NULL; 00100 } 00101 00102 data = ast_strip_quoted(data, "\"", "\""); 00103 expr = strsep(&data, "?"); 00104 iftrue = strsep(&data, ":"); 00105 iffalse = data; 00106 00107 if (ast_strlen_zero(expr) || !(iftrue || iffalse)) { 00108 ast_log(LOG_WARNING, "Syntax IF(<expr>?[<true>][:<false>])\n"); 00109 return NULL; 00110 } 00111 00112 expr = ast_strip(expr); 00113 if (iftrue) 00114 iftrue = ast_strip_quoted(iftrue, "\"", "\""); 00115 if (iffalse) 00116 iffalse = ast_strip_quoted(iffalse, "\"", "\""); 00117 00118 if ((ret = ast_true(expr) ? iftrue : iffalse)) { 00119 ast_copy_string(buf, ret, len); 00120 ret = buf; 00121 } 00122 00123 return ret; 00124 }
|
|
Definition at line 49 of file func_logic.c. References ast_build_timing(), ast_check_timing(), ast_log(), ast_strdupa, ast_strip_quoted(), ast_strlen_zero(), LOG_WARNING, and strsep(). 00050 { 00051 struct ast_timing timing; 00052 char *ret; 00053 char *expr; 00054 char *iftrue; 00055 char *iffalse; 00056 00057 if (!(data = ast_strdupa(data))) { 00058 ast_log(LOG_WARNING, "Memory Error!\n"); 00059 return NULL; 00060 } 00061 00062 data = ast_strip_quoted(data, "\"", "\""); 00063 expr = strsep(&data, "?"); 00064 iftrue = strsep(&data, ":"); 00065 iffalse = data; 00066 00067 if (ast_strlen_zero(expr) || !(iftrue || iffalse)) { 00068 ast_log(LOG_WARNING, "Syntax IFTIME(<timespec>?[<true>][:<false>])\n"); 00069 return NULL; 00070 } 00071 00072 if (!ast_build_timing(&timing, expr)) { 00073 ast_log(LOG_WARNING, "Invalid Time Spec.\n"); 00074 return NULL; 00075 } 00076 00077 if (iftrue) 00078 iftrue = ast_strip_quoted(iftrue, "\"", "\""); 00079 if (iffalse) 00080 iffalse = ast_strip_quoted(iffalse, "\"", "\""); 00081 00082 if ((ret = ast_check_timing(&timing) ? iftrue : iffalse)) { 00083 ast_copy_string(buf, ret, len); 00084 ret = buf; 00085 } 00086 00087 return ret; 00088 }
|
|
Definition at line 39 of file func_logic.c.
|
|
Definition at line 126 of file func_logic.c. References ast_log(), ast_strdupa, ast_strlen_zero(), LOG_WARNING, pbx_builtin_setvar_helper(), and strsep(). 00127 { 00128 char *varname; 00129 char *val; 00130 00131 if (!(data = ast_strdupa(data))) { 00132 ast_log(LOG_WARNING, "Memory Error!\n"); 00133 return NULL; 00134 } 00135 00136 varname = strsep(&data, "="); 00137 val = data; 00138 00139 if (ast_strlen_zero(varname) || !val) { 00140 ast_log(LOG_WARNING, "Syntax SET(<varname>=[<value>])\n"); 00141 return NULL; 00142 } 00143 00144 varname = ast_strip(varname); 00145 val = ast_strip(val); 00146 pbx_builtin_setvar_helper(chan, varname, val); 00147 ast_copy_string(buf, val, len); 00148 00149 return buf; 00150 }
|
|
Definition at line 175 of file func_logic.c. |
|
Definition at line 185 of file func_logic.c. |
|
Definition at line 196 of file func_logic.c. |
|
Definition at line 155 of file func_logic.c. |
|
Definition at line 165 of file func_logic.c. |