summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/app_dial.c38
-rw-r--r--apps/app_followme.c4
-rw-r--r--apps/app_queue.c10
3 files changed, 17 insertions, 35 deletions
diff --git a/apps/app_dial.c b/apps/app_dial.c
index 281204847..ccb7b018c 100644
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -1881,7 +1881,8 @@ static int do_privacy(struct ast_channel *chan, struct ast_channel *peer,
}
return 0; /* the good exit path */
} else {
- ast_hangup(peer); /* hang up on the callee -- he didn't want to talk anyway! */
+ /* hang up on the callee -- he didn't want to talk anyway! */
+ ast_autoservice_chan_hangup_peer(chan, peer);
return -1;
}
}
@@ -2774,7 +2775,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
if (active_chan) {
struct ast_frame *fr = ast_read(active_chan);
if (!fr) {
- ast_hangup(peer);
+ ast_autoservice_chan_hangup_peer(chan, peer);
res = -1;
goto done;
}
@@ -2790,7 +2791,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
switch (fr->subclass.integer) {
case AST_CONTROL_HANGUP:
ast_frfree(fr);
- ast_hangup(peer);
+ ast_autoservice_chan_hangup_peer(chan, peer);
res = -1;
goto done;
default:
@@ -2821,7 +2822,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
ast_channel_exten_set(peer, ast_channel_exten(chan));
ast_channel_priority_set(peer, ast_channel_priority(chan) + 2);
if (ast_pbx_start(peer)) {
- ast_hangup(peer);
+ ast_autoservice_chan_hangup_peer(chan, peer);
}
hanguptree(&out_chans, NULL, ast_test_flag64(&opts, OPT_CANCEL_ELSEWHERE) ? 1 : 0);
if (continue_exec)
@@ -3027,7 +3028,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
res = ast_channel_make_compatible(chan, peer);
if (res < 0) {
ast_log(LOG_WARNING, "Had to drop call because I couldn't make %s compatible with %s\n", ast_channel_name(chan), ast_channel_name(peer));
- ast_hangup(peer);
+ ast_autoservice_chan_hangup_peer(chan, peer);
res = -1;
goto done;
}
@@ -3047,28 +3048,9 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
if (ast_test_flag64(&opts, OPT_PEER_H)
&& ast_exists_extension(peer, ast_channel_context(peer), "h", 1,
S_COR(ast_channel_caller(peer)->id.number.valid, ast_channel_caller(peer)->id.number.str, NULL))) {
- int autoloopflag;
- int found;
- int res9;
-
- ast_channel_exten_set(peer, "h");
- ast_channel_priority_set(peer, 1);
- autoloopflag = ast_test_flag(ast_channel_flags(peer), AST_FLAG_IN_AUTOLOOP); /* save value to restore at the end */
- ast_set_flag(ast_channel_flags(peer), AST_FLAG_IN_AUTOLOOP);
-
- while ((res9 = ast_spawn_extension(peer, ast_channel_context(peer), ast_channel_exten(peer),
- ast_channel_priority(peer),
- S_COR(ast_channel_caller(peer)->id.number.valid, ast_channel_caller(peer)->id.number.str, NULL),
- &found, 1)) == 0) {
- ast_channel_priority_set(peer, ast_channel_priority(peer) + 1);
- }
-
- 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", ast_channel_context(peer), ast_channel_exten(peer), ast_channel_priority(peer), 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), ast_channel_priority(peer), ast_channel_name(peer));
- }
- ast_set2_flag(ast_channel_flags(peer), autoloopflag, AST_FLAG_IN_AUTOLOOP); /* set it back the way it was */
+ ast_autoservice_start(chan);
+ ast_pbx_h_exten_run(peer, ast_channel_context(peer));
+ ast_autoservice_stop(chan);
}
if (!ast_check_hangup(peer)) {
if (ast_test_flag64(&opts, OPT_CALLEE_GO_ON)) {
@@ -3089,7 +3071,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
ast_channel_hangupcause_set(chan, ast_channel_hangupcause(peer));
}
}
- ast_hangup(peer);
+ ast_autoservice_chan_hangup_peer(chan, peer);
}
out:
if (moh) {
diff --git a/apps/app_followme.c b/apps/app_followme.c
index 275ed43c5..9b4a925da 100644
--- a/apps/app_followme.c
+++ b/apps/app_followme.c
@@ -1490,7 +1490,7 @@ static int app_exec(struct ast_channel *chan, const char *data)
res = ast_channel_make_compatible(caller, outbound);
if (res < 0) {
ast_log(LOG_WARNING, "Had to drop call because I couldn't make %s compatible with %s\n", ast_channel_name(caller), ast_channel_name(outbound));
- ast_hangup(outbound);
+ ast_autoservice_chan_hangup_peer(caller, outbound);
goto outrun;
}
@@ -1513,7 +1513,7 @@ static int app_exec(struct ast_channel *chan, const char *data)
}
res = ast_bridge_call(caller, outbound, &config);
- ast_hangup(outbound);
+ ast_autoservice_chan_hangup_peer(caller, outbound);
}
outrun:
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 4acd799f1..cee5d449f 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -5266,7 +5266,7 @@ static int try_calling(struct queue_ent *qe, const struct ast_flags opts, char *
"%s",
queuename, ast_channel_uniqueid(qe->chan), ast_channel_name(peer), member->interface, member->membername,
qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
- ast_hangup(peer);
+ ast_autoservice_chan_hangup_peer(qe->chan, peer);
ao2_ref(member, -1);
goto out;
} else if (ast_check_hangup(qe->chan)) {
@@ -5274,7 +5274,7 @@ static int try_calling(struct queue_ent *qe, const struct ast_flags opts, char *
ast_log(LOG_NOTICE, "Caller was about to talk to agent on %s but the caller hungup.\n", ast_channel_name(peer));
ast_queue_log(queuename, ast_channel_uniqueid(qe->chan), member->membername, "ABANDON", "%d|%d|%ld", qe->pos, qe->opos, (long) time(NULL) - qe->start);
record_abandoned(qe);
- ast_hangup(peer);
+ ast_autoservice_chan_hangup_peer(qe->chan, peer);
ao2_ref(member, -1);
return -1;
}
@@ -5296,7 +5296,7 @@ static int try_calling(struct queue_ent *qe, const struct ast_flags opts, char *
ast_log(LOG_WARNING, "Had to drop call because I couldn't make %s compatible with %s\n", ast_channel_name(qe->chan), ast_channel_name(peer));
record_abandoned(qe);
ast_cdr_failed(ast_channel_cdr(qe->chan));
- ast_hangup(peer);
+ ast_autoservice_chan_hangup_peer(qe->chan, peer);
ao2_ref(member, -1);
return -1;
}
@@ -5673,10 +5673,10 @@ static int try_calling(struct queue_ent *qe, const struct ast_flags opts, char *
caller_priority + 1);
}
if (goto_res || ast_pbx_start(peer)) {
- ast_hangup(peer);
+ ast_autoservice_chan_hangup_peer(qe->chan, peer);
}
} else {
- ast_hangup(peer);
+ ast_autoservice_chan_hangup_peer(qe->chan, peer);
}
res = bridge ? bridge : 1;