mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-09 19:38:22 +00:00
Fix AMI action Park crash.
* Made AMI action Park not say anything to the parker channel (AMI header Channel2) since the AMI action is a third party parking the call. (This is a change in behavior that cannot be preserved without a lot of effort.) * Made not play pbx-parkingfailed if the Park 's' option is used. JIRA AST-660 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@334840 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -341,7 +341,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
<para>Channel name to park.</para>
|
<para>Channel name to park.</para>
|
||||||
</parameter>
|
</parameter>
|
||||||
<parameter name="Channel2" required="true">
|
<parameter name="Channel2" required="true">
|
||||||
<para>Channel to announce park info to (and return to if timeout).</para>
|
<para>Channel to return to if timeout.</para>
|
||||||
</parameter>
|
</parameter>
|
||||||
<parameter name="Timeout">
|
<parameter name="Timeout">
|
||||||
<para>Number of milliseconds to wait before callback.</para>
|
<para>Number of milliseconds to wait before callback.</para>
|
||||||
@@ -1549,12 +1549,14 @@ static int masq_park_call(struct ast_channel *rchan, struct ast_channel *peer, i
|
|||||||
rchan->context, rchan->linkedid, rchan->amaflags, "Parked/%s", rchan->name);
|
rchan->context, rchan->linkedid, rchan->amaflags, "Parked/%s", rchan->name);
|
||||||
if (!chan) {
|
if (!chan) {
|
||||||
ast_log(LOG_WARNING, "Unable to create parked channel\n");
|
ast_log(LOG_WARNING, "Unable to create parked channel\n");
|
||||||
if (peer == rchan) {
|
if (!ast_test_flag(args, AST_PARK_OPT_SILENCE)) {
|
||||||
/* Only have one channel to worry about. */
|
if (peer == rchan) {
|
||||||
ast_stream_and_wait(peer, "pbx-parkingfailed", "");
|
/* Only have one channel to worry about. */
|
||||||
} else if (peer) {
|
ast_stream_and_wait(peer, "pbx-parkingfailed", "");
|
||||||
/* Have two different channels to worry about. */
|
} else if (peer) {
|
||||||
play_message_on_chan(peer, rchan, "failure message", "pbx-parkingfailed");
|
/* Have two different channels to worry about. */
|
||||||
|
play_message_on_chan(peer, rchan, "failure message", "pbx-parkingfailed");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -1563,12 +1565,14 @@ static int masq_park_call(struct ast_channel *rchan, struct ast_channel *peer, i
|
|||||||
if (!args->pu) {
|
if (!args->pu) {
|
||||||
chan->hangupcause = AST_CAUSE_SWITCH_CONGESTION;
|
chan->hangupcause = AST_CAUSE_SWITCH_CONGESTION;
|
||||||
ast_hangup(chan);
|
ast_hangup(chan);
|
||||||
if (peer == rchan) {
|
if (!ast_test_flag(args, AST_PARK_OPT_SILENCE)) {
|
||||||
/* Only have one channel to worry about. */
|
if (peer == rchan) {
|
||||||
ast_stream_and_wait(peer, "pbx-parkingfailed", "");
|
/* Only have one channel to worry about. */
|
||||||
} else if (peer) {
|
ast_stream_and_wait(peer, "pbx-parkingfailed", "");
|
||||||
/* Have two different channels to worry about. */
|
} else if (peer) {
|
||||||
play_message_on_chan(peer, rchan, "failure message", "pbx-parkingfailed");
|
/* Have two different channels to worry about. */
|
||||||
|
play_message_on_chan(peer, rchan, "failure message", "pbx-parkingfailed");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -1688,7 +1692,9 @@ static int xfer_park_call_helper(struct ast_channel *park_me, struct ast_channel
|
|||||||
parkinglot_unref(args.parkinglot);
|
parkinglot_unref(args.parkinglot);
|
||||||
} else {
|
} else {
|
||||||
/* Parking failed because parking lot does not exist. */
|
/* Parking failed because parking lot does not exist. */
|
||||||
ast_stream_and_wait(parker, "pbx-parkingfailed", "");
|
if (!ast_test_flag(&args, AST_PARK_OPT_SILENCE)) {
|
||||||
|
ast_stream_and_wait(parker, "pbx-parkingfailed", "");
|
||||||
|
}
|
||||||
finishup(park_me);
|
finishup(park_me);
|
||||||
res = -1;
|
res = -1;
|
||||||
}
|
}
|
||||||
@@ -4787,7 +4793,9 @@ static int park_call_exec(struct ast_channel *chan, const char *data)
|
|||||||
parkinglot_unref(args.parkinglot);
|
parkinglot_unref(args.parkinglot);
|
||||||
} else {
|
} else {
|
||||||
/* Parking failed because the parking lot does not exist. */
|
/* Parking failed because the parking lot does not exist. */
|
||||||
ast_stream_and_wait(chan, "pbx-parkingfailed", "");
|
if (!ast_test_flag(&args, AST_PARK_OPT_SILENCE)) {
|
||||||
|
ast_stream_and_wait(chan, "pbx-parkingfailed", "");
|
||||||
|
}
|
||||||
res = -1;
|
res = -1;
|
||||||
}
|
}
|
||||||
if (res) {
|
if (res) {
|
||||||
@@ -6850,6 +6858,9 @@ static int manager_parking_status(struct mansession *s, const struct message *m)
|
|||||||
*
|
*
|
||||||
* Get channels involved in park, create event.
|
* Get channels involved in park, create event.
|
||||||
* \return Always 0
|
* \return Always 0
|
||||||
|
*
|
||||||
|
* \note ADSI is not compatible with this AMI action for the
|
||||||
|
* same reason ch2 can no longer announce the parking space.
|
||||||
*/
|
*/
|
||||||
static int manager_park(struct mansession *s, const struct message *m)
|
static int manager_park(struct mansession *s, const struct message *m)
|
||||||
{
|
{
|
||||||
@@ -6860,7 +6871,28 @@ static int manager_park(struct mansession *s, const struct message *m)
|
|||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
int res = 0;
|
int res = 0;
|
||||||
struct ast_channel *ch1, *ch2;
|
struct ast_channel *ch1, *ch2;
|
||||||
struct ast_park_call_args args = {0,};
|
struct ast_park_call_args args = {
|
||||||
|
/*
|
||||||
|
* Don't say anything to ch2 since AMI is a third party parking
|
||||||
|
* a call and we will likely crash if we do.
|
||||||
|
*
|
||||||
|
* XXX When the AMI action was originally implemented, the
|
||||||
|
* parking space was announced to ch2. Unfortunately, grabbing
|
||||||
|
* the ch2 lock and holding it while the announcement is played
|
||||||
|
* was not really a good thing to do to begin with since it
|
||||||
|
* could hold up the system. Also holding the lock is no longer
|
||||||
|
* possible with a masquerade.
|
||||||
|
*
|
||||||
|
* Restoring the announcement to ch2 is not easily doable for
|
||||||
|
* the following reasons:
|
||||||
|
*
|
||||||
|
* 1) The AMI manager is not the thread processing ch2.
|
||||||
|
*
|
||||||
|
* 2) ch2 could be the same as ch1, bridged to ch1, or some
|
||||||
|
* random uninvolved channel.
|
||||||
|
*/
|
||||||
|
.flags = AST_PARK_OPT_SILENCE,
|
||||||
|
};
|
||||||
|
|
||||||
if (ast_strlen_zero(channel)) {
|
if (ast_strlen_zero(channel)) {
|
||||||
astman_send_error(s, m, "Channel not specified");
|
astman_send_error(s, m, "Channel not specified");
|
||||||
|
|||||||
Reference in New Issue
Block a user