From c6979ff581f9f15ce96b3052863d0ac35f4cd387 Mon Sep 17 00:00:00 2001 From: Jonathan Rose Date: Thu, 22 Mar 2012 21:25:22 +0000 Subject: Adds F option to Bridge application Similar to dial and queue F option. (Closes issue ASTERISK-19282) Reported by: To Patches: bridge_f-v3.diff uploaded by To (license 6347) Review: https://reviewboard.asterisk.org/r/1825/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360227 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_dial.c | 19 ++++++------------- apps/app_queue.c | 17 +---------------- 2 files changed, 7 insertions(+), 29 deletions(-) (limited to 'apps') diff --git a/apps/app_dial.c b/apps/app_dial.c index fbd4ef68b..902b78144 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -1615,13 +1615,6 @@ static int detect_disconnect(struct ast_channel *chan, char code, struct ast_str return 0; } -static void replace_macro_delimiter(char *s) -{ - for (; *s; s++) - if (*s == '^') - *s = ','; -} - /* returns true if there is a valid privacy reply */ static int valid_priv_reply(struct ast_flags64 *opts, int res) { @@ -2628,7 +2621,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast ast_clear_flag(ast_channel_cdr(chan), AST_CDR_FLAG_DIALED); ast_clear_flag(ast_channel_cdr(peer), AST_CDR_FLAG_DIALED); - replace_macro_delimiter(opt_args[OPT_ARG_GOTO]); + ast_replace_subargument_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_channel_context_set(peer, ast_channel_context(chan)); @@ -2659,7 +2652,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast 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]); + ast_replace_subargument_delimiter(opt_args[OPT_ARG_CALLEE_MACRO]); res = pbx_exec(peer, theapp, opt_args[OPT_ARG_CALLEE_MACRO]); ast_debug(1, "Macro exited with status %d\n", res); res = 0; @@ -2699,7 +2692,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast res = -1; /* perform a transfer to a new extension */ if (strchr(macro_transfer_dest, '^')) { /* context^exten^priority*/ - replace_macro_delimiter(macro_transfer_dest); + ast_replace_subargument_delimiter(macro_transfer_dest); if (!ast_parseable_goto(chan, macro_transfer_dest)) ast_set_flag64(peerflags, OPT_GO_ON); } @@ -2724,7 +2717,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast theapp = pbx_findapp("Gosub"); if (theapp && !res9) { - replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_GOSUB]); + ast_replace_subargument_delimiter(opt_args[OPT_ARG_CALLEE_GOSUB]); /* Set where we came from */ ast_channel_context_set(peer, "app_dial_gosub_virtual_context"); @@ -2814,7 +2807,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast res = -1; /* perform a transfer to a new extension */ if (strchr(gosub_transfer_dest, '^')) { /* context^exten^priority*/ - replace_macro_delimiter(gosub_transfer_dest); + ast_replace_subargument_delimiter(gosub_transfer_dest); if (!ast_parseable_goto(chan, gosub_transfer_dest)) ast_set_flag64(peerflags, OPT_GO_ON); } @@ -2928,7 +2921,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast } if (!ast_check_hangup(peer) && ast_test_flag64(&opts, OPT_CALLEE_GO_ON)) { if(!ast_strlen_zero(opt_args[OPT_ARG_CALLEE_GO_ON])) { - replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_GO_ON]); + ast_replace_subargument_delimiter(opt_args[OPT_ARG_CALLEE_GO_ON]); ast_parseable_goto(peer, opt_args[OPT_ARG_CALLEE_GO_ON]); } else { /* F() */ int goto_res; diff --git a/apps/app_queue.c b/apps/app_queue.c index d372a50ba..7a91384b8 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -1305,21 +1305,6 @@ static void set_queue_result(struct ast_channel *chan, enum queue_result res) } } -/*! - * \internal - * \brief Converts delimited '^' characters in a target priority/extension/context string - * to commas so that they can be used with ast_parseable_goto. - * \param s string that '^' characters are being replaced in. - */ -static void replace_macro_delimiter(char *s) -{ - for (; *s; s++) { - if (*s == '^') { - *s = ','; - } - } -} - static const char *int2strat(int strategy) { int x; @@ -5326,7 +5311,7 @@ static int try_calling(struct queue_ent *qe, const struct ast_flags opts, char * if (!ast_check_hangup(peer) && ast_test_flag(&opts, OPT_CALLEE_GO_ON)) { if (!ast_strlen_zero(opt_args[OPT_ARG_CALLEE_GO_ON])) { - replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_GO_ON]); + ast_replace_subargument_delimiter(opt_args[OPT_ARG_CALLEE_GO_ON]); if (ast_parseable_goto(peer, opt_args[OPT_ARG_CALLEE_GO_ON]) == AST_PBX_SUCCESS) { ast_pbx_start(peer); -- cgit v1.2.3