diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_chanspy.c | 8 | ||||
-rw-r--r-- | apps/app_confbridge.c | 12 | ||||
-rw-r--r-- | apps/app_dial.c | 70 | ||||
-rw-r--r-- | apps/app_directed_pickup.c | 2 | ||||
-rw-r--r-- | apps/app_directory.c | 8 | ||||
-rw-r--r-- | apps/app_dumpchan.c | 10 | ||||
-rw-r--r-- | apps/app_fax.c | 2 | ||||
-rw-r--r-- | apps/app_macro.c | 47 | ||||
-rw-r--r-- | apps/app_meetme.c | 6 | ||||
-rw-r--r-- | apps/app_minivm.c | 36 | ||||
-rw-r--r-- | apps/app_osplookup.c | 2 | ||||
-rw-r--r-- | apps/app_parkandannounce.c | 4 | ||||
-rw-r--r-- | apps/app_queue.c | 38 | ||||
-rw-r--r-- | apps/app_readexten.c | 13 | ||||
-rw-r--r-- | apps/app_rpt.c | 30 | ||||
-rw-r--r-- | apps/app_stack.c | 18 | ||||
-rw-r--r-- | apps/app_talkdetect.c | 4 | ||||
-rw-r--r-- | apps/app_verbose.c | 4 | ||||
-rw-r--r-- | apps/app_voicemail.c | 88 | ||||
-rw-r--r-- | apps/app_while.c | 20 |
20 files changed, 210 insertions, 212 deletions
diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c index ab7887764..b56672dd2 100644 --- a/apps/app_chanspy.c +++ b/apps/app_chanspy.c @@ -779,10 +779,10 @@ static int common_exec(struct ast_channel *chan, struct ast_flags *flags, ast_channel_lock(chan); if ((c = pbx_builtin_getvar_helper(chan, "SPY_EXIT_CONTEXT"))) { ast_copy_string(exitcontext, c, sizeof(exitcontext)); - } else if (!ast_strlen_zero(chan->macrocontext)) { - ast_copy_string(exitcontext, chan->macrocontext, sizeof(exitcontext)); + } else if (!ast_strlen_zero(ast_channel_macrocontext(chan))) { + ast_copy_string(exitcontext, ast_channel_macrocontext(chan), sizeof(exitcontext)); } else { - ast_copy_string(exitcontext, chan->context, sizeof(exitcontext)); + ast_copy_string(exitcontext, ast_channel_context(chan), sizeof(exitcontext)); } ast_channel_unlock(chan); } @@ -1186,7 +1186,7 @@ static int extenspy_exec(struct ast_channel *chan, const char *data) args.context = ptr; } if (ast_strlen_zero(args.context)) - args.context = ast_strdupa(chan->context); + args.context = ast_strdupa(ast_channel_context(chan)); if (args.options) { char *opts[OPT_ARG_ARRAY_SIZE]; diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c index 96d1d51d6..8c03509c9 100644 --- a/apps/app_confbridge.c +++ b/apps/app_confbridge.c @@ -1727,15 +1727,15 @@ static int action_dialplan_exec(struct ast_bridge_channel *bridge_channel, struc ast_channel_lock(bridge_channel->chan); /*save off*/ - exten = ast_strdupa(bridge_channel->chan->exten); - context = ast_strdupa(bridge_channel->chan->context); + exten = ast_strdupa(ast_channel_exten(bridge_channel->chan)); + context = ast_strdupa(ast_channel_context(bridge_channel->chan)); priority = bridge_channel->chan->priority; pbx = bridge_channel->chan->pbx; bridge_channel->chan->pbx = NULL; /*set new*/ - ast_copy_string(bridge_channel->chan->exten, menu_action->data.dialplan_args.exten, sizeof(bridge_channel->chan->exten)); - ast_copy_string(bridge_channel->chan->context, menu_action->data.dialplan_args.context, sizeof(bridge_channel->chan->context)); + ast_channel_exten_set(bridge_channel->chan, menu_action->data.dialplan_args.exten); + ast_channel_context_set(bridge_channel->chan, menu_action->data.dialplan_args.context); bridge_channel->chan->priority = menu_action->data.dialplan_args.priority; ast_channel_unlock(bridge_channel->chan); @@ -1746,8 +1746,8 @@ static int action_dialplan_exec(struct ast_bridge_channel *bridge_channel, struc /*restore*/ ast_channel_lock(bridge_channel->chan); - ast_copy_string(bridge_channel->chan->exten, exten, sizeof(bridge_channel->chan->exten)); - ast_copy_string(bridge_channel->chan->context, context, sizeof(bridge_channel->chan->context)); + ast_channel_exten_set(bridge_channel->chan, exten); + ast_channel_context_set(bridge_channel->chan, context); bridge_channel->chan->priority = priority; bridge_channel->chan->pbx = pbx; diff --git a/apps/app_dial.c b/apps/app_dial.c index d900f4f2c..7543bd22b 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -763,10 +763,10 @@ static int onedigit_goto(struct ast_channel *chan, const char *context, char ext if (!ast_goto_if_exists(chan, context, rexten, pri)) return 1; } else { - if (!ast_goto_if_exists(chan, chan->context, rexten, pri)) + if (!ast_goto_if_exists(chan, ast_channel_context(chan), rexten, pri)) return 1; - else if (!ast_strlen_zero(chan->macrocontext)) { - if (!ast_goto_if_exists(chan, chan->macrocontext, rexten, pri)) + else if (!ast_strlen_zero(ast_channel_macrocontext(chan))) { + if (!ast_goto_if_exists(chan, ast_channel_macrocontext(chan), rexten, pri)) return 1; } } @@ -780,8 +780,8 @@ static const char *get_cid_name(char *name, int namelen, struct ast_channel *cha const char *exten; ast_channel_lock(chan); - context = ast_strdupa(S_OR(chan->macrocontext, chan->context)); - exten = ast_strdupa(S_OR(chan->macroexten, chan->exten)); + context = ast_strdupa(S_OR(ast_channel_macrocontext(chan), ast_channel_context(chan))); + exten = ast_strdupa(S_OR(ast_channel_macroexten(chan), ast_channel_exten(chan))); ast_channel_unlock(chan); return ast_get_hint(NULL, 0, name, namelen, chan, context, exten) ? name : ""; @@ -852,7 +852,7 @@ static void do_forward(struct chanlist *o, if (ast_strlen_zero(forward_context)) { forward_context = NULL; } - snprintf(tmpchan, sizeof(tmpchan), "%s@%s", ast_channel_call_forward(c), forward_context ? forward_context : c->context); + snprintf(tmpchan, sizeof(tmpchan), "%s@%s", ast_channel_call_forward(c), forward_context ? forward_context : ast_channel_context(c)); ast_channel_unlock(c); stuff = tmpchan; tech = "Local"; @@ -912,7 +912,7 @@ static void do_forward(struct chanlist *o, ast_party_number_init(&c->redirecting.from.number); c->redirecting.from.number.valid = 1; c->redirecting.from.number.str = - ast_strdup(S_OR(in->macroexten, in->exten)); + ast_strdup(S_OR(ast_channel_macroexten(in), ast_channel_exten(in))); } c->dialed.transit_network_select = in->dialed.transit_network_select; @@ -945,8 +945,8 @@ static void do_forward(struct chanlist *o, ast_channel_accountcode_set(c, ast_channel_accountcode(in)); - c->appl = "AppDial"; - c->data = "(Outgoing Line)"; + ast_channel_appl_set(c, "AppDial"); + ast_channel_data_set(c, "(Outgoing Line)"); /* * We must unlock c before calling ast_channel_redirecting_macro, because * we put c into autoservice there. That is pretty much a guaranteed @@ -1134,7 +1134,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, OPT_CALLEE_MIXMONITOR | OPT_CALLER_MIXMONITOR | DIAL_NOFORWARDHTML); ast_channel_dialcontext_set(c, ""); - ast_copy_string(c->exten, "", sizeof(c->exten)); + ast_channel_exten_set(c, ""); } continue; } @@ -1208,7 +1208,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, OPT_CALLEE_MIXMONITOR | OPT_CALLER_MIXMONITOR | DIAL_NOFORWARDHTML); ast_channel_dialcontext_set(c, ""); - ast_copy_string(c->exten, "", sizeof(c->exten)); + ast_channel_exten_set(c, ""); if (CAN_EARLY_BRIDGE(peerflags, in, peer)) /* Setup early bridge if appropriate */ ast_channel_early_bridge(in, peer); @@ -1729,7 +1729,7 @@ static int setup_privacy_args(struct privacy_args *pa, } ast_verb(3, "Privacy-- callerid is empty\n"); - snprintf(callerid, sizeof(callerid), "NOCALLERID_%s%s", chan->exten, tnam); + snprintf(callerid, sizeof(callerid), "NOCALLERID_%s%s", ast_channel_exten(chan), tnam); l = callerid; pa->privdb_val = AST_PRIVACY_UNKNOWN; } @@ -1999,7 +1999,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast if (ast_test_flag64(&opts, OPT_FORCECLID)) { if (ast_strlen_zero(opt_args[OPT_ARG_FORCECLID])) { ast_channel_lock(chan); - forced_clid.number.str = ast_strdupa(S_OR(chan->macroexten, chan->exten)); + forced_clid.number.str = ast_strdupa(S_OR(ast_channel_macroexten(chan), ast_channel_exten(chan))); ast_channel_unlock(chan); forced_clid_name[0] = '\0'; forced_clid.name.str = (char *) get_cid_name(forced_clid_name, @@ -2076,7 +2076,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast stored_clid.name.valid = 1; } ast_channel_lock(chan); - stored_clid.number.str = ast_strdupa(S_OR(chan->macroexten, chan->exten)); + stored_clid.number.str = ast_strdupa(S_OR(ast_channel_macroexten(chan), ast_channel_exten(chan))); stored_clid.number.valid = 1; ast_channel_unlock(chan); } @@ -2084,7 +2084,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast if (ast_test_flag64(&opts, OPT_RESETCDR) && chan->cdr) ast_cdr_reset(chan->cdr, NULL); if (ast_test_flag64(&opts, OPT_PRIVACY) && ast_strlen_zero(opt_args[OPT_ARG_PRIVACY])) - opt_args[OPT_ARG_PRIVACY] = ast_strdupa(chan->exten); + opt_args[OPT_ARG_PRIVACY] = ast_strdupa(ast_channel_exten(chan)); if (ast_test_flag64(&opts, OPT_PRIVACY) || ast_test_flag64(&opts, OPT_SCREENING)) { res = setup_privacy_args(&pa, &opts, opt_args, chan); @@ -2246,8 +2246,8 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast ast_channel_inherit_variables(chan, tc); ast_channel_datastore_inherit(chan, tc); - tc->appl = "AppDial"; - tc->data = "(Outgoing Line)"; + ast_channel_appl_set(tc, "AppDial"); + ast_channel_data_set(tc, "(Outgoing Line)"); memset(&tc->whentohangup, 0, sizeof(tc->whentohangup)); /* Determine CallerID to store in outgoing channel. */ @@ -2328,11 +2328,11 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast /* Inherit context and extension */ - ast_channel_dialcontext_set(tc, ast_strlen_zero(chan->macrocontext) ? chan->context : chan->macrocontext); - if (!ast_strlen_zero(chan->macroexten)) - ast_copy_string(tc->exten, chan->macroexten, sizeof(tc->exten)); + ast_channel_dialcontext_set(tc, ast_strlen_zero(ast_channel_macrocontext(chan)) ? ast_channel_context(chan) : ast_channel_macrocontext(chan)); + if (!ast_strlen_zero(ast_channel_macroexten(chan))) + ast_channel_exten_set(tc, ast_channel_macroexten(chan)); else - ast_copy_string(tc->exten, chan->exten, sizeof(tc->exten)); + ast_channel_exten_set(tc, ast_channel_exten(chan)); ast_channel_unlock(tc); ast_channel_unlock(chan); @@ -2561,8 +2561,8 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast replace_macro_delimiter(opt_args[OPT_ARG_GOTO]); ast_parseable_goto(chan, opt_args[OPT_ARG_GOTO]); /* peer goes to the same context and extension as chan, so just copy info from chan*/ - ast_copy_string(peer->context, chan->context, sizeof(peer->context)); - ast_copy_string(peer->exten, chan->exten, sizeof(peer->exten)); + ast_channel_context_set(peer, ast_channel_context(chan)); + ast_channel_exten_set(peer, ast_channel_exten(chan)); peer->priority = chan->priority + 2; ast_pbx_start(peer); hanguptree(outgoing, NULL, ast_test_flag64(&opts, OPT_CANCEL_ELSEWHERE) ? 1 : 0); @@ -2586,8 +2586,8 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast if (theapp && !res) { /* XXX why check res here ? */ /* Set peer->exten and peer->context so that MACRO_EXTEN and MACRO_CONTEXT get set */ - ast_copy_string(peer->context, chan->context, sizeof(peer->context)); - ast_copy_string(peer->exten, chan->exten, sizeof(peer->exten)); + ast_channel_context_set(peer, ast_channel_context(chan)); + ast_channel_exten_set(peer, ast_channel_exten(chan)); replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_MACRO]); res = pbx_exec(peer, theapp, opt_args[OPT_ARG_CALLEE_MACRO]); @@ -2657,8 +2657,8 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_GOSUB]); /* Set where we came from */ - ast_copy_string(peer->context, "app_dial_gosub_virtual_context", sizeof(peer->context)); - ast_copy_string(peer->exten, "s", sizeof(peer->exten)); + ast_channel_context_set(peer, "app_dial_gosub_virtual_context"); + ast_channel_exten_set(peer, "s"); peer->priority = 0; gosub_argstart = strchr(opt_args[OPT_ARG_CALLEE_GOSUB], ','); @@ -2828,21 +2828,21 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast res = ast_bridge_call(chan, peer, &config); } - strcpy(peer->context, chan->context); + ast_channel_context_set(peer, ast_channel_context(chan)); if (ast_test_flag64(&opts, OPT_PEER_H) - && ast_exists_extension(peer, peer->context, "h", 1, + && ast_exists_extension(peer, ast_channel_context(peer), "h", 1, S_COR(peer->caller.id.number.valid, peer->caller.id.number.str, NULL))) { int autoloopflag; int found; int res9; - strcpy(peer->exten, "h"); + ast_channel_exten_set(peer, "h"); peer->priority = 1; autoloopflag = ast_test_flag(peer, AST_FLAG_IN_AUTOLOOP); /* save value to restore at the end */ ast_set_flag(peer, AST_FLAG_IN_AUTOLOOP); - while ((res9 = ast_spawn_extension(peer, peer->context, peer->exten, + while ((res9 = ast_spawn_extension(peer, ast_channel_context(peer), ast_channel_exten(peer), peer->priority, S_COR(peer->caller.id.number.valid, peer->caller.id.number.str, NULL), &found, 1)) == 0) { @@ -2851,8 +2851,8 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast if (found && res9) { /* Something bad happened, or a hangup has been requested. */ - ast_debug(1, "Spawn extension (%s,%s,%d) exited non-zero on '%s'\n", peer->context, peer->exten, peer->priority, ast_channel_name(peer)); - ast_verb(2, "Spawn extension (%s, %s, %d) exited non-zero on '%s'\n", peer->context, peer->exten, peer->priority, ast_channel_name(peer)); + ast_debug(1, "Spawn extension (%s,%s,%d) exited non-zero on '%s'\n", ast_channel_context(peer), ast_channel_exten(peer), peer->priority, ast_channel_name(peer)); + ast_verb(2, "Spawn extension (%s, %s, %d) exited non-zero on '%s'\n", ast_channel_context(peer), ast_channel_exten(peer), peer->priority, ast_channel_name(peer)); } ast_set2_flag(peer, autoloopflag, AST_FLAG_IN_AUTOLOOP); /* set it back the way it was */ } @@ -2862,7 +2862,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast ast_parseable_goto(peer, opt_args[OPT_ARG_CALLEE_GO_ON]); } else { /* F() */ int res; - res = ast_goto_if_exists(peer, chan->context, chan->exten, (chan->priority) + 1); + res = ast_goto_if_exists(peer, ast_channel_context(chan), ast_channel_exten(chan), (chan->priority) + 1); if (res == AST_PBX_GOTO_FAILED) { ast_hangup(peer); goto out; @@ -2976,7 +2976,7 @@ static int retrydial_exec(struct ast_channel *chan, const char *data) while (loops) { int continue_exec; - chan->data = "Retrying"; + ast_channel_data_set(chan, "Retrying"); if (ast_test_flag(chan, AST_FLAG_MOH)) ast_moh_stop(chan); diff --git a/apps/app_directed_pickup.c b/apps/app_directed_pickup.c index 4fda8320e..acdb572e3 100644 --- a/apps/app_directed_pickup.c +++ b/apps/app_directed_pickup.c @@ -288,7 +288,7 @@ static int pickup_exec(struct ast_channel *chan, const char *data) return -1; } } else { - if (!pickup_by_exten(chan, exten, !ast_strlen_zero(context) ? context : chan->context)) { + if (!pickup_by_exten(chan, exten, !ast_strlen_zero(context) ? context : ast_channel_context(chan))) { /* Pickup successful. Stop the dialplan this channel is a zombie. */ return -1; } diff --git a/apps/app_directory.c b/apps/app_directory.c index a4ec93e4c..4db404cff 100644 --- a/apps/app_directory.c +++ b/apps/app_directory.c @@ -248,9 +248,9 @@ static int compare(const char *text, const char *template) static int goto_exten(struct ast_channel *chan, const char *dialcontext, char *ext) { - if (!ast_goto_if_exists(chan, S_OR(dialcontext, chan->context), ext, 1) || - (!ast_strlen_zero(chan->macrocontext) && - !ast_goto_if_exists(chan, chan->macrocontext, ext, 1))) { + if (!ast_goto_if_exists(chan, S_OR(dialcontext, ast_channel_context(chan)), ext, 1) || + (!ast_strlen_zero(ast_channel_macrocontext(chan)) && + !ast_goto_if_exists(chan, ast_channel_macrocontext(chan), ext, 1))) { return 0; } else { ast_log(LOG_WARNING, "Can't find extension '%s' in current context. " @@ -292,7 +292,7 @@ static int select_entry(struct ast_channel *chan, const char *dialcontext, const if (ast_test_flag(flags, OPT_FROMVOICEMAIL)) { /* We still want to set the exten though */ - ast_copy_string(chan->exten, item->exten, sizeof(chan->exten)); + ast_channel_exten_set(chan, item->exten); } else if (ast_goto_if_exists(chan, S_OR(dialcontext, item->context), item->exten, 1)) { ast_log(LOG_WARNING, "Can't find extension '%s' in context '%s'. " diff --git a/apps/app_dumpchan.c b/apps/app_dumpchan.c index c59d32edf..8e9c749ae 100644 --- a/apps/app_dumpchan.c +++ b/apps/app_dumpchan.c @@ -160,14 +160,14 @@ static int serialize_showchan(struct ast_channel *c, char *buf, size_t size) sec, c->_bridge ? ast_channel_name(c->_bridge) : "<none>", ast_bridged_channel(c) ? ast_channel_name(ast_bridged_channel(c)) : "<none>", - c->context, - c->exten, + ast_channel_context(c), + ast_channel_exten(c), c->priority, ast_print_group(cgrp, sizeof(cgrp), c->callgroup), ast_print_group(pgrp, sizeof(pgrp), c->pickupgroup), - c->appl ? c->appl : "(N/A)", - c->data ? S_OR(c->data, "(Empty)") : "(None)", - (ast_test_flag(c, AST_FLAG_BLOCKING) ? c->blockproc : "(Not Blocking)")); + ast_channel_appl(c) ? ast_channel_appl(c) : "(N/A)", + ast_channel_data(c) ? S_OR(ast_channel_data(c), "(Empty)") : "(None)", + (ast_test_flag(c, AST_FLAG_BLOCKING) ? ast_channel_blockproc(c) : "(Not Blocking)")); return 0; } diff --git a/apps/app_fax.c b/apps/app_fax.c index e4cf44f62..3183a5638 100644 --- a/apps/app_fax.c +++ b/apps/app_fax.c @@ -266,7 +266,7 @@ static void phase_e_handler(t30_state_t *f, void *user_data, int result) "TransferRate: %d\r\n" "FileName: %s\r\n", ast_channel_name(s->chan), - s->chan->exten, + ast_channel_exten(s->chan), S_COR(s->chan->caller.id.number.valid, s->chan->caller.id.number.str, ""), S_COR(s->chan->caller.id.name.valid, s->chan->caller.id.name.str, ""), S_COR(s->chan->connected.id.number.valid, s->chan->connected.id.number.str, ""), diff --git a/apps/app_macro.c b/apps/app_macro.c index 86017e6ed..e2b9c92a7 100644 --- a/apps/app_macro.c +++ b/apps/app_macro.c @@ -280,7 +280,7 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive } /* Used for detecting whether to return when a Macro is called from another Macro after hangup */ - if (strcmp(chan->exten, "h") == 0) + if (strcmp(ast_channel_exten(chan), "h") == 0) pbx_builtin_setvar_helper(chan, "MACRO_IN_HANGUP", "1"); if ((inhangupc = pbx_builtin_getvar_helper(chan, "MACRO_IN_HANGUP"))) { @@ -306,7 +306,7 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive if (!ast_exists_extension(chan, fullmacro, "s", 1, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { if (!ast_context_find(fullmacro)) - ast_log(LOG_WARNING, "No such context '%s' for macro '%s'. Was called by %s@%s\n", fullmacro, macro, chan->exten, chan->context); + ast_log(LOG_WARNING, "No such context '%s' for macro '%s'. Was called by %s@%s\n", fullmacro, macro, ast_channel_exten(chan), ast_channel_context(chan)); else ast_log(LOG_WARNING, "Context '%s' for macro '%s' lacks 's' extension, priority 1\n", fullmacro, macro); return 0; @@ -330,11 +330,11 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive /* Save old info */ oldpriority = chan->priority; - ast_copy_string(oldexten, chan->exten, sizeof(oldexten)); - ast_copy_string(oldcontext, chan->context, sizeof(oldcontext)); - if (ast_strlen_zero(chan->macrocontext)) { - ast_copy_string(chan->macrocontext, chan->context, sizeof(chan->macrocontext)); - ast_copy_string(chan->macroexten, chan->exten, sizeof(chan->macroexten)); + ast_copy_string(oldexten, ast_channel_exten(chan), sizeof(oldexten)); + ast_copy_string(oldcontext, ast_channel_context(chan), sizeof(oldcontext)); + if (ast_strlen_zero(ast_channel_macrocontext(chan))) { + ast_channel_macrocontext_set(chan, ast_channel_context(chan)); + ast_channel_macroexten_set(chan, ast_channel_exten(chan)); chan->macropriority = chan->priority; setmacrocontext=1; } @@ -356,9 +356,8 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive pbx_builtin_setvar_helper(chan, "MACRO_DEPTH", depthc); /* Setup environment for new run */ - chan->exten[0] = 's'; - chan->exten[1] = '\0'; - ast_copy_string(chan->context, fullmacro, sizeof(chan->context)); + ast_channel_exten_set(chan, "s"); + ast_channel_context_set(chan, fullmacro); chan->priority = 1; ast_channel_lock(chan); @@ -376,7 +375,7 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive ast_channel_unlock(chan); autoloopflag = ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP); ast_set_flag(chan, AST_FLAG_IN_AUTOLOOP); - while (ast_exists_extension(chan, chan->context, chan->exten, chan->priority, + while (ast_exists_extension(chan, ast_channel_context(chan), ast_channel_exten(chan), chan->priority, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { struct ast_context *c; struct ast_exten *e; @@ -389,11 +388,11 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive ast_log(LOG_WARNING, "Failed to lock contexts list\n"); } else { for (c = ast_walk_contexts(NULL), e = NULL; c; c = ast_walk_contexts(c)) { - if (!strcmp(ast_get_context_name(c), chan->context)) { + if (!strcmp(ast_get_context_name(c), ast_channel_context(chan))) { if (ast_rdlock_context(c)) { ast_log(LOG_WARNING, "Unable to lock context?\n"); } else { - e = find_matching_priority(c, chan->exten, chan->priority, + e = find_matching_priority(c, ast_channel_exten(chan), chan->priority, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL)); if (e) { /* This will only be undefined for pbx_realtime, which is majorly broken. */ ast_copy_string(runningapp, ast_get_extension_app(e), sizeof(runningapp)); @@ -410,7 +409,7 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive /* Reset the macro depth, if it was changed in the last iteration */ pbx_builtin_setvar_helper(chan, "MACRO_DEPTH", depthc); - res = ast_spawn_extension(chan, chan->context, chan->exten, chan->priority, + res = ast_spawn_extension(chan, ast_channel_context(chan), ast_channel_exten(chan), chan->priority, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL), &foundx, 1); if (res) { @@ -426,8 +425,8 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive res = 0; goto out; default: - ast_debug(2, "Spawn extension (%s,%s,%d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, ast_channel_name(chan), macro); - ast_verb(2, "Spawn extension (%s, %s, %d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, ast_channel_name(chan), macro); + ast_debug(2, "Spawn extension (%s,%s,%d) exited non-zero on '%s' in macro '%s'\n", ast_channel_context(chan), ast_channel_exten(chan), chan->priority, ast_channel_name(chan), macro); + ast_verb(2, "Spawn extension (%s, %s, %d) exited non-zero on '%s' in macro '%s'\n", ast_channel_context(chan), ast_channel_exten(chan), chan->priority, ast_channel_name(chan), macro); goto out; } } @@ -493,14 +492,14 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive } } - if (gosub_level == 0 && strcasecmp(chan->context, fullmacro)) { + if (gosub_level == 0 && strcasecmp(ast_channel_context(chan), fullmacro)) { ast_verb(2, "Channel '%s' jumping out of macro '%s'\n", ast_channel_name(chan), macro); break; } /* don't stop executing extensions when we're in "h" */ if (ast_check_hangup(chan) && !inhangup) { - ast_debug(1, "Extension %s, macroexten %s, priority %d returned normally even though call was hung up\n", chan->exten, chan->macroexten, chan->priority); + ast_debug(1, "Extension %s, macroexten %s, priority %d returned normally even though call was hung up\n", ast_channel_exten(chan), ast_channel_macroexten(chan), chan->priority); goto out; } chan->priority++; @@ -538,23 +537,23 @@ static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive ast_free(save_macro_priority); if (setmacrocontext) { - chan->macrocontext[0] = '\0'; - chan->macroexten[0] = '\0'; + ast_channel_macrocontext_set(chan, ""); + ast_channel_macroexten_set(chan, ""); chan->macropriority = 0; } - if (!strcasecmp(chan->context, fullmacro)) { + if (!strcasecmp(ast_channel_context(chan), fullmacro)) { const char *offsets; /* If we're leaving the macro normally, restore original information */ chan->priority = oldpriority; - ast_copy_string(chan->context, oldcontext, sizeof(chan->context)); - ast_copy_string(chan->exten, oldexten, sizeof(chan->exten)); + ast_channel_context_set(chan, oldcontext); + ast_channel_exten_set(chan, oldexten); if ((offsets = pbx_builtin_getvar_helper(chan, "MACRO_OFFSET"))) { /* Handle macro offset if it's set by checking the availability of step n + offset + 1, otherwise continue normally if there is any problem */ if (sscanf(offsets, "%30d", &offset) == 1) { - if (ast_exists_extension(chan, chan->context, chan->exten, + if (ast_exists_extension(chan, ast_channel_context(chan), ast_channel_exten(chan), chan->priority + offset + 1, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { chan->priority += offset; diff --git a/apps/app_meetme.c b/apps/app_meetme.c index 3367068f4..3c8b73f20 100644 --- a/apps/app_meetme.c +++ b/apps/app_meetme.c @@ -2592,10 +2592,10 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc ast_channel_lock(chan); if ((tmpvar = pbx_builtin_getvar_helper(chan, "MEETME_EXIT_CONTEXT"))) { ast_copy_string(exitcontext, tmpvar, sizeof(exitcontext)); - } else if (!ast_strlen_zero(chan->macrocontext)) { - ast_copy_string(exitcontext, chan->macrocontext, sizeof(exitcontext)); + } else if (!ast_strlen_zero(ast_channel_macrocontext(chan))) { + ast_copy_string(exitcontext, ast_channel_macrocontext(chan), sizeof(exitcontext)); } else { - ast_copy_string(exitcontext, chan->context, sizeof(exitcontext)); + ast_copy_string(exitcontext, ast_channel_context(chan), sizeof(exitcontext)); } ast_channel_unlock(chan); } diff --git a/apps/app_minivm.c b/apps/app_minivm.c index 3ffe06187..9c87a7464 100644 --- a/apps/app_minivm.c +++ b/apps/app_minivm.c @@ -1942,9 +1942,9 @@ static int leave_voicemail(struct ast_channel *chan, char *username, struct leav /* "Mailbox:domain:macrocontext:exten:priority:callerchan:callerid:origdate:origtime:duration:durationstatus:accountcode" */ "%s:%s:%s:%s:%d:%s:%s:%s:%s:%d:%s:%s\n", username, - chan->context, - chan->macrocontext, - chan->exten, + ast_channel_context(chan), + ast_channel_macrocontext(chan), + ast_channel_exten(chan), chan->priority, ast_channel_name(chan), callerid, @@ -2308,13 +2308,13 @@ static int minivm_greet_exec(struct ast_channel *chan, const char *data) strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1); ouseexten = 1; } - } else if (ast_exists_extension(chan, chan->context, "o", 1, + } else if (ast_exists_extension(chan, ast_channel_context(chan), "o", 1, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1); ouseexten = 1; } - else if (!ast_strlen_zero(chan->macrocontext) - && ast_exists_extension(chan, chan->macrocontext, "o", 1, + else if (!ast_strlen_zero(ast_channel_macrocontext(chan)) + && ast_exists_extension(chan, ast_channel_macrocontext(chan), "o", 1, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1); ousemacro = 1; @@ -2326,11 +2326,11 @@ static int minivm_greet_exec(struct ast_channel *chan, const char *data) S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1); } - } else if (ast_exists_extension(chan, chan->context, "a", 1, + } else if (ast_exists_extension(chan, ast_channel_context(chan), "a", 1, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1); - } else if (!ast_strlen_zero(chan->macrocontext) - && ast_exists_extension(chan, chan->macrocontext, "a", 1, + } else if (!ast_strlen_zero(ast_channel_macrocontext(chan)) + && ast_exists_extension(chan, ast_channel_macrocontext(chan), "a", 1, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1); ausemacro = 1; @@ -2371,24 +2371,22 @@ static int minivm_greet_exec(struct ast_channel *chan, const char *data) /* Check for a '*' here in case the caller wants to escape from voicemail to something other than the operator -- an automated attendant or mailbox login for example */ if (res == '*') { - chan->exten[0] = 'a'; - chan->exten[1] = '\0'; + ast_channel_exten_set(chan, "a"); if (!ast_strlen_zero(vmu->exit)) { - ast_copy_string(chan->context, vmu->exit, sizeof(chan->context)); - } else if (ausemacro && !ast_strlen_zero(chan->macrocontext)) { - ast_copy_string(chan->context, chan->macrocontext, sizeof(chan->context)); + ast_channel_context_set(chan, vmu->exit); + } else if (ausemacro && !ast_strlen_zero(ast_channel_macrocontext(chan))) { + ast_channel_context_set(chan, ast_channel_macrocontext(chan)); } chan->priority = 0; pbx_builtin_setvar_helper(chan, "MVM_GREET_STATUS", "USEREXIT"); res = 0; } else if (res == '0') { /* Check for a '0' here */ if(ouseexten || ousemacro) { - chan->exten[0] = 'o'; - chan->exten[1] = '\0'; + ast_channel_exten_set(chan, "o"); if (!ast_strlen_zero(vmu->exit)) { - ast_copy_string(chan->context, vmu->exit, sizeof(chan->context)); - } else if (ousemacro && !ast_strlen_zero(chan->macrocontext)) { - ast_copy_string(chan->context, chan->macrocontext, sizeof(chan->context)); + ast_channel_context_set(chan, vmu->exit); + } else if (ousemacro && !ast_strlen_zero(ast_channel_macrocontext(chan))) { + ast_channel_context_set(chan, ast_channel_macrocontext(chan)); } ast_play_and_wait(chan, "transfer"); chan->priority = 0; diff --git a/apps/app_osplookup.c b/apps/app_osplookup.c index 4ce2846cf..a74d1b501 100644 --- a/apps/app_osplookup.c +++ b/apps/app_osplookup.c @@ -2296,7 +2296,7 @@ static int ospauth_exec( res = osp_auth(provider, &handle, source, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL), - chan->exten, token, &timelimit); + ast_channel_exten(chan), token, &timelimit); if (res > 0) { status = AST_OSP_SUCCESS; } else { diff --git a/apps/app_parkandannounce.c b/apps/app_parkandannounce.c index aecd7cebe..4b779bd32 100644 --- a/apps/app_parkandannounce.c +++ b/apps/app_parkandannounce.c @@ -141,10 +141,10 @@ static int parkandannounce_exec(struct ast_channel *chan, const char *data) ast_parseable_goto(chan, args.return_context); } - ast_verb(3, "Return Context: (%s,%s,%d) ID: %s\n", chan->context, chan->exten, + ast_verb(3, "Return Context: (%s,%s,%d) ID: %s\n", ast_channel_context(chan), ast_channel_exten(chan), chan->priority, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, "")); - if (!ast_exists_extension(chan, chan->context, chan->exten, chan->priority, + if (!ast_exists_extension(chan, ast_channel_context(chan), ast_channel_exten(chan), chan->priority, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { ast_verb(3, "Warning: Return Context Invalid, call will return to default|s\n"); } diff --git a/apps/app_queue.c b/apps/app_queue.c index 12bdb45ba..2a8b51322 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -3173,8 +3173,8 @@ static int ring_entry(struct queue_ent *qe, struct callattempt *tmp, int *busies if (qe->cancel_answered_elsewhere) { ast_set_flag(tmp->chan, AST_FLAG_ANSWERED_ELSEWHERE); } - tmp->chan->appl = "AppQueue"; - tmp->chan->data = "(Outgoing Line)"; + ast_channel_appl_set(tmp->chan, "AppQueue"); + ast_channel_data_set(tmp->chan, "(Outgoing Line)"); memset(&tmp->chan->whentohangup, 0, sizeof(tmp->chan->whentohangup)); /* If the new channel has no callerid, try to guess what it should be */ @@ -3188,8 +3188,8 @@ static int ring_entry(struct queue_ent *qe, struct callattempt *tmp, int *busies ast_channel_set_caller_event(tmp->chan, &caller, NULL); } else if (!ast_strlen_zero(qe->chan->dialed.number.str)) { ast_set_callerid(tmp->chan, qe->chan->dialed.number.str, NULL, NULL); - } else if (!ast_strlen_zero(S_OR(qe->chan->macroexten, qe->chan->exten))) { - ast_set_callerid(tmp->chan, S_OR(qe->chan->macroexten, qe->chan->exten), NULL, NULL); + } else if (!ast_strlen_zero(S_OR(ast_channel_macroexten(qe->chan), ast_channel_exten(qe->chan)))) { + ast_set_callerid(tmp->chan, S_OR(ast_channel_macroexten(qe->chan), ast_channel_exten(qe->chan)), NULL, NULL); } tmp->dial_callerid_absent = 1; } @@ -3209,12 +3209,12 @@ static int ring_entry(struct queue_ent *qe, struct callattempt *tmp, int *busies /* Inherit context and extension */ macrocontext = pbx_builtin_getvar_helper(qe->chan, "MACRO_CONTEXT"); - ast_channel_dialcontext_set(tmp->chan, ast_strlen_zero(macrocontext) ? qe->chan->context : macrocontext); + ast_channel_dialcontext_set(tmp->chan, ast_strlen_zero(macrocontext) ? ast_channel_context(qe->chan) : macrocontext); macroexten = pbx_builtin_getvar_helper(qe->chan, "MACRO_EXTEN"); if (!ast_strlen_zero(macroexten)) - ast_copy_string(tmp->chan->exten, macroexten, sizeof(tmp->chan->exten)); + ast_channel_exten_set(tmp->chan, macroexten); else - ast_copy_string(tmp->chan->exten, qe->chan->exten, sizeof(tmp->chan->exten)); + ast_channel_exten_set(tmp->chan, ast_channel_exten(qe->chan)); if (ast_cdr_isset_unanswered()) { /* they want to see the unanswered dial attempts! */ /* set up the CDR fields on all the CDRs to give sensical information */ @@ -3222,8 +3222,8 @@ static int ring_entry(struct queue_ent *qe, struct callattempt *tmp, int *busies strcpy(tmp->chan->cdr->clid, qe->chan->cdr->clid); strcpy(tmp->chan->cdr->channel, qe->chan->cdr->channel); strcpy(tmp->chan->cdr->src, qe->chan->cdr->src); - strcpy(tmp->chan->cdr->dst, qe->chan->exten); - strcpy(tmp->chan->cdr->dcontext, qe->chan->context); + strcpy(tmp->chan->cdr->dst, ast_channel_exten(qe->chan)); + strcpy(tmp->chan->cdr->dcontext, ast_channel_context(qe->chan)); strcpy(tmp->chan->cdr->lastapp, qe->chan->cdr->lastapp); strcpy(tmp->chan->cdr->lastdata, qe->chan->cdr->lastdata); tmp->chan->cdr->amaflags = qe->chan->cdr->amaflags; @@ -3268,7 +3268,7 @@ static int ring_entry(struct queue_ent *qe, struct callattempt *tmp, int *busies S_COR(qe->chan->caller.id.name.valid, qe->chan->caller.id.name.str, "unknown"), S_COR(qe->chan->connected.id.number.valid, qe->chan->connected.id.number.str, "unknown"), S_COR(qe->chan->connected.id.name.valid, qe->chan->connected.id.name.str, "unknown"), - qe->chan->context, qe->chan->exten, qe->chan->priority, ast_channel_uniqueid(qe->chan), + ast_channel_context(qe->chan), ast_channel_exten(qe->chan), qe->chan->priority, ast_channel_uniqueid(qe->chan), qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : ""); ast_channel_unlock(tmp->chan); @@ -3689,7 +3689,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte *stuff++ = '\0'; tech = tmpchan; } else { - snprintf(tmpchan, sizeof(tmpchan), "%s@%s", ast_channel_call_forward(o->chan), o->chan->context); + snprintf(tmpchan, sizeof(tmpchan), "%s@%s", ast_channel_call_forward(o->chan), ast_channel_context(o->chan)); stuff = tmpchan; tech = "Local"; } @@ -3726,7 +3726,7 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte ast_party_number_init(&o->chan->redirecting.from.number); o->chan->redirecting.from.number.valid = 1; o->chan->redirecting.from.number.str = - ast_strdup(S_OR(in->macroexten, in->exten)); + ast_strdup(S_OR(ast_channel_macroexten(in), ast_channel_exten(in))); } o->chan->dialed.transit_network_select = in->dialed.transit_network_select; @@ -4313,7 +4313,7 @@ static void queue_transfer_fixup(void *data, struct ast_channel *old_chan, struc struct ast_datastore *datastore; ast_queue_log(qe->parent->name, ast_channel_uniqueid(qe->chan), member->membername, "TRANSFER", "%s|%s|%ld|%ld|%d", - new_chan->exten, new_chan->context, (long) (callstart - qe->start), + ast_channel_exten(new_chan), ast_channel_context(new_chan), (long) (callstart - qe->start), (long) (time(NULL) - callstart), qe->opos); update_queue(qe->parent, member, callcompletedinsl, (time(NULL) - callstart)); @@ -5037,8 +5037,8 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce char *gosub_args, *gosub_argstart; /* Set where we came from */ - ast_copy_string(peer->context, "app_queue_gosub_virtual_context", sizeof(peer->context)); - ast_copy_string(peer->exten, "s", sizeof(peer->exten)); + ast_channel_context_set(peer, "app_queue_gosub_virtual_context"); + ast_channel_exten_set(peer, "s"); peer->priority = 0; gosub_argstart = strchr(gosubexec, ','); @@ -5143,8 +5143,8 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce queuename, ast_channel_uniqueid(qe->chan), ast_channel_name(peer), member->interface, member->membername, (long) time(NULL) - qe->start, ast_channel_uniqueid(peer), (long)(orig - to > 0 ? (orig - to) / 1000 : 0), qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : ""); - ast_copy_string(oldcontext, qe->chan->context, sizeof(oldcontext)); - ast_copy_string(oldexten, qe->chan->exten, sizeof(oldexten)); + ast_copy_string(oldcontext, ast_channel_context(qe->chan), sizeof(oldcontext)); + ast_copy_string(oldexten, ast_channel_exten(qe->chan), sizeof(oldexten)); if ((queue_end_bridge = ao2_alloc(sizeof(*queue_end_bridge), NULL))) { queue_end_bridge->q = qe->parent; @@ -5172,9 +5172,9 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce struct ast_datastore *tds; /* detect a blind transfer */ - if (!(qe->chan->_softhangup | peer->_softhangup) && (strcasecmp(oldcontext, qe->chan->context) || strcasecmp(oldexten, qe->chan->exten))) { + if (!(qe->chan->_softhangup | peer->_softhangup) && (strcasecmp(oldcontext, ast_channel_context(qe->chan)) || strcasecmp(oldexten, ast_channel_exten(qe->chan)))) { ast_queue_log(queuename, ast_channel_uniqueid(qe->chan), member->membername, "TRANSFER", "%s|%s|%ld|%ld|%d", - qe->chan->exten, qe->chan->context, (long) (callstart - qe->start), + ast_channel_exten(qe->chan), ast_channel_context(qe->chan), (long) (callstart - qe->start), (long) (time(NULL) - callstart), qe->opos); send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), TRANSFER); } else if (ast_check_hangup(qe->chan)) { diff --git a/apps/app_readexten.c b/apps/app_readexten.c index dc2e482c3..5e6f3ed44 100644 --- a/apps/app_readexten.c +++ b/apps/app_readexten.c @@ -129,7 +129,7 @@ static int readexten_exec(struct ast_channel *chan, const char *data) AST_APP_ARG(options); AST_APP_ARG(timeout); ); - + if (ast_strlen_zero(data)) { ast_log(LOG_WARNING, "ReadExten requires at least one argument\n"); pbx_builtin_setvar_helper(chan, "READEXTENSTATUS", "ERROR"); @@ -145,14 +145,17 @@ static int readexten_exec(struct ast_channel *chan, const char *data) return 0; } - if (ast_strlen_zero(arglist.filename)) + if (ast_strlen_zero(arglist.filename)) { arglist.filename = NULL; + } - if (ast_strlen_zero(arglist.context)) - arglist.context = chan->context; + if (ast_strlen_zero(arglist.context)) { + arglist.context = ast_strdupa(ast_channel_context(chan)); + } - if (!ast_strlen_zero(arglist.options)) + if (!ast_strlen_zero(arglist.options)) { ast_app_parse_options(readexten_app_options, &flags, NULL, arglist.options); + } if (!ast_strlen_zero(arglist.timeout)) { timeout = atoi(arglist.timeout); diff --git a/apps/app_rpt.c b/apps/app_rpt.c index 4dc196e62..51fd0fc46 100644 --- a/apps/app_rpt.c +++ b/apps/app_rpt.c @@ -1380,7 +1380,7 @@ static int priority_jump(struct rpt *myrpt, struct ast_channel *chan) int res=0; // if (ast_test_flag(&flags,OPT_JUMP) && ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101) == 0){ - if (ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101) == 0){ + if (ast_goto_if_exists(chan, ast_channel_context(chan), ast_channel_exten(chan), chan->priority + 101) == 0){ res = 0; } else { res = -1; @@ -5487,8 +5487,8 @@ struct ast_format_cap *cap = NULL; } } - ast_copy_string(mychannel->exten, myrpt->exten, sizeof(mychannel->exten) - 1); - ast_copy_string(mychannel->context, myrpt->patchcontext, sizeof(mychannel->context) - 1); + ast_channel_exten_set(mychannel, myrpt->exten); + ast_channel_context_set(mychannel, myrpt->patchcontext); if (myrpt->p.acctcode) ast_cdr_setaccount(mychannel,myrpt->p.acctcode); @@ -5825,8 +5825,8 @@ static int connect_link(struct rpt *myrpt, char* node, int mode, int perma) #ifndef NEW_ASTERISK l->chan->whentohangup = 0; #endif - l->chan->appl = "Apprpt"; - l->chan->data = "(Remote Rx)"; + ast_channel_appl_set(l->chan, "Apprpt"); + ast_channel_data_set(l->chan, "(Remote Rx)"); if (debug > 3) ast_log(LOG_NOTICE, "rpt (remote) initiating call to %s/%s on %s\n", deststr, tele, ast_channel_name(l->chan)); @@ -10408,8 +10408,8 @@ static int attempt_reconnect(struct rpt *myrpt, struct rpt_link *l) #ifndef NEW_ASTERISK l->chan->whentohangup = 0; #endif - l->chan->appl = "Apprpt"; - l->chan->data = "(Remote Rx)"; + ast_channel_appl_set(l->chan, "Apprpt"); + ast_channel_data_set(l->chan, "(Remote Rx)"); ast_verb(3, "rpt (attempt_reconnect) initiating call to %s/%s on %s\n", deststr, tele, ast_channel_name(l->chan)); l->chan->caller.id.number.valid = 1; @@ -13435,17 +13435,17 @@ static int rpt_exec(struct ast_channel *chan, const char *data) #else if(exten) #endif - strncpy(chan->exten, exten, sizeof(chan->exten)-1); + ast_channel_exten_set(chan, exten); if(context) - strncpy(chan->context, context, sizeof(chan->context)-1); + ast_channel_context_set(chan, context); } else { /* increment the priority by default*/ chan->priority++; } ast_verb(3, "Return Context: (%s,%s,%d) ID: %s\n", - chan->context, chan->exten, chan->priority, + ast_channel_context(chan), ast_channel_exten(chan), chan->priority, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, "")); - if (!ast_exists_extension(chan, chan->context, chan->exten, chan->priority, + if (!ast_exists_extension(chan, ast_channel_context(chan), ast_channel_exten(chan), chan->priority, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { ast_verb(3, "Warning: Return Context Invalid, call will return to default|s\n"); } @@ -13824,8 +13824,8 @@ static int rpt_exec(struct ast_channel *chan, const char *data) #ifndef NEW_ASTERISK myrpt->rxchannel->whentohangup = 0; #endif - myrpt->rxchannel->appl = "Apprpt"; - myrpt->rxchannel->data = "(Link Rx)"; + ast_channel_appl_set(myrpt->rxchannel, "Apprpt"); + ast_channel_data_set(myrpt->rxchannel, "(Link Rx)"); ast_verb(3, "rpt (Rx) initiating call to %s/%s on %s\n", myrpt->rxchanname,tele,ast_channel_name(myrpt->rxchannel)); rpt_mutex_unlock(&myrpt->lock); @@ -13866,8 +13866,8 @@ static int rpt_exec(struct ast_channel *chan, const char *data) #ifndef NEW_ASTERISK myrpt->txchannel->whentohangup = 0; #endif - myrpt->txchannel->appl = "Apprpt"; - myrpt->txchannel->data = "(Link Tx)"; + ast_channel_appl_set(myrpt->txchannel, "Apprpt"); + ast_channel_data_set(myrpt->txchannel, "(Link Tx)"); ast_verb(3, "rpt (Tx) initiating call to %s/%s on %s\n", myrpt->txchanname,tele,ast_channel_name(myrpt->txchannel)); rpt_mutex_unlock(&myrpt->lock); diff --git a/apps/app_stack.c b/apps/app_stack.c index 720ca556e..f45c07817 100644 --- a/apps/app_stack.c +++ b/apps/app_stack.c @@ -402,7 +402,7 @@ static int gosub_exec(struct ast_channel *chan, const char *data) } /* Create the return address, but don't save it until we know that the Gosub destination exists */ - newframe = gosub_allocate_frame(chan->context, chan->exten, chan->priority + 1, max_argc); + newframe = gosub_allocate_frame(ast_channel_context(chan), ast_channel_exten(chan), chan->priority + 1, max_argc); if (!newframe) { return -1; @@ -414,13 +414,13 @@ static int gosub_exec(struct ast_channel *chan, const char *data) return -1; } - if (!ast_exists_extension(chan, chan->context, chan->exten, + if (!ast_exists_extension(chan, ast_channel_context(chan), ast_channel_exten(chan), ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP) ? chan->priority + 1 : chan->priority, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { ast_log(LOG_ERROR, "Attempt to reach a non-existent destination for gosub: (Context:%s, Extension:%s, Priority:%d)\n", - chan->context, chan->exten, ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP) ? chan->priority + 1 : chan->priority); - ast_copy_string(chan->context, newframe->context, sizeof(chan->context)); - ast_copy_string(chan->exten, newframe->extension, sizeof(chan->exten)); + ast_channel_context(chan), ast_channel_exten(chan), ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP) ? chan->priority + 1 : chan->priority); + ast_channel_context_set(chan, newframe->context); + ast_channel_exten_set(chan, newframe->extension); chan->priority = newframe->priority; ast_free(newframe); return -1; @@ -605,8 +605,8 @@ static int handle_gosub(struct ast_channel *chan, AGI *agi, int argc, const char } /* Save previous location, since we're going to change it */ - ast_copy_string(old_context, chan->context, sizeof(old_context)); - ast_copy_string(old_extension, chan->exten, sizeof(old_extension)); + ast_copy_string(old_context, ast_channel_context(chan), sizeof(old_context)); + ast_copy_string(old_extension, ast_channel_exten(chan), sizeof(old_extension)); old_priority = chan->priority; if (!(theapp = pbx_findapp("Gosub"))) { @@ -667,8 +667,8 @@ static int handle_gosub(struct ast_channel *chan, AGI *agi, int argc, const char } /* Restore previous location */ - ast_copy_string(chan->context, old_context, sizeof(chan->context)); - ast_copy_string(chan->exten, old_extension, sizeof(chan->exten)); + ast_channel_context_set(chan, old_context); + ast_channel_exten_set(chan, old_extension); chan->priority = old_priority; return RESULT_SUCCESS; diff --git a/apps/app_talkdetect.c b/apps/app_talkdetect.c index 5259d6f8f..5c0ee339b 100644 --- a/apps/app_talkdetect.c +++ b/apps/app_talkdetect.c @@ -180,7 +180,7 @@ static int background_detect_exec(struct ast_channel *chan, const char *data) char t[2]; t[0] = fr->subclass.integer; t[1] = '\0'; - if (ast_canmatch_extension(chan, chan->context, t, 1, + if (ast_canmatch_extension(chan, ast_channel_context(chan), t, 1, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { /* They entered a valid extension, or might be anyhow */ res = fr->subclass.integer; @@ -207,7 +207,7 @@ static int background_detect_exec(struct ast_channel *chan, const char *data) snprintf(ms_str, sizeof(ms_str), "%d", ms); pbx_builtin_setvar_helper(chan, "TALK_DETECTED", ms_str); - ast_goto_if_exists(chan, chan->context, "talk", 1); + ast_goto_if_exists(chan, ast_channel_context(chan), "talk", 1); res = 0; ast_frfree(fr); break; diff --git a/apps/app_verbose.c b/apps/app_verbose.c index c8c64617c..14ff2fb05 100644 --- a/apps/app_verbose.c +++ b/apps/app_verbose.c @@ -155,8 +155,8 @@ static int log_exec(struct ast_channel *chan, const char *data) } if (lnum > -1) { - snprintf(context, sizeof(context), "@ %s", chan->context); - snprintf(extension, sizeof(extension), "Ext. %s", chan->exten); + snprintf(context, sizeof(context), "@ %s", ast_channel_context(chan)); + snprintf(extension, sizeof(extension), "Ext. %s", ast_channel_exten(chan)); ast_log(lnum, extension, chan->priority, context, "%s\n", args.msg); } diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 2b518a23e..484f4499f 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -5800,12 +5800,12 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1); ouseexten = 1; } - } else if (ast_exists_extension(chan, chan->context, "o", 1, + } else if (ast_exists_extension(chan, ast_channel_context(chan), "o", 1, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1); ouseexten = 1; - } else if (!ast_strlen_zero(chan->macrocontext) - && ast_exists_extension(chan, chan->macrocontext, "o", 1, + } else if (!ast_strlen_zero(ast_channel_macrocontext(chan)) + && ast_exists_extension(chan, ast_channel_macrocontext(chan), "o", 1, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1); ousemacro = 1; @@ -5817,11 +5817,11 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1); } - } else if (ast_exists_extension(chan, chan->context, "a", 1, + } else if (ast_exists_extension(chan, ast_channel_context(chan), "a", 1, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1); - } else if (!ast_strlen_zero(chan->macrocontext) - && ast_exists_extension(chan, chan->macrocontext, "a", 1, + } else if (!ast_strlen_zero(ast_channel_macrocontext(chan)) + && ast_exists_extension(chan, ast_channel_macrocontext(chan), "a", 1, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { strncat(ecodes, "*", sizeof(ecodes) - strlen(ecodes) - 1); ausemacro = 1; @@ -5832,7 +5832,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ char e[2] = ""; e[0] = *code; if (strchr(ecodes, e[0]) == NULL - && ast_canmatch_extension(chan, chan->context, e, 1, + && ast_canmatch_extension(chan, ast_channel_context(chan), e, 1, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { strncat(ecodes, e, sizeof(ecodes) - strlen(ecodes) - 1); } @@ -5891,12 +5891,11 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ /* Check for a '*' here in case the caller wants to escape from voicemail to something other than the operator -- an automated attendant or mailbox login for example */ if (res == '*') { - chan->exten[0] = 'a'; - chan->exten[1] = '\0'; + ast_channel_exten_set(chan, "a"); if (!ast_strlen_zero(vmu->exit)) { - ast_copy_string(chan->context, vmu->exit, sizeof(chan->context)); - } else if (ausemacro && !ast_strlen_zero(chan->macrocontext)) { - ast_copy_string(chan->context, chan->macrocontext, sizeof(chan->context)); + ast_channel_context_set(chan, vmu->exit); + } else if (ausemacro && !ast_strlen_zero(ast_channel_macrocontext(chan))) { + ast_channel_context_set(chan, ast_channel_macrocontext(chan)); } chan->priority = 0; free_user(vmu); @@ -5909,12 +5908,11 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ if (ast_test_flag(vmu, VM_OPERATOR) && res == '0') { transfer: if (ouseexten || ousemacro) { - chan->exten[0] = 'o'; - chan->exten[1] = '\0'; + ast_channel_exten_set(chan, "o"); if (!ast_strlen_zero(vmu->exit)) { - ast_copy_string(chan->context, vmu->exit, sizeof(chan->context)); - } else if (ousemacro && !ast_strlen_zero(chan->macrocontext)) { - ast_copy_string(chan->context, chan->macrocontext, sizeof(chan->context)); + ast_channel_context_set(chan, vmu->exit); + } else if (ousemacro && !ast_strlen_zero(ast_channel_macrocontext(chan))) { + ast_channel_context_set(chan, ast_channel_macrocontext(chan)); } ast_play_and_wait(chan, "transfer"); chan->priority = 0; @@ -5928,7 +5926,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ /* Allow all other digits to exit Voicemail and return to the dialplan */ if (ast_test_flag(options, OPT_DTMFEXIT) && res > 0) { if (!ast_strlen_zero(options->exitcontext)) - ast_copy_string(chan->context, options->exitcontext, sizeof(chan->context)); + ast_channel_context_set(chan, options->exitcontext); free_user(vmu); pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT"); ast_free(tmp); @@ -6020,9 +6018,9 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ "Unknown"); ast_store_realtime("voicemail_data", "origmailbox", ext, - "context", chan->context, - "macrocontext", chan->macrocontext, - "exten", chan->exten, + "context", ast_channel_context(chan), + "macrocontext", ast_channel_macrocontext(chan), + "exten", ast_channel_exten(chan), "priority", priority, "callerchan", ast_channel_name(chan), "callerid", callerid, @@ -6058,9 +6056,9 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ "origtime=%ld\n" "category=%s\n", ext, - chan->context, - chan->macrocontext, - chan->exten, + ast_channel_context(chan), + ast_channel_macrocontext(chan), + ast_channel_exten(chan), S_COR(chan->redirecting.from.number.valid, chan->redirecting.from.number.str, "unknown"), chan->priority, @@ -7306,32 +7304,32 @@ static int forward_message(struct ast_channel *chan, char *context, struct vm_st if (cmd < 0 || cmd == 't') break; } - + if (use_directory) { /* use app_directory */ - - char old_context[sizeof(chan->context)]; - char old_exten[sizeof(chan->exten)]; - int old_priority; + struct ast_app* directory_app; directory_app = pbx_findapp("Directory"); if (directory_app) { char vmcontext[256]; + char *old_context; + char *old_exten; + int old_priority; /* make backup copies */ - memcpy(old_context, chan->context, sizeof(chan->context)); - memcpy(old_exten, chan->exten, sizeof(chan->exten)); + old_context = ast_strdupa(ast_channel_context(chan)); + old_exten = ast_strdupa(ast_channel_exten(chan)); old_priority = chan->priority; - + /* call the the Directory, changes the channel */ snprintf(vmcontext, sizeof(vmcontext), "%s,,v", context ? context : "default"); res = pbx_exec(chan, directory_app, vmcontext); - - ast_copy_string(username, chan->exten, sizeof(username)); - + + ast_copy_string(username, ast_channel_exten(chan), sizeof(username)); + /* restore the old context, exten, and priority */ - memcpy(chan->context, old_context, sizeof(chan->context)); - memcpy(chan->exten, old_exten, sizeof(chan->exten)); + ast_channel_context_set(chan, old_context); + ast_channel_exten_set(chan, old_exten); chan->priority = old_priority; } else { ast_log(AST_LOG_WARNING, "Could not find the Directory application, disabling directory_forward\n"); @@ -9874,7 +9872,7 @@ static int vm_authenticate(struct ast_channel *chan, char *mailbox, int mailbox_ } else if (mailbox[0] == '*') { /* user entered '*' */ ast_verb(4, "Mailbox begins with '*', attempting jump to extension 'a'\n"); - if (ast_exists_extension(chan, chan->context, "a", 1, + if (ast_exists_extension(chan, ast_channel_context(chan), "a", 1, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { return -1; } @@ -9909,7 +9907,7 @@ static int vm_authenticate(struct ast_channel *chan, char *mailbox, int mailbox_ } else if (password[0] == '*') { /* user entered '*' */ ast_verb(4, "Password begins with '*', attempting jump to extension 'a'\n"); - if (ast_exists_extension(chan, chan->context, "a", 1, + if (ast_exists_extension(chan, ast_channel_context(chan), "a", 1, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { mailbox[0] = '*'; return -1; @@ -10088,10 +10086,10 @@ static int vm_execmain(struct ast_channel *chan, const char *data) ast_debug(1, "After vm_authenticate\n"); if (vms.username[0] == '*') { - ast_debug(1, "user pressed * in context '%s'\n", chan->context); + ast_debug(1, "user pressed * in context '%s'\n", ast_channel_context(chan)); /* user entered '*' */ - if (!ast_goto_if_exists(chan, chan->context, "a", 1)) { + if (!ast_goto_if_exists(chan, ast_channel_context(chan), "a", 1)) { ast_test_suite_event_notify("REDIRECT", "Message: redirecting user to 'a' extension"); res = 0; /* prevent hangup */ goto out; @@ -11250,7 +11248,7 @@ static int vmauthenticate(struct ast_channel *chan, const char *data) res = 0; } else if (mailbox[0] == '*') { /* user entered '*' */ - if (!ast_goto_if_exists(chan, chan->context, "a", 1)) { + if (!ast_goto_if_exists(chan, ast_channel_context(chan), "a", 1)) { res = 0; /* prevent hangup */ } } @@ -13445,9 +13443,9 @@ static int dialout(struct ast_channel *chan, struct ast_vm_user *vmu, char *num, if (!ast_strlen_zero(destination)) { if (destination[strlen(destination) -1 ] == '*') return 0; - ast_verb(3, "Placing outgoing call to extension '%s' in context '%s' from context '%s'\n", destination, outgoing_context, chan->context); - ast_copy_string(chan->exten, destination, sizeof(chan->exten)); - ast_copy_string(chan->context, outgoing_context, sizeof(chan->context)); + ast_verb(3, "Placing outgoing call to extension '%s' in context '%s' from context '%s'\n", destination, outgoing_context, ast_channel_context(chan)); + ast_channel_exten_set(chan, destination); + ast_channel_context_set(chan, outgoing_context); chan->priority = 0; return 9; } diff --git a/apps/app_while.c b/apps/app_while.c index 45bd65594..25d7c433b 100644 --- a/apps/app_while.c +++ b/apps/app_while.c @@ -163,14 +163,14 @@ static int find_matching_endwhile(struct ast_channel *chan) struct ast_exten *e; if (!ast_rdlock_context(c)) { - if (!strcmp(ast_get_context_name(c), chan->context)) { + if (!strcmp(ast_get_context_name(c), ast_channel_context(chan))) { /* This is the matching context we want */ int cur_priority = chan->priority + 1, level=1; - for (e = find_matching_priority(c, chan->exten, cur_priority, + for (e = find_matching_priority(c, ast_channel_exten(chan), cur_priority, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL)); e; - e = find_matching_priority(c, chan->exten, ++cur_priority, + e = find_matching_priority(c, ast_channel_exten(chan), ++cur_priority, S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) { if (!strcasecmp(ast_get_extension_app(e), "WHILE")) { level++; @@ -235,10 +235,10 @@ static int _while_exec(struct ast_channel *chan, const char *data, int end) if (!end) condition = ast_strdupa(data); - size = strlen(chan->context) + strlen(chan->exten) + 32; + size = strlen(ast_channel_context(chan)) + strlen(ast_channel_exten(chan)) + 32; my_name = alloca(size); memset(my_name, 0, size); - snprintf(my_name, size, "%s_%s_%d", chan->context, chan->exten, chan->priority); + snprintf(my_name, size, "%s_%s_%d", ast_channel_context(chan), ast_channel_exten(chan), chan->priority); ast_channel_lock(chan); if (end) { @@ -271,7 +271,7 @@ static int _while_exec(struct ast_channel *chan, const char *data, int end) ast_verb(3, "Jumping to priority %d\n", pri); chan->priority = pri; } else { - ast_log(LOG_WARNING, "Couldn't find matching EndWhile? (While at %s@%s priority %d)\n", chan->context, chan->exten, chan->priority); + ast_log(LOG_WARNING, "Couldn't find matching EndWhile? (While at %s@%s priority %d)\n", ast_channel_context(chan), ast_channel_exten(chan), chan->priority); } } ast_channel_unlock(chan); @@ -280,10 +280,10 @@ static int _while_exec(struct ast_channel *chan, const char *data, int end) if (!end && !while_pri) { char *goto_str; - size = strlen(chan->context) + strlen(chan->exten) + 32; + size = strlen(ast_channel_context(chan)) + strlen(ast_channel_exten(chan)) + 32; goto_str = alloca(size); memset(goto_str, 0, size); - snprintf(goto_str, size, "%s,%s,%d", chan->context, chan->exten, chan->priority); + snprintf(goto_str, size, "%s,%s,%d", ast_channel_context(chan), ast_channel_exten(chan), chan->priority); pbx_builtin_setvar_helper(chan, varname, goto_str); } @@ -292,10 +292,10 @@ static int _while_exec(struct ast_channel *chan, const char *data, int end) snprintf(end_varname, VAR_SIZE, "END_%s", varname); if (! pbx_builtin_getvar_helper(chan, end_varname)) { char *goto_str; - size = strlen(chan->context) + strlen(chan->exten) + 32; + size = strlen(ast_channel_context(chan)) + strlen(ast_channel_exten(chan)) + 32; goto_str = alloca(size); memset(goto_str, 0, size); - snprintf(goto_str, size, "%s,%s,%d", chan->context, chan->exten, chan->priority+1); + snprintf(goto_str, size, "%s,%s,%d", ast_channel_context(chan), ast_channel_exten(chan), chan->priority+1); pbx_builtin_setvar_helper(chan, end_varname, goto_str); } ast_parseable_goto(chan, while_pri); |