mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 11:25:35 +00:00
ARI: Ensure proper channel state on operations.
ARI was recently outfitted with operations to create and dial channels. This leads to the ability to try funny stuff. You could create a channel and then immediately try to play back media on it. You could create a channel, dial it, and while it is ringing attempt to make it continue in the dialplan. This commit attempts to fix this by adding a channel state check to operations that should not be able to operate on outbound channels that have not yet answered. If a channel is in an invalid state, we will send a 412 response. ASTERISK-26047 #close Reported by Mark Michelson Change-Id: I2ca51bf9ef2b44a1dc5a73f2d2de35c62c37dfd8
This commit is contained in:
@@ -811,6 +811,7 @@ static void ast_ari_channels_continue_in_dialplan_cb(
|
||||
case 501: /* Not Implemented */
|
||||
case 404: /* Channel not found */
|
||||
case 409: /* Channel not in a Stasis application */
|
||||
case 412: /* Channel in invalid state */
|
||||
is_valid = 1;
|
||||
break;
|
||||
default:
|
||||
@@ -911,6 +912,7 @@ static void ast_ari_channels_redirect_cb(
|
||||
case 404: /* Channel or endpoint not found */
|
||||
case 409: /* Channel not in a Stasis application */
|
||||
case 422: /* Endpoint is not the same type as the channel */
|
||||
case 412: /* Channel in invalid state */
|
||||
is_valid = 1;
|
||||
break;
|
||||
default:
|
||||
@@ -971,6 +973,7 @@ static void ast_ari_channels_answer_cb(
|
||||
case 501: /* Not Implemented */
|
||||
case 404: /* Channel not found */
|
||||
case 409: /* Channel not in a Stasis application */
|
||||
case 412: /* Channel in invalid state */
|
||||
is_valid = 1;
|
||||
break;
|
||||
default:
|
||||
@@ -1031,6 +1034,7 @@ static void ast_ari_channels_ring_cb(
|
||||
case 501: /* Not Implemented */
|
||||
case 404: /* Channel not found */
|
||||
case 409: /* Channel not in a Stasis application */
|
||||
case 412: /* Channel in invalid state */
|
||||
is_valid = 1;
|
||||
break;
|
||||
default:
|
||||
@@ -1091,6 +1095,7 @@ static void ast_ari_channels_ring_stop_cb(
|
||||
case 501: /* Not Implemented */
|
||||
case 404: /* Channel not found */
|
||||
case 409: /* Channel not in a Stasis application */
|
||||
case 412: /* Channel in invalid state */
|
||||
is_valid = 1;
|
||||
break;
|
||||
default:
|
||||
@@ -1218,6 +1223,7 @@ static void ast_ari_channels_send_dtmf_cb(
|
||||
case 400: /* DTMF is required */
|
||||
case 404: /* Channel not found */
|
||||
case 409: /* Channel not in a Stasis application */
|
||||
case 412: /* Channel in invalid state */
|
||||
is_valid = 1;
|
||||
break;
|
||||
default:
|
||||
@@ -1316,6 +1322,7 @@ static void ast_ari_channels_mute_cb(
|
||||
case 501: /* Not Implemented */
|
||||
case 404: /* Channel not found */
|
||||
case 409: /* Channel not in a Stasis application */
|
||||
case 412: /* Channel in invalid state */
|
||||
is_valid = 1;
|
||||
break;
|
||||
default:
|
||||
@@ -1414,6 +1421,7 @@ static void ast_ari_channels_unmute_cb(
|
||||
case 501: /* Not Implemented */
|
||||
case 404: /* Channel not found */
|
||||
case 409: /* Channel not in a Stasis application */
|
||||
case 412: /* Channel in invalid state */
|
||||
is_valid = 1;
|
||||
break;
|
||||
default:
|
||||
@@ -1474,6 +1482,7 @@ static void ast_ari_channels_hold_cb(
|
||||
case 501: /* Not Implemented */
|
||||
case 404: /* Channel not found */
|
||||
case 409: /* Channel not in a Stasis application */
|
||||
case 412: /* Channel in invalid state */
|
||||
is_valid = 1;
|
||||
break;
|
||||
default:
|
||||
@@ -1534,6 +1543,7 @@ static void ast_ari_channels_unhold_cb(
|
||||
case 501: /* Not Implemented */
|
||||
case 404: /* Channel not found */
|
||||
case 409: /* Channel not in a Stasis application */
|
||||
case 412: /* Channel in invalid state */
|
||||
is_valid = 1;
|
||||
break;
|
||||
default:
|
||||
@@ -1632,6 +1642,7 @@ static void ast_ari_channels_start_moh_cb(
|
||||
case 501: /* Not Implemented */
|
||||
case 404: /* Channel not found */
|
||||
case 409: /* Channel not in a Stasis application */
|
||||
case 412: /* Channel in invalid state */
|
||||
is_valid = 1;
|
||||
break;
|
||||
default:
|
||||
@@ -1692,6 +1703,7 @@ static void ast_ari_channels_stop_moh_cb(
|
||||
case 501: /* Not Implemented */
|
||||
case 404: /* Channel not found */
|
||||
case 409: /* Channel not in a Stasis application */
|
||||
case 412: /* Channel in invalid state */
|
||||
is_valid = 1;
|
||||
break;
|
||||
default:
|
||||
@@ -1752,6 +1764,7 @@ static void ast_ari_channels_start_silence_cb(
|
||||
case 501: /* Not Implemented */
|
||||
case 404: /* Channel not found */
|
||||
case 409: /* Channel not in a Stasis application */
|
||||
case 412: /* Channel in invalid state */
|
||||
is_valid = 1;
|
||||
break;
|
||||
default:
|
||||
@@ -1812,6 +1825,7 @@ static void ast_ari_channels_stop_silence_cb(
|
||||
case 501: /* Not Implemented */
|
||||
case 404: /* Channel not found */
|
||||
case 409: /* Channel not in a Stasis application */
|
||||
case 412: /* Channel in invalid state */
|
||||
is_valid = 1;
|
||||
break;
|
||||
default:
|
||||
@@ -2003,6 +2017,7 @@ static void ast_ari_channels_play_cb(
|
||||
case 501: /* Not Implemented */
|
||||
case 404: /* Channel not found */
|
||||
case 409: /* Channel not in a Stasis application */
|
||||
case 412: /* Channel in invalid state */
|
||||
is_valid = 1;
|
||||
break;
|
||||
default:
|
||||
@@ -2192,6 +2207,7 @@ static void ast_ari_channels_play_with_id_cb(
|
||||
case 501: /* Not Implemented */
|
||||
case 404: /* Channel not found */
|
||||
case 409: /* Channel not in a Stasis application */
|
||||
case 412: /* Channel in invalid state */
|
||||
is_valid = 1;
|
||||
break;
|
||||
default:
|
||||
|
Reference in New Issue
Block a user