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:
Mark Michelson
2016-06-01 13:48:00 -05:00
parent 608e0267e8
commit 1fd3a7849e
4 changed files with 196 additions and 0 deletions

View File

@@ -453,6 +453,10 @@
{
"code": 409,
"reason": "Channel not in a Stasis application"
},
{
"code": 412,
"reason": "Channel in invalid state"
}
]
}
@@ -501,6 +505,10 @@
{
"code": 422,
"reason": "Endpoint is not the same type as the channel"
},
{
"code": 412,
"reason": "Channel in invalid state"
}
]
}
@@ -533,6 +541,10 @@
{
"code": 409,
"reason": "Channel not in a Stasis application"
},
{
"code": 412,
"reason": "Channel in invalid state"
}
]
}
@@ -565,6 +577,10 @@
{
"code": 409,
"reason": "Channel not in a Stasis application"
},
{
"code": 412,
"reason": "Channel in invalid state"
}
]
},
@@ -591,6 +607,10 @@
{
"code": 409,
"reason": "Channel not in a Stasis application"
},
{
"code": 412,
"reason": "Channel in invalid state"
}
]
}
@@ -671,6 +691,10 @@
{
"code": 409,
"reason": "Channel not in a Stasis application"
},
{
"code": 412,
"reason": "Channel in invalid state"
}
]
}
@@ -720,6 +744,10 @@
{
"code": 409,
"reason": "Channel not in a Stasis application"
},
{
"code": 412,
"reason": "Channel in invalid state"
}
]
},
@@ -763,6 +791,10 @@
{
"code": 409,
"reason": "Channel not in a Stasis application"
},
{
"code": 412,
"reason": "Channel in invalid state"
}
]
}
@@ -795,6 +827,10 @@
{
"code": 409,
"reason": "Channel not in a Stasis application"
},
{
"code": 412,
"reason": "Channel in invalid state"
}
]
},
@@ -821,6 +857,10 @@
{
"code": 409,
"reason": "Channel not in a Stasis application"
},
{
"code": 412,
"reason": "Channel in invalid state"
}
]
}
@@ -862,6 +902,10 @@
{
"code": 409,
"reason": "Channel not in a Stasis application"
},
{
"code": 412,
"reason": "Channel in invalid state"
}
]
},
@@ -888,6 +932,10 @@
{
"code": 409,
"reason": "Channel not in a Stasis application"
},
{
"code": 412,
"reason": "Channel in invalid state"
}
]
}
@@ -921,6 +969,10 @@
{
"code": 409,
"reason": "Channel not in a Stasis application"
},
{
"code": 412,
"reason": "Channel in invalid state"
}
]
},
@@ -947,6 +999,10 @@
{
"code": 409,
"reason": "Channel not in a Stasis application"
},
{
"code": 412,
"reason": "Channel in invalid state"
}
]
}
@@ -1021,6 +1077,10 @@
{
"code": 409,
"reason": "Channel not in a Stasis application"
},
{
"code": 412,
"reason": "Channel in invalid state"
}
]
}
@@ -1095,6 +1155,10 @@
{
"code": 409,
"reason": "Channel not in a Stasis application"
},
{
"code": 412,
"reason": "Channel in invalid state"
}
]
}