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;
- int priority_int = 0;
if (ast_strlen_zero(name)) {
astman_send_error(s, m, "No channel specified");
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");
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);