43#define CONTEXT_NAME "tests_test_gosub_virtual_context" 
   50        const char *expected_value;
 
   52        { 
NULL, 
"${STACK_PEEK(1,e,1)}", 
"" },         
 
   53        { 
"Gosub", 
"tests_test_gosub_virtual_context,s,1" },
 
   54        { 
NULL, 
"${PRIORITY}", 
"1" },
 
   55        { 
NULL, 
"${EXTEN}", 
"s" },
 
   56        { 
NULL, 
"${STACK_PEEK(1,e,1)}", 
"" },         
 
   57        { 
"Gosub", 
"test,dne,1", (
const char *) -1 }, 
 
   58        { 
NULL, 
"${PRIORITY}", 
"1" },
 
   59        { 
NULL, 
"${EXTEN}", 
"s" },
 
   60        { 
"Gosub", 
"tests_test_gosub_virtual_context,s,1(5,5,5,5,5)" },
 
   61        { 
NULL, 
"${PRIORITY}", 
"1" },
 
   62        { 
NULL, 
"$[0${ARG1} + 0${ARG5}]", 
"10" },
 
   63        { 
NULL, 
"${STACK_PEEK(1,e)}", 
"s" },
 
   64        { 
NULL, 
"${STACK_PEEK(1,c)}", 
"tests_test_gosub_virtual_context" },
 
   65        { 
NULL, 
"${STACK_PEEK(1,p)}", 
"1" },
 
   66        { 
NULL, 
"${STACK_PEEK(1,l)}", 
"tests_test_gosub_virtual_context,s,1" },
 
   68        { 
NULL, 
"${STACK_PEEK(1,e,1)}", 
"" },         
 
   69        { 
"Gosub", 
"tests_test_gosub_virtual_context,s,1(5,5,5,5,5)" },
 
   70        { 
"Gosub", 
"tests_test_gosub_virtual_context,s,1(4,4,4,4)" },
 
   71        { 
NULL, 
"$[0${ARG1} + 0${ARG5}]", 
"4" },
 
   72        { 
NULL, 
"$[0${ARG1} + 0${ARG4}]", 
"8" },
 
   73        { 
"Gosub", 
"tests_test_gosub_virtual_context,s,1(3,3,3)" },
 
   74        { 
NULL, 
"$[0${ARG1} + 0${ARG4}]", 
"3" },
 
   75        { 
NULL, 
"$[0${ARG1} + 0${ARG3}]", 
"6" },
 
   76        { 
"Gosub", 
"tests_test_gosub_virtual_context,s,1(2,2)" },
 
   77        { 
NULL, 
"$[0${ARG1} + 0${ARG3}]", 
"2" },
 
   78        { 
NULL, 
"$[0${ARG1} + 0${ARG2}]", 
"4" },
 
   79        { 
"Gosub", 
"tests_test_gosub_virtual_context,s,1(1)" },
 
   80        { 
NULL, 
"$[0${ARG1} + 0${ARG2}]", 
"1" },
 
   81        { 
NULL, 
"$[0${ARG1} + 0${ARG1}]", 
"2" },
 
   82        { 
"Gosub", 
"tests_test_gosub_virtual_context,s,1" },
 
   83        { 
NULL, 
"$[0${ARG1} + 0${ARG1}]", 
"0" }, 
 
   84        { 
"Set", 
"LOCAL(foo)=5" },
 
   85        { 
NULL, 
"${foo}", 
"5" },                 
 
   86        { 
NULL, 
"${LOCAL_PEEK(0,ARG1)}", 
"" },   
 
   87        { 
NULL, 
"${LOCAL_PEEK(4,ARG1)}", 
"4" },  
 
   88        { 
NULL, 
"$[0${LOCAL_PEEK(3,ARG1)} + 0${LOCAL_PEEK(5,ARG1)}]", 
"8" },
 
   90        { 
NULL, 
"${foo}", 
"" },                  
 
   92        { 
NULL, 
"${GOSUB_RETVAL}", 
"7" },              
 
   93        { 
NULL, 
"$[0${GOSUB_RETVAL} + 0${ARG1}]", 
"9" }, 
 
   98        info->name = 
"gosub application";
 
   99        info->category = 
"/apps/app_gosub/";
 
  100        info->summary = 
"Verify functionality of gosub application";
 
  102            "Verify functionality of gosub application";
 
  129    for (i = 0; i < 
ARRAY_LEN(testplan); i++) {
 
  148            if ((exec_res = 
pbx_exec(chan, 
app, testplan[i].
args)) && ((
const char *) exec_res != testplan[i].expected_value)) {
 
 
void ast_context_destroy(void)
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdup(str)
A wrapper for strdup()
void ast_free_ptr(void *ptr)
free() wrapper
General Asterisk PBX channel definitions.
#define ast_channel_unref(c)
Decrease channel reference count.
#define ast_dummy_channel_alloc()
Create a fake channel structure.
Asterisk module definitions.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
Core PBX routines and definitions.
int ast_add_extension(const char *context, int replace, const char *extension, int priority, const char *label, const char *callerid, const char *application, void *data, void(*datad)(void *), const char *registrar)
Add and extension to an extension context.
void ast_str_substitute_variables(struct ast_str **buf, ssize_t maxlen, struct ast_channel *chan, const char *templ)
struct ast_context * ast_context_find_or_create(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *name, const char *registrar)
Register a new context or find an existing one.
int pbx_exec(struct ast_channel *c, struct ast_app *app, const char *data)
Execute an application.
int ast_context_remove_extension(const char *context, const char *extension, int priority, const char *registrar)
Simply remove extension from context.
struct ast_app * pbx_findapp(const char *app)
Look up an application.
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
char *attribute_pure ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
ast_app: A registered application
Main Channel structure associated with a channel.
Support for dynamic strings.
#define AST_TEST_REGISTER(cb)
#define ast_test_status_update(a, b, c...)
#define AST_TEST_UNREGISTER(cb)
#define AST_TEST_DEFINE(hdr)
static int load_module(void)
static int unload_module(void)