aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortwilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b>2009-01-16 22:59:41 +0000
committertwilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b>2009-01-16 22:59:41 +0000
commit399b3844df9fcbb7d0e6dd9d09b7ceee05e02fd0 (patch)
treec1bc46ec2e08d83cf32ecfbe8f1e802ea1158c16
parent0c9c6c5cd7be773e556e77199b3a72d91f8fc8f2 (diff)
Merged revisions 168941 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r168941 | twilson | 2009-01-16 16:16:23 -0600 (Fri, 16 Jan 2009) | 19 lines Merged revisions 168716 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r168716 | twilson | 2009-01-15 12:22:49 -0600 (Thu, 15 Jan 2009) | 12 lines Convert call to park_call_full to masq_park_call_announce Since we removed the AST_PBX_KEEPALIVE return value, we need to use masqueraded parking, otherwise we will try to call ast_hangup() in __pbx_run() and in do_parking_thread() and then promptly crash. (closes issue #14215) Reported by: waverly360 Tested by: otherwiseguy (closes issue #14228) Reported by: kobaz Tested by: otherwiseguy ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.1@168981 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--main/features.c51
1 files changed, 29 insertions, 22 deletions
diff --git a/main/features.c b/main/features.c
index a1017e9c7..d959b0d6b 100644
--- a/main/features.c
+++ b/main/features.c
@@ -665,12 +665,13 @@ int ast_park_call(struct ast_channel *chan, struct ast_channel *peer, int timeou
return ast_park_call_full(chan, peer, &args);
}
-static int masq_park_call(struct ast_channel *rchan, struct ast_channel *peer, int timeout, int *extout, int play_announcement)
+static int masq_park_call(struct ast_channel *rchan, struct ast_channel *peer, int timeout, int *extout, int play_announcement, struct ast_park_call_args *args)
{
struct ast_channel *chan;
struct ast_frame *f;
char *orig_chan_name = NULL;
int park_status;
+ struct ast_park_call_args park_args = {0,};
/* Make a new, fake channel that we'll use to masquerade in the real one */
if (!(chan = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, rchan->accountcode, rchan->exten, rchan->context, rchan->amaflags, "Parked/%s",rchan->name))) {
@@ -694,19 +695,22 @@ static int masq_park_call(struct ast_channel *rchan, struct ast_channel *peer, i
orig_chan_name = ast_strdupa(chan->name);
}
- {
- struct ast_park_call_args args = {
- .timeout = timeout,
- .extout = extout,
- .orig_chan_name = orig_chan_name,
- };
+ if (peer == rchan) {
+ peer = chan;
+ }
- park_status = ast_park_call_full(chan, peer, &args);
- if (park_status == 1) {
- /* would be nice to play "invalid parking extension" */
- ast_hangup(chan);
- return -1;
- }
+ if (!args) {
+ args = &park_args;
+ args->timeout = timeout,
+ args->extout = extout,
+ args->orig_chan_name = orig_chan_name;
+ }
+
+ park_status = ast_park_call_full(chan, peer, args);
+ if (park_status == 1) {
+ /* would be nice to play "invalid parking extension" */
+ ast_hangup(chan);
+ return -1;
}
return 0;
@@ -715,15 +719,18 @@ static int masq_park_call(struct ast_channel *rchan, struct ast_channel *peer, i
/* Park call via masquraded channel */
int ast_masq_park_call(struct ast_channel *rchan, struct ast_channel *peer, int timeout, int *extout)
{
- return masq_park_call(rchan, peer, timeout, extout, 0);
+ return masq_park_call(rchan, peer, timeout, extout, 0, NULL);
}
-static int masq_park_call_announce(struct ast_channel *rchan, struct ast_channel *peer, int timeout, int *extout)
+static int masq_park_call_announce_args(struct ast_channel *rchan, struct ast_channel *peer, struct ast_park_call_args *args)
{
- return masq_park_call(rchan, peer, timeout, extout, 1);
+ return masq_park_call(rchan, peer, 0, NULL, 1, args);
}
-
+static int masq_park_call_announce(struct ast_channel *rchan, struct ast_channel *peer, int timeout, int *extout)
+{
+ return masq_park_call(rchan, peer, timeout, extout, 1, NULL);
+}
#define FEATURE_SENSE_CHAN (1 << 0)
#define FEATURE_SENSE_PEER (1 << 1)
@@ -2608,6 +2615,10 @@ int manage_parkinglot(struct ast_parkinglot *curlot, fd_set *rfds, fd_set *efds,
ast_channel_unlock(chan);
+ if (!strncmp(peername, "Parked/", 7)) {
+ peername += 7;
+ }
+
if (dialfeatures)
snprintf(returnexten, sizeof(returnexten), "%s,,%s", peername, dialfeatures->options);
else /* Existing default */
@@ -2853,11 +2864,7 @@ static int park_call_exec(struct ast_channel *chan, void *data)
ast_app_parse_options(park_call_options, &flags, NULL, app_args.options);
args.flags = flags.flags;
- res = ast_park_call_full(chan, chan, &args); /* In experiments, using the masq_park_call
- func here yielded no difference with
- current implementation. I saw no advantage
- in calling it instead.
- */
+ res = masq_park_call_announce_args(chan, chan, &args);
/* Continue on in the dialplan */
if (res == 1) {
ast_copy_string(chan->exten, orig_exten, sizeof(chan->exten));