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, };
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;
}
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 */
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);
dres = ast_waitstream(dchan, "");
} else {
ast_log(LOG_WARNING, "ast_streamfile of %s failed on %s\n", tmp[i], dchan->name);
- dres = 0;
}
}
}