The priority was unnecessary for the manager atxfer, so it has
authorMark Michelson <mmichelson@digium.com>
Thu, 9 Oct 2008 23:54:59 +0000 (23:54 +0000)
committerMark Michelson <mmichelson@digium.com>
Thu, 9 Oct 2008 23:54:59 +0000 (23:54 +0000)
been removed. Furthermore, now we actually use the Context argument
passed to set the transfer context and don't error out if no
context is specified.

This addresses the actual problems outlined in issue 12158. Regarding
the other points brought up, regarding the inability to not transfer
to extensions which cannot be represented by DTMF, it is not enough of
a constraint that it is worth attempting to rework the feature.

(closes issue #12158)
Reported by: davidw

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@148160 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/manager.c

index ee93dad..15f485c 100644 (file)
@@ -2088,11 +2088,9 @@ static int action_atxfer(struct mansession *s, const struct message *m)
        const char *name = astman_get_header(m, "Channel");
        const char *exten = astman_get_header(m, "Exten");
        const char *context = astman_get_header(m, "Context");
        const char *name = astman_get_header(m, "Channel");
        const char *exten = astman_get_header(m, "Exten");
        const char *context = astman_get_header(m, "Context");
-       const char *priority = astman_get_header(m, "Priority");
        struct ast_channel *chan = NULL;
        struct ast_call_feature *atxfer_feature = NULL;
        char *feature_code = NULL;
        struct ast_channel *chan = NULL;
        struct ast_call_feature *atxfer_feature = NULL;
        char *feature_code = NULL;
-       int priority_int = 0;
 
        if (ast_strlen_zero(name)) { 
                astman_send_error(s, m, "No channel specified");
 
        if (ast_strlen_zero(name)) { 
                astman_send_error(s, m, "No channel specified");
@@ -2102,19 +2100,6 @@ static int action_atxfer(struct mansession *s, const struct message *m)
                astman_send_error(s, m, "No extension specified");
                return 0;
        }
                astman_send_error(s, m, "No extension specified");
                return 0;
        }
-       if (ast_strlen_zero(context)) {
-               astman_send_error(s, m, "No context specified");
-               return 0;
-       }
-       if (ast_strlen_zero(priority)) {
-               astman_send_error(s, m, "No priority specified");
-               return 0;
-       }
-
-       if (sscanf(priority, "%d", &priority_int) != 1 && (priority_int = ast_findlabel_extension(NULL, context, exten, priority, NULL)) < 1) {
-               astman_send_error(s, m, "Invalid Priority");
-               return 0;
-       }
 
        if (!(atxfer_feature = ast_find_call_feature("atxfer"))) {
                astman_send_error(s, m, "No attended transfer feature found");
 
        if (!(atxfer_feature = ast_find_call_feature("atxfer"))) {
                astman_send_error(s, m, "No attended transfer feature found");
@@ -2126,6 +2111,10 @@ static int action_atxfer(struct mansession *s, const struct message *m)
                return 0;
        }
 
                return 0;
        }
 
+       if (!ast_strlen_zero(context)) {
+               pbx_builtin_setvar_helper(chan, "TRANSFER_CONTEXT", context);
+       }
+
        for (feature_code = atxfer_feature->exten; feature_code && *feature_code; ++feature_code) {
                struct ast_frame f = {AST_FRAME_DTMF, *feature_code};
                ast_queue_frame(chan, &f);
        for (feature_code = atxfer_feature->exten; feature_code && *feature_code; ++feature_code) {
                struct ast_frame f = {AST_FRAME_DTMF, *feature_code};
                ast_queue_frame(chan, &f);