diff options
author | Mark Michelson <mmichelson@digium.com> | 2016-06-01 13:48:00 -0500 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2016-06-09 14:43:15 -0500 |
commit | 1fd3a7849e3a1136f5722221a9f1874a5587b6d6 (patch) | |
tree | 55340fac61b4a75868c7c8e8b6d1d05c4eca44d9 /res/res_ari_channels.c | |
parent | 608e0267e8512e16e186cbdc874cd7902e287ff7 (diff) |
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
Diffstat (limited to 'res/res_ari_channels.c')
-rw-r--r-- | res/res_ari_channels.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/res/res_ari_channels.c b/res/res_ari_channels.c index 951a5475b..2b7bfe2db 100644 --- a/res/res_ari_channels.c +++ b/res/res_ari_channels.c @@ -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: |