summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/app_parkandannounce.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/apps/app_parkandannounce.c b/apps/app_parkandannounce.c
index 7338efb98..c899bd220 100644
--- a/apps/app_parkandannounce.c
+++ b/apps/app_parkandannounce.c
@@ -96,6 +96,7 @@ static int parkandannounce_exec(struct ast_channel *chan, const char *data)
char *dialtech, *tmp[100], buf[13];
int looptemp, i;
char *s;
+ struct ast_party_id caller_id;
struct ast_channel *dchan;
struct outgoing_helper oh = { 0, };
@@ -110,7 +111,7 @@ static int parkandannounce_exec(struct ast_channel *chan, const char *data)
AST_APP_ARG(return_context);
);
if (ast_strlen_zero(data)) {
- ast_log(LOG_WARNING, "ParkAndAnnounce requires arguments: (announce:template|timeout|dial|[return_context])\n");
+ ast_log(LOG_WARNING, "ParkAndAnnounce requires arguments: (announce_template,timeout,dial,[return_context])\n");
res = -1;
goto parkcleanup;
}
@@ -148,17 +149,24 @@ static int parkandannounce_exec(struct ast_channel *chan, const char *data)
ast_verb(3, "Warning: Return Context Invalid, call will return to default|s\n");
}
+ /* Save the CallerID because the masquerade turns chan into a ZOMBIE. */
+ ast_channel_lock(chan);
+ ast_party_id_copy(&caller_id, &chan->caller.id);
+ ast_channel_unlock(chan);
+
/* we are using masq_park here to protect * from touching the channel once we park it. If the channel comes out of timeout
before we are done announcing and the channel is messed with, Kablooeee. So we use Masq to prevent this. */
res = ast_masq_park_call(chan, NULL, timeout, &lot);
if (res) {
/* Parking failed. */
+ ast_party_id_free(&caller_id);
res = -1;
goto parkcleanup;
}
- ast_verb(3, "Call Parking Called, lot: %d, timeout: %d, context: %s\n", lot, timeout, args.return_context);
+ ast_verb(3, "Call parked in space: %d, timeout: %d, return-context: %s\n",
+ lot, timeout, args.return_context ? args.return_context : "");
/* Now place the call to the extension */
@@ -167,9 +175,11 @@ static int parkandannounce_exec(struct ast_channel *chan, const char *data)
oh.vars = ast_variable_new("_PARKEDAT", buf, "");
dchan = __ast_request_and_dial(dialtech, cap_slin, chan, args.dial, 30000,
&outstate,
- S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL),
- S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, NULL),
+ S_COR(caller_id.number.valid, caller_id.number.str, NULL),
+ S_COR(caller_id.name.valid, caller_id.name.str, NULL),
&oh);
+ ast_variables_destroy(oh.vars);
+ ast_party_id_free(&caller_id);
if (dchan) {
if (dchan->_state == AST_STATE_UP) {
ast_verb(4, "Channel %s was answered.\n", dchan->name);
@@ -209,7 +219,6 @@ static int parkandannounce_exec(struct ast_channel *chan, const char *data)
dres = ast_waitstream(dchan, "");
} else {
ast_log(LOG_WARNING, "ast_streamfile of %s failed on %s\n", tmp[i], dchan->name);
- dres = 0;
}
}
}