2013-04-22 14:58:53 +00:00
{
"_copyright" : "Copyright (C) 2012 - 2013, Digium, Inc." ,
"_author" : "David M. Lee, II <dlee@digium.com>" ,
"_svn_revision" : "$Revision$" ,
2016-11-18 09:46:48 -06:00
"apiVersion" : "2.0.0" ,
2013-04-22 14:58:53 +00:00
"swaggerVersion" : "1.1" ,
2014-09-20 23:41:55 +00:00
"basePath" : "http://localhost:8088/ari" ,
2013-04-22 14:58:53 +00:00
"resourcePath" : "/api-docs/bridges.{format}" ,
2025-01-27 08:30:40 -07:00
"since" : [
"12.0.0"
] ,
2018-01-18 10:01:26 -05:00
"requiresModules" : [
"res_stasis_recording" ,
"res_stasis_playback"
] ,
2013-04-22 14:58:53 +00:00
"apis" : [
{
"path" : "/bridges" ,
"description" : "Active bridges" ,
"operations" : [
{
"httpMethod" : "GET" ,
2025-01-27 08:30:40 -07:00
"since" : [
"12.0.0"
] ,
2013-10-16 14:02:06 +00:00
"summary" : "List all active bridges in Asterisk." ,
2013-11-07 21:10:31 +00:00
"nickname" : "list" ,
2013-04-22 14:58:53 +00:00
"responseClass" : "List[Bridge]"
} ,
{
"httpMethod" : "POST" ,
2025-01-27 08:30:40 -07:00
"since" : [
"12.0.0"
] ,
2013-04-22 14:58:53 +00:00
"summary" : "Create a new bridge." ,
"notes" : "This bridge persists until it has been shut down, or Asterisk has been shut down." ,
2013-11-07 21:10:31 +00:00
"nickname" : "create" ,
2013-04-22 14:58:53 +00:00
"responseClass" : "Bridge" ,
"parameters" : [
{
"name" : "type" ,
2023-05-25 10:58:45 +01:00
"description" : "Comma separated list of bridge type attributes (mixing, holding, dtmf_events, proxy_media, video_sfu, video_single, sdp_label)." ,
2013-04-22 14:58:53 +00:00
"paramType" : "query" ,
"required" : false ,
"allowMultiple" : false ,
2014-03-19 12:54:25 +00:00
"dataType" : "string"
2013-12-17 23:25:49 +00:00
} ,
uniqueid: channel linkedid, ami, ari object creation with id's
Much needed was a way to assign id to objects on creation, and
much change was necessary to accomplish it. Channel uniqueids
and linkedids are split into separate string and creation time
components without breaking linkedid propgation. This allowed
the uniqueid to be specified by the user interface - and those
values are now carried through to channel creation, adding the
assignedids value to every function in the chain including the
channel drivers. For local channels, the second channel can be
specified or left to default to a ;2 suffix of first. In ARI,
bridge, playback, and snoop objects can also be created with a
specified uniqueid.
Along the way, the args order to allocating channels was fixed
in chan_mgcp and chan_gtalk, and linkedid is no longer lost as
masquerade occurs.
(closes issue ASTERISK-23120)
Review: https://reviewboard.asterisk.org/r/3191/
........
Merged revisions 410157 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410158 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-07 15:47:55 +00:00
{
"name" : "bridgeId" ,
"description" : "Unique ID to give to the bridge being created." ,
"paramType" : "query" ,
"required" : false ,
"allowMultiple" : false ,
"dataType" : "string"
} ,
2013-12-17 23:25:49 +00:00
{
"name" : "name" ,
"description" : "Name to give to the bridge being created." ,
"paramType" : "query" ,
"required" : false ,
"allowMultiple" : false ,
"dataType" : "string"
2013-04-22 14:58:53 +00:00
}
bridging: Fix multiple bridging issues causing SEGVs and FRACKs.
Issues:
* The bridging core allowed multiple bridges to be created with the same
unique bridgeId at the same time. Only the last bridge created with the
duplicate name was actually saved to the core bridges container.
* The bridging core was creating a stasis topic for the bridge and saving it
in the bridge->topic field but not increasing its reference count. In the
case where two bridges were created with the same uniqueid (which is also
the topic name), the second bridge would get the _existing_ topic the first
bridge created. When the first bridge was destroyed, it would take the
topic with it so when the second bridge attempted to publish a message to
it it either FRACKed or SEGVd.
* The bridge destructor, which also destroys the bridge topic, is run from the
bridge manager thread not the caller's thread. This makes it possible for
an ARI developer to create a new one with the same uniqueid believing the
old one was destroyed when, in fact, the old one's destructor hadn't
completed. This could cause the new bridge to get the old one's topic just
before the topic was destroyed. When the new bridge attempted to publish
a message on that topic, asterisk could either FRACK or SEGV.
* The ARI bridges resource also allowed multiple bridges to be created with
the same uniqueid but it kept the duplicate bridges in its app_bridges
container. This created a situation where if you added two bridges with
the same "bridge1" uniqueid, all operations on "bridge1" were performed on
the first bridge created and the second was basically orphaned. If you
attempted to delete what you thought was the second bridge, you actually
deleted the first one created.
Changes:
* A new API `ast_bridge_topic_exists(uniqueid)` was created to determine if
a topic already exists for a bridge.
* `bridge_base_init()` in bridge.c and `ast_ari_bridges_create()` in
resource_bridges.c now call `ast_bridge_topic_exists(uniqueid)` to check
if a bridge with the requested uniqueid already exists and will fail if it
does.
* `bridge_register()` in bridges.c now checks the core bridges container to
make sure a bridge doesn't already exist with the requested uniqueid.
Although most callers of `bridge_register()` will have already called
`bridge_base_init()`, which will now fail on duplicate bridges, there
is no guarantee of this so we must check again.
* The core bridges container allocation was changed to reject duplicate
uniqueids instead of silently replacing an existing one. This is a "belt
and suspenders" check.
* A global mutex was added to bridge.c to prevent concurrent calls to
`bridge_base_init()` and `bridge_register()`.
* Even though you can no longer create multiple bridges with the same uniqueid
at the same time, it's still possible that the bridge topic might be
destroyed while a second bridge with the same uniqueid was trying to use
it. To address this, the bridging core now increments the reference count
on bridge->topic when a bridge is created and decrements it when the
bridge is destroyed.
* `bridge_create_common()` in res_stasis.c now checks the stasis app_bridges
container to make sure a bridge with the requested uniqueid doesn't already
exist. This may seem like overkill but there are so many entrypoints to
bridge creation that we need to be safe and catch issues as soon in the
process as possible.
* The stasis app_bridges container allocation was changed to reject duplicate
uniqueids instead of adding them. This is a "belt and suspenders" check.
* The `bridge show all` CLI command now shows the bridge name as well as the
bridge id.
* Response code 409 "Conflict" was added as a possible response from the ARI
bridge create resources to signal that a bridge with the requested uniqueid
already exists.
* Additional debugging was added to multiple bridging and stasis files.
Resolves: #211
2025-01-22 13:52:33 -07:00
] ,
"errorResponses" : [
{
"code" : 409 ,
"reason" : "Bridge with the same bridgeId already exists"
}
2013-04-22 14:58:53 +00:00
]
}
]
} ,
{
"path" : "/bridges/{bridgeId}" ,
"description" : "Individual bridge" ,
"operations" : [
uniqueid: channel linkedid, ami, ari object creation with id's
Much needed was a way to assign id to objects on creation, and
much change was necessary to accomplish it. Channel uniqueids
and linkedids are split into separate string and creation time
components without breaking linkedid propgation. This allowed
the uniqueid to be specified by the user interface - and those
values are now carried through to channel creation, adding the
assignedids value to every function in the chain including the
channel drivers. For local channels, the second channel can be
specified or left to default to a ;2 suffix of first. In ARI,
bridge, playback, and snoop objects can also be created with a
specified uniqueid.
Along the way, the args order to allocating channels was fixed
in chan_mgcp and chan_gtalk, and linkedid is no longer lost as
masquerade occurs.
(closes issue ASTERISK-23120)
Review: https://reviewboard.asterisk.org/r/3191/
........
Merged revisions 410157 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410158 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-07 15:47:55 +00:00
{
"httpMethod" : "POST" ,
2025-01-27 08:30:40 -07:00
"since" : [
"12.2.0"
] ,
bridging: Fix multiple bridging issues causing SEGVs and FRACKs.
Issues:
* The bridging core allowed multiple bridges to be created with the same
unique bridgeId at the same time. Only the last bridge created with the
duplicate name was actually saved to the core bridges container.
* The bridging core was creating a stasis topic for the bridge and saving it
in the bridge->topic field but not increasing its reference count. In the
case where two bridges were created with the same uniqueid (which is also
the topic name), the second bridge would get the _existing_ topic the first
bridge created. When the first bridge was destroyed, it would take the
topic with it so when the second bridge attempted to publish a message to
it it either FRACKed or SEGVd.
* The bridge destructor, which also destroys the bridge topic, is run from the
bridge manager thread not the caller's thread. This makes it possible for
an ARI developer to create a new one with the same uniqueid believing the
old one was destroyed when, in fact, the old one's destructor hadn't
completed. This could cause the new bridge to get the old one's topic just
before the topic was destroyed. When the new bridge attempted to publish
a message on that topic, asterisk could either FRACK or SEGV.
* The ARI bridges resource also allowed multiple bridges to be created with
the same uniqueid but it kept the duplicate bridges in its app_bridges
container. This created a situation where if you added two bridges with
the same "bridge1" uniqueid, all operations on "bridge1" were performed on
the first bridge created and the second was basically orphaned. If you
attempted to delete what you thought was the second bridge, you actually
deleted the first one created.
Changes:
* A new API `ast_bridge_topic_exists(uniqueid)` was created to determine if
a topic already exists for a bridge.
* `bridge_base_init()` in bridge.c and `ast_ari_bridges_create()` in
resource_bridges.c now call `ast_bridge_topic_exists(uniqueid)` to check
if a bridge with the requested uniqueid already exists and will fail if it
does.
* `bridge_register()` in bridges.c now checks the core bridges container to
make sure a bridge doesn't already exist with the requested uniqueid.
Although most callers of `bridge_register()` will have already called
`bridge_base_init()`, which will now fail on duplicate bridges, there
is no guarantee of this so we must check again.
* The core bridges container allocation was changed to reject duplicate
uniqueids instead of silently replacing an existing one. This is a "belt
and suspenders" check.
* A global mutex was added to bridge.c to prevent concurrent calls to
`bridge_base_init()` and `bridge_register()`.
* Even though you can no longer create multiple bridges with the same uniqueid
at the same time, it's still possible that the bridge topic might be
destroyed while a second bridge with the same uniqueid was trying to use
it. To address this, the bridging core now increments the reference count
on bridge->topic when a bridge is created and decrements it when the
bridge is destroyed.
* `bridge_create_common()` in res_stasis.c now checks the stasis app_bridges
container to make sure a bridge with the requested uniqueid doesn't already
exist. This may seem like overkill but there are so many entrypoints to
bridge creation that we need to be safe and catch issues as soon in the
process as possible.
* The stasis app_bridges container allocation was changed to reject duplicate
uniqueids instead of adding them. This is a "belt and suspenders" check.
* The `bridge show all` CLI command now shows the bridge name as well as the
bridge id.
* Response code 409 "Conflict" was added as a possible response from the ARI
bridge create resources to signal that a bridge with the requested uniqueid
already exists.
* Additional debugging was added to multiple bridging and stasis files.
Resolves: #211
2025-01-22 13:52:33 -07:00
"summary" : "Create a new bridge." ,
uniqueid: channel linkedid, ami, ari object creation with id's
Much needed was a way to assign id to objects on creation, and
much change was necessary to accomplish it. Channel uniqueids
and linkedids are split into separate string and creation time
components without breaking linkedid propgation. This allowed
the uniqueid to be specified by the user interface - and those
values are now carried through to channel creation, adding the
assignedids value to every function in the chain including the
channel drivers. For local channels, the second channel can be
specified or left to default to a ;2 suffix of first. In ARI,
bridge, playback, and snoop objects can also be created with a
specified uniqueid.
Along the way, the args order to allocating channels was fixed
in chan_mgcp and chan_gtalk, and linkedid is no longer lost as
masquerade occurs.
(closes issue ASTERISK-23120)
Review: https://reviewboard.asterisk.org/r/3191/
........
Merged revisions 410157 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410158 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-07 15:47:55 +00:00
"notes" : "This bridge persists until it has been shut down, or Asterisk has been shut down." ,
2015-01-27 17:21:03 +00:00
"nickname" : "createWithId" ,
uniqueid: channel linkedid, ami, ari object creation with id's
Much needed was a way to assign id to objects on creation, and
much change was necessary to accomplish it. Channel uniqueids
and linkedids are split into separate string and creation time
components without breaking linkedid propgation. This allowed
the uniqueid to be specified by the user interface - and those
values are now carried through to channel creation, adding the
assignedids value to every function in the chain including the
channel drivers. For local channels, the second channel can be
specified or left to default to a ;2 suffix of first. In ARI,
bridge, playback, and snoop objects can also be created with a
specified uniqueid.
Along the way, the args order to allocating channels was fixed
in chan_mgcp and chan_gtalk, and linkedid is no longer lost as
masquerade occurs.
(closes issue ASTERISK-23120)
Review: https://reviewboard.asterisk.org/r/3191/
........
Merged revisions 410157 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410158 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-07 15:47:55 +00:00
"responseClass" : "Bridge" ,
"parameters" : [
{
"name" : "type" ,
2023-05-25 10:58:45 +01:00
"description" : "Comma separated list of bridge type attributes (mixing, holding, dtmf_events, proxy_media, video_sfu, video_single, sdp_label) to set." ,
uniqueid: channel linkedid, ami, ari object creation with id's
Much needed was a way to assign id to objects on creation, and
much change was necessary to accomplish it. Channel uniqueids
and linkedids are split into separate string and creation time
components without breaking linkedid propgation. This allowed
the uniqueid to be specified by the user interface - and those
values are now carried through to channel creation, adding the
assignedids value to every function in the chain including the
channel drivers. For local channels, the second channel can be
specified or left to default to a ;2 suffix of first. In ARI,
bridge, playback, and snoop objects can also be created with a
specified uniqueid.
Along the way, the args order to allocating channels was fixed
in chan_mgcp and chan_gtalk, and linkedid is no longer lost as
masquerade occurs.
(closes issue ASTERISK-23120)
Review: https://reviewboard.asterisk.org/r/3191/
........
Merged revisions 410157 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410158 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-07 15:47:55 +00:00
"paramType" : "query" ,
"required" : false ,
"allowMultiple" : false ,
2014-03-19 12:54:25 +00:00
"dataType" : "string"
uniqueid: channel linkedid, ami, ari object creation with id's
Much needed was a way to assign id to objects on creation, and
much change was necessary to accomplish it. Channel uniqueids
and linkedids are split into separate string and creation time
components without breaking linkedid propgation. This allowed
the uniqueid to be specified by the user interface - and those
values are now carried through to channel creation, adding the
assignedids value to every function in the chain including the
channel drivers. For local channels, the second channel can be
specified or left to default to a ;2 suffix of first. In ARI,
bridge, playback, and snoop objects can also be created with a
specified uniqueid.
Along the way, the args order to allocating channels was fixed
in chan_mgcp and chan_gtalk, and linkedid is no longer lost as
masquerade occurs.
(closes issue ASTERISK-23120)
Review: https://reviewboard.asterisk.org/r/3191/
........
Merged revisions 410157 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410158 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-07 15:47:55 +00:00
} ,
{
"name" : "bridgeId" ,
"description" : "Unique ID to give to the bridge being created." ,
"paramType" : "path" ,
"required" : true ,
"allowMultiple" : false ,
"dataType" : "string"
} ,
{
"name" : "name" ,
"description" : "Set the name of the bridge." ,
"paramType" : "query" ,
"required" : false ,
"allowMultiple" : false ,
"dataType" : "string"
}
bridging: Fix multiple bridging issues causing SEGVs and FRACKs.
Issues:
* The bridging core allowed multiple bridges to be created with the same
unique bridgeId at the same time. Only the last bridge created with the
duplicate name was actually saved to the core bridges container.
* The bridging core was creating a stasis topic for the bridge and saving it
in the bridge->topic field but not increasing its reference count. In the
case where two bridges were created with the same uniqueid (which is also
the topic name), the second bridge would get the _existing_ topic the first
bridge created. When the first bridge was destroyed, it would take the
topic with it so when the second bridge attempted to publish a message to
it it either FRACKed or SEGVd.
* The bridge destructor, which also destroys the bridge topic, is run from the
bridge manager thread not the caller's thread. This makes it possible for
an ARI developer to create a new one with the same uniqueid believing the
old one was destroyed when, in fact, the old one's destructor hadn't
completed. This could cause the new bridge to get the old one's topic just
before the topic was destroyed. When the new bridge attempted to publish
a message on that topic, asterisk could either FRACK or SEGV.
* The ARI bridges resource also allowed multiple bridges to be created with
the same uniqueid but it kept the duplicate bridges in its app_bridges
container. This created a situation where if you added two bridges with
the same "bridge1" uniqueid, all operations on "bridge1" were performed on
the first bridge created and the second was basically orphaned. If you
attempted to delete what you thought was the second bridge, you actually
deleted the first one created.
Changes:
* A new API `ast_bridge_topic_exists(uniqueid)` was created to determine if
a topic already exists for a bridge.
* `bridge_base_init()` in bridge.c and `ast_ari_bridges_create()` in
resource_bridges.c now call `ast_bridge_topic_exists(uniqueid)` to check
if a bridge with the requested uniqueid already exists and will fail if it
does.
* `bridge_register()` in bridges.c now checks the core bridges container to
make sure a bridge doesn't already exist with the requested uniqueid.
Although most callers of `bridge_register()` will have already called
`bridge_base_init()`, which will now fail on duplicate bridges, there
is no guarantee of this so we must check again.
* The core bridges container allocation was changed to reject duplicate
uniqueids instead of silently replacing an existing one. This is a "belt
and suspenders" check.
* A global mutex was added to bridge.c to prevent concurrent calls to
`bridge_base_init()` and `bridge_register()`.
* Even though you can no longer create multiple bridges with the same uniqueid
at the same time, it's still possible that the bridge topic might be
destroyed while a second bridge with the same uniqueid was trying to use
it. To address this, the bridging core now increments the reference count
on bridge->topic when a bridge is created and decrements it when the
bridge is destroyed.
* `bridge_create_common()` in res_stasis.c now checks the stasis app_bridges
container to make sure a bridge with the requested uniqueid doesn't already
exist. This may seem like overkill but there are so many entrypoints to
bridge creation that we need to be safe and catch issues as soon in the
process as possible.
* The stasis app_bridges container allocation was changed to reject duplicate
uniqueids instead of adding them. This is a "belt and suspenders" check.
* The `bridge show all` CLI command now shows the bridge name as well as the
bridge id.
* Response code 409 "Conflict" was added as a possible response from the ARI
bridge create resources to signal that a bridge with the requested uniqueid
already exists.
* Additional debugging was added to multiple bridging and stasis files.
Resolves: #211
2025-01-22 13:52:33 -07:00
] ,
"errorResponses" : [
{
"code" : 409 ,
"reason" : "Bridge with the same bridgeId already exists"
}
uniqueid: channel linkedid, ami, ari object creation with id's
Much needed was a way to assign id to objects on creation, and
much change was necessary to accomplish it. Channel uniqueids
and linkedids are split into separate string and creation time
components without breaking linkedid propgation. This allowed
the uniqueid to be specified by the user interface - and those
values are now carried through to channel creation, adding the
assignedids value to every function in the chain including the
channel drivers. For local channels, the second channel can be
specified or left to default to a ;2 suffix of first. In ARI,
bridge, playback, and snoop objects can also be created with a
specified uniqueid.
Along the way, the args order to allocating channels was fixed
in chan_mgcp and chan_gtalk, and linkedid is no longer lost as
masquerade occurs.
(closes issue ASTERISK-23120)
Review: https://reviewboard.asterisk.org/r/3191/
........
Merged revisions 410157 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410158 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-07 15:47:55 +00:00
]
} ,
2013-04-22 14:58:53 +00:00
{
"httpMethod" : "GET" ,
2025-01-27 08:30:40 -07:00
"since" : [
"12.0.0"
] ,
2013-04-22 14:58:53 +00:00
"summary" : "Get bridge details." ,
2013-11-07 21:10:31 +00:00
"nickname" : "get" ,
2013-04-22 14:58:53 +00:00
"responseClass" : "Bridge" ,
"parameters" : [
{
"name" : "bridgeId" ,
"description" : "Bridge's id" ,
"paramType" : "path" ,
"required" : true ,
"allowMultiple" : false ,
"dataType" : "string"
}
Update events to use Swagger 1.3 subtyping, and related aftermath
This patch started with the simple idea of changing the /events data
model to be more sane. The original model would send out events like:
{ "stasis_start": { "args": [], "channel": { ... } } }
The event discriminator was the field name instead of being a value in
the object, due to limitations in how Swagger 1.1 could model objects.
While technically sufficient in communicating event information, it was
really difficult to deal with in terms of client side JSON handling.
This patch takes advantage of a proposed extension[1] to Swagger which
allows type variance through the use of a discriminator field. This had
a domino effect that made this a surprisingly large patch.
[1]: https://groups.google.com/d/msg/wordnik-api/EC3rGajE0os/ey_5dBI_jWcJ
In changing the models, I also had to change the swagger_model.py
processor so it can handle the type discriminator and subtyping. I took
that a big step forward, and using that information to generate an
ari_model module, which can validate a JSON object against the Swagger
model.
The REST and WebSocket generators were changed to take advantage of the
validators. If compiled with AST_DEVMODE enabled, JSON objects that
don't match their corresponding models will not be sent out. For REST
API calls, a 500 Internal Server response is sent. For WebSockets, the
invalid JSON message is replaced with an error message.
Since this took over about half of the job of the existing JSON
generators, and the .to_json virtual function on messages took over the
other half, I reluctantly removed the generators.
The validators turned up all sorts of errors and inconsistencies in our
data models, and the code. These were cleaned up, with checks in the
code generator avoid some of the consistency problems in the future.
* The model for a channel snapshot was trimmed down to match the
information sent via AMI. Many of the field being sent were not
useful in the general case.
* The model for a bridge snapshot was updated to be more consistent
with the other ARI models.
Another impact of introducing subtyping was that the swagger-codegen
documentation generator was insufficient (at least until it catches up
with Swagger 1.2). I wanted it to be easier to generate docs for the API
anyways, so I ported the wiki pages to use the Asterisk Swagger
generator. In the process, I was able to clean up many of the model
links, which would occasionally give inconsistent results on the wiki. I
also added error responses to the wiki docs, making the wiki
documentation more complete.
Finally, since Stasis-HTTP will now be named Asterisk REST Interface
(ARI), any new functions and files I created carry the ari_ prefix. I
changed a few stasis_http references to ari where it was non-intrusive
and made sense.
(closes issue ASTERISK-21885)
Review: https://reviewboard.asterisk.org/r/2639/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393529 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-03 16:32:41 +00:00
] ,
"errorResponses" : [
{
"code" : 404 ,
"reason" : "Bridge not found"
}
2013-04-22 14:58:53 +00:00
]
} ,
{
"httpMethod" : "DELETE" ,
2025-01-27 08:30:40 -07:00
"since" : [
"12.0.0"
] ,
2013-06-10 13:07:11 +00:00
"summary" : "Shut down a bridge." ,
2013-04-22 14:58:53 +00:00
"notes" : "If any channels are in this bridge, they will be removed and resume whatever they were doing beforehand." ,
2013-11-07 21:10:31 +00:00
"nickname" : "destroy" ,
2013-04-22 14:58:53 +00:00
"responseClass" : "void" ,
"parameters" : [
{
"name" : "bridgeId" ,
"description" : "Bridge's id" ,
"paramType" : "path" ,
"required" : true ,
"allowMultiple" : false ,
"dataType" : "string"
}
Update events to use Swagger 1.3 subtyping, and related aftermath
This patch started with the simple idea of changing the /events data
model to be more sane. The original model would send out events like:
{ "stasis_start": { "args": [], "channel": { ... } } }
The event discriminator was the field name instead of being a value in
the object, due to limitations in how Swagger 1.1 could model objects.
While technically sufficient in communicating event information, it was
really difficult to deal with in terms of client side JSON handling.
This patch takes advantage of a proposed extension[1] to Swagger which
allows type variance through the use of a discriminator field. This had
a domino effect that made this a surprisingly large patch.
[1]: https://groups.google.com/d/msg/wordnik-api/EC3rGajE0os/ey_5dBI_jWcJ
In changing the models, I also had to change the swagger_model.py
processor so it can handle the type discriminator and subtyping. I took
that a big step forward, and using that information to generate an
ari_model module, which can validate a JSON object against the Swagger
model.
The REST and WebSocket generators were changed to take advantage of the
validators. If compiled with AST_DEVMODE enabled, JSON objects that
don't match their corresponding models will not be sent out. For REST
API calls, a 500 Internal Server response is sent. For WebSockets, the
invalid JSON message is replaced with an error message.
Since this took over about half of the job of the existing JSON
generators, and the .to_json virtual function on messages took over the
other half, I reluctantly removed the generators.
The validators turned up all sorts of errors and inconsistencies in our
data models, and the code. These were cleaned up, with checks in the
code generator avoid some of the consistency problems in the future.
* The model for a channel snapshot was trimmed down to match the
information sent via AMI. Many of the field being sent were not
useful in the general case.
* The model for a bridge snapshot was updated to be more consistent
with the other ARI models.
Another impact of introducing subtyping was that the swagger-codegen
documentation generator was insufficient (at least until it catches up
with Swagger 1.2). I wanted it to be easier to generate docs for the API
anyways, so I ported the wiki pages to use the Asterisk Swagger
generator. In the process, I was able to clean up many of the model
links, which would occasionally give inconsistent results on the wiki. I
also added error responses to the wiki docs, making the wiki
documentation more complete.
Finally, since Stasis-HTTP will now be named Asterisk REST Interface
(ARI), any new functions and files I created carry the ari_ prefix. I
changed a few stasis_http references to ari where it was non-intrusive
and made sense.
(closes issue ASTERISK-21885)
Review: https://reviewboard.asterisk.org/r/2639/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393529 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-03 16:32:41 +00:00
] ,
"errorResponses" : [
{
"code" : 404 ,
"reason" : "Bridge not found"
}
2013-04-22 14:58:53 +00:00
]
}
]
} ,
{
"path" : "/bridges/{bridgeId}/addChannel" ,
"description" : "Add a channel to a bridge" ,
"operations" : [
{
"httpMethod" : "POST" ,
2025-01-27 08:30:40 -07:00
"since" : [
"12.0.0"
] ,
2013-04-22 14:58:53 +00:00
"summary" : "Add a channel to a bridge." ,
2013-11-07 21:10:31 +00:00
"nickname" : "addChannel" ,
2013-04-22 14:58:53 +00:00
"responseClass" : "void" ,
"parameters" : [
{
"name" : "bridgeId" ,
"description" : "Bridge's id" ,
"paramType" : "path" ,
"required" : true ,
"allowMultiple" : false ,
"dataType" : "string"
} ,
{
"name" : "channel" ,
2013-08-02 14:36:32 +00:00
"description" : "Ids of channels to add to bridge" ,
2013-04-22 14:58:53 +00:00
"paramType" : "query" ,
"required" : true ,
"allowMultiple" : true ,
"dataType" : "string"
2013-08-05 16:59:13 +00:00
} ,
{
"name" : "role" ,
"description" : "Channel's role in the bridge" ,
"paramType" : "query" ,
"required" : false ,
"allowMultiple" : false ,
"dataType" : "string"
2017-10-06 21:48:48 -04:00
} ,
{
"name" : "absorbDTMF" ,
"description" : "Absorb DTMF coming from this channel, preventing it to pass through to the bridge" ,
"paramType" : "query" ,
"required" : false ,
"allowMultiple" : false ,
"dataType" : "boolean" ,
"defaultValue" : false
} ,
{
"name" : "mute" ,
"description" : "Mute audio from this channel, preventing it to pass through to the bridge" ,
"paramType" : "query" ,
"required" : false ,
"allowMultiple" : false ,
"dataType" : "boolean" ,
"defaultValue" : false
2019-11-22 15:32:42 +01:00
} ,
{
"name" : "inhibitConnectedLineUpdates" ,
"description" : "Do not present the identity of the newly connected channel to other bridge members" ,
"paramType" : "query" ,
"required" : false ,
"allowMultiple" : false ,
"dataType" : "boolean" ,
"defaultValue" : false
2013-04-22 14:58:53 +00:00
}
Update events to use Swagger 1.3 subtyping, and related aftermath
This patch started with the simple idea of changing the /events data
model to be more sane. The original model would send out events like:
{ "stasis_start": { "args": [], "channel": { ... } } }
The event discriminator was the field name instead of being a value in
the object, due to limitations in how Swagger 1.1 could model objects.
While technically sufficient in communicating event information, it was
really difficult to deal with in terms of client side JSON handling.
This patch takes advantage of a proposed extension[1] to Swagger which
allows type variance through the use of a discriminator field. This had
a domino effect that made this a surprisingly large patch.
[1]: https://groups.google.com/d/msg/wordnik-api/EC3rGajE0os/ey_5dBI_jWcJ
In changing the models, I also had to change the swagger_model.py
processor so it can handle the type discriminator and subtyping. I took
that a big step forward, and using that information to generate an
ari_model module, which can validate a JSON object against the Swagger
model.
The REST and WebSocket generators were changed to take advantage of the
validators. If compiled with AST_DEVMODE enabled, JSON objects that
don't match their corresponding models will not be sent out. For REST
API calls, a 500 Internal Server response is sent. For WebSockets, the
invalid JSON message is replaced with an error message.
Since this took over about half of the job of the existing JSON
generators, and the .to_json virtual function on messages took over the
other half, I reluctantly removed the generators.
The validators turned up all sorts of errors and inconsistencies in our
data models, and the code. These were cleaned up, with checks in the
code generator avoid some of the consistency problems in the future.
* The model for a channel snapshot was trimmed down to match the
information sent via AMI. Many of the field being sent were not
useful in the general case.
* The model for a bridge snapshot was updated to be more consistent
with the other ARI models.
Another impact of introducing subtyping was that the swagger-codegen
documentation generator was insufficient (at least until it catches up
with Swagger 1.2). I wanted it to be easier to generate docs for the API
anyways, so I ported the wiki pages to use the Asterisk Swagger
generator. In the process, I was able to clean up many of the model
links, which would occasionally give inconsistent results on the wiki. I
also added error responses to the wiki docs, making the wiki
documentation more complete.
Finally, since Stasis-HTTP will now be named Asterisk REST Interface
(ARI), any new functions and files I created carry the ari_ prefix. I
changed a few stasis_http references to ari where it was non-intrusive
and made sense.
(closes issue ASTERISK-21885)
Review: https://reviewboard.asterisk.org/r/2639/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393529 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-03 16:32:41 +00:00
] ,
"errorResponses" : [
2013-08-23 17:19:02 +00:00
{
"code" : 400 ,
"reason" : "Channel not found"
} ,
Update events to use Swagger 1.3 subtyping, and related aftermath
This patch started with the simple idea of changing the /events data
model to be more sane. The original model would send out events like:
{ "stasis_start": { "args": [], "channel": { ... } } }
The event discriminator was the field name instead of being a value in
the object, due to limitations in how Swagger 1.1 could model objects.
While technically sufficient in communicating event information, it was
really difficult to deal with in terms of client side JSON handling.
This patch takes advantage of a proposed extension[1] to Swagger which
allows type variance through the use of a discriminator field. This had
a domino effect that made this a surprisingly large patch.
[1]: https://groups.google.com/d/msg/wordnik-api/EC3rGajE0os/ey_5dBI_jWcJ
In changing the models, I also had to change the swagger_model.py
processor so it can handle the type discriminator and subtyping. I took
that a big step forward, and using that information to generate an
ari_model module, which can validate a JSON object against the Swagger
model.
The REST and WebSocket generators were changed to take advantage of the
validators. If compiled with AST_DEVMODE enabled, JSON objects that
don't match their corresponding models will not be sent out. For REST
API calls, a 500 Internal Server response is sent. For WebSockets, the
invalid JSON message is replaced with an error message.
Since this took over about half of the job of the existing JSON
generators, and the .to_json virtual function on messages took over the
other half, I reluctantly removed the generators.
The validators turned up all sorts of errors and inconsistencies in our
data models, and the code. These were cleaned up, with checks in the
code generator avoid some of the consistency problems in the future.
* The model for a channel snapshot was trimmed down to match the
information sent via AMI. Many of the field being sent were not
useful in the general case.
* The model for a bridge snapshot was updated to be more consistent
with the other ARI models.
Another impact of introducing subtyping was that the swagger-codegen
documentation generator was insufficient (at least until it catches up
with Swagger 1.2). I wanted it to be easier to generate docs for the API
anyways, so I ported the wiki pages to use the Asterisk Swagger
generator. In the process, I was able to clean up many of the model
links, which would occasionally give inconsistent results on the wiki. I
also added error responses to the wiki docs, making the wiki
documentation more complete.
Finally, since Stasis-HTTP will now be named Asterisk REST Interface
(ARI), any new functions and files I created carry the ari_ prefix. I
changed a few stasis_http references to ari where it was non-intrusive
and made sense.
(closes issue ASTERISK-21885)
Review: https://reviewboard.asterisk.org/r/2639/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393529 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-03 16:32:41 +00:00
{
"code" : 404 ,
"reason" : "Bridge not found"
} ,
{
"code" : 409 ,
2013-12-13 16:38:57 +00:00
"reason" : "Bridge not in Stasis application; Channel currently recording"
Update events to use Swagger 1.3 subtyping, and related aftermath
This patch started with the simple idea of changing the /events data
model to be more sane. The original model would send out events like:
{ "stasis_start": { "args": [], "channel": { ... } } }
The event discriminator was the field name instead of being a value in
the object, due to limitations in how Swagger 1.1 could model objects.
While technically sufficient in communicating event information, it was
really difficult to deal with in terms of client side JSON handling.
This patch takes advantage of a proposed extension[1] to Swagger which
allows type variance through the use of a discriminator field. This had
a domino effect that made this a surprisingly large patch.
[1]: https://groups.google.com/d/msg/wordnik-api/EC3rGajE0os/ey_5dBI_jWcJ
In changing the models, I also had to change the swagger_model.py
processor so it can handle the type discriminator and subtyping. I took
that a big step forward, and using that information to generate an
ari_model module, which can validate a JSON object against the Swagger
model.
The REST and WebSocket generators were changed to take advantage of the
validators. If compiled with AST_DEVMODE enabled, JSON objects that
don't match their corresponding models will not be sent out. For REST
API calls, a 500 Internal Server response is sent. For WebSockets, the
invalid JSON message is replaced with an error message.
Since this took over about half of the job of the existing JSON
generators, and the .to_json virtual function on messages took over the
other half, I reluctantly removed the generators.
The validators turned up all sorts of errors and inconsistencies in our
data models, and the code. These were cleaned up, with checks in the
code generator avoid some of the consistency problems in the future.
* The model for a channel snapshot was trimmed down to match the
information sent via AMI. Many of the field being sent were not
useful in the general case.
* The model for a bridge snapshot was updated to be more consistent
with the other ARI models.
Another impact of introducing subtyping was that the swagger-codegen
documentation generator was insufficient (at least until it catches up
with Swagger 1.2). I wanted it to be easier to generate docs for the API
anyways, so I ported the wiki pages to use the Asterisk Swagger
generator. In the process, I was able to clean up many of the model
links, which would occasionally give inconsistent results on the wiki. I
also added error responses to the wiki docs, making the wiki
documentation more complete.
Finally, since Stasis-HTTP will now be named Asterisk REST Interface
(ARI), any new functions and files I created carry the ari_ prefix. I
changed a few stasis_http references to ari where it was non-intrusive
and made sense.
(closes issue ASTERISK-21885)
Review: https://reviewboard.asterisk.org/r/2639/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393529 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-03 16:32:41 +00:00
} ,
{
"code" : 422 ,
2013-08-23 17:19:02 +00:00
"reason" : "Channel not in Stasis application"
Update events to use Swagger 1.3 subtyping, and related aftermath
This patch started with the simple idea of changing the /events data
model to be more sane. The original model would send out events like:
{ "stasis_start": { "args": [], "channel": { ... } } }
The event discriminator was the field name instead of being a value in
the object, due to limitations in how Swagger 1.1 could model objects.
While technically sufficient in communicating event information, it was
really difficult to deal with in terms of client side JSON handling.
This patch takes advantage of a proposed extension[1] to Swagger which
allows type variance through the use of a discriminator field. This had
a domino effect that made this a surprisingly large patch.
[1]: https://groups.google.com/d/msg/wordnik-api/EC3rGajE0os/ey_5dBI_jWcJ
In changing the models, I also had to change the swagger_model.py
processor so it can handle the type discriminator and subtyping. I took
that a big step forward, and using that information to generate an
ari_model module, which can validate a JSON object against the Swagger
model.
The REST and WebSocket generators were changed to take advantage of the
validators. If compiled with AST_DEVMODE enabled, JSON objects that
don't match their corresponding models will not be sent out. For REST
API calls, a 500 Internal Server response is sent. For WebSockets, the
invalid JSON message is replaced with an error message.
Since this took over about half of the job of the existing JSON
generators, and the .to_json virtual function on messages took over the
other half, I reluctantly removed the generators.
The validators turned up all sorts of errors and inconsistencies in our
data models, and the code. These were cleaned up, with checks in the
code generator avoid some of the consistency problems in the future.
* The model for a channel snapshot was trimmed down to match the
information sent via AMI. Many of the field being sent were not
useful in the general case.
* The model for a bridge snapshot was updated to be more consistent
with the other ARI models.
Another impact of introducing subtyping was that the swagger-codegen
documentation generator was insufficient (at least until it catches up
with Swagger 1.2). I wanted it to be easier to generate docs for the API
anyways, so I ported the wiki pages to use the Asterisk Swagger
generator. In the process, I was able to clean up many of the model
links, which would occasionally give inconsistent results on the wiki. I
also added error responses to the wiki docs, making the wiki
documentation more complete.
Finally, since Stasis-HTTP will now be named Asterisk REST Interface
(ARI), any new functions and files I created carry the ari_ prefix. I
changed a few stasis_http references to ari where it was non-intrusive
and made sense.
(closes issue ASTERISK-21885)
Review: https://reviewboard.asterisk.org/r/2639/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393529 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-03 16:32:41 +00:00
}
2013-04-22 14:58:53 +00:00
]
}
]
} ,
{
"path" : "/bridges/{bridgeId}/removeChannel" ,
"description" : "Remove a channel from a bridge" ,
"operations" : [
{
"httpMethod" : "POST" ,
2025-01-27 08:30:40 -07:00
"since" : [
"12.0.0"
] ,
2013-04-22 14:58:53 +00:00
"summary" : "Remove a channel from a bridge." ,
2013-11-07 21:10:31 +00:00
"nickname" : "removeChannel" ,
2013-04-22 14:58:53 +00:00
"responseClass" : "void" ,
"parameters" : [
{
"name" : "bridgeId" ,
"description" : "Bridge's id" ,
"paramType" : "path" ,
"required" : true ,
"allowMultiple" : false ,
"dataType" : "string"
} ,
{
"name" : "channel" ,
2013-08-02 14:36:32 +00:00
"description" : "Ids of channels to remove from bridge" ,
2013-04-22 14:58:53 +00:00
"paramType" : "query" ,
"required" : true ,
"allowMultiple" : true ,
"dataType" : "string"
}
2013-08-23 17:19:02 +00:00
] ,
"errorResponses" : [
{
"code" : 400 ,
"reason" : "Channel not found"
} ,
{
"code" : 404 ,
"reason" : "Bridge not found"
} ,
{
"code" : 409 ,
"reason" : "Bridge not in Stasis application"
} ,
{
"code" : 422 ,
"reason" : "Channel not in this bridge"
}
2013-04-22 14:58:53 +00:00
]
}
]
} ,
2016-11-08 10:11:41 -06:00
{
"path" : "/bridges/{bridgeId}/videoSource/{channelId}" ,
"description" : "Set a channel as the video source in a multi-party bridge" ,
"operations" : [
{
"httpMethod" : "POST" ,
2025-01-27 08:30:40 -07:00
"since" : [
"13.13.0" ,
"14.2.0"
] ,
2016-11-08 10:11:41 -06:00
"summary" : "Set a channel as the video source in a multi-party mixing bridge. This operation has no effect on bridges with two or fewer participants." ,
"nickname" : "setVideoSource" ,
"responseClass" : "void" ,
"parameters" : [
{
"name" : "bridgeId" ,
"description" : "Bridge's id" ,
"paramType" : "path" ,
"required" : true ,
"allowMultiple" : false ,
"dataType" : "string"
} ,
{
"name" : "channelId" ,
"description" : "Channel's id" ,
"paramType" : "path" ,
"required" : true ,
"allowMultiple" : false ,
"dataType" : "string"
}
] ,
"errorResponses" : [
{
"code" : 404 ,
"reason" : "Bridge or Channel not found"
} ,
{
"code" : 409 ,
"reason" : "Channel not in Stasis application"
} ,
{
"code" : 422 ,
"reason" : "Channel not in this Bridge"
}
]
}
]
} ,
{
"path" : "/bridges/{bridgeId}/videoSource" ,
"description" : "Removes any explicit video source" ,
"operations" : [
{
"httpMethod" : "DELETE" ,
2025-01-27 08:30:40 -07:00
"since" : [
"13.13.0" ,
"14.2.0"
] ,
2016-11-08 10:11:41 -06:00
"summary" : "Removes any explicit video source in a multi-party mixing bridge. This operation has no effect on bridges with two or fewer participants. When no explicit video source is set, talk detection will be used to determine the active video stream." ,
"nickname" : "clearVideoSource" ,
"responseClass" : "void" ,
"parameters" : [
{
"name" : "bridgeId" ,
"description" : "Bridge's id" ,
"paramType" : "path" ,
"required" : true ,
"allowMultiple" : false ,
"dataType" : "string"
}
] ,
"errorResponses" : [
{
"code" : 404 ,
"reason" : "Bridge not found"
}
]
}
]
} ,
2013-08-23 00:26:19 +00:00
{
2013-10-16 00:12:36 +00:00
"path" : "/bridges/{bridgeId}/moh" ,
2013-08-23 00:26:19 +00:00
"description" : "Play music on hold to a bridge" ,
"operations" : [
{
"httpMethod" : "POST" ,
2025-01-27 08:30:40 -07:00
"since" : [
"12.0.0"
] ,
2013-08-23 00:26:19 +00:00
"summary" : "Play music on hold to a bridge or change the MOH class that is playing." ,
2013-11-07 21:10:31 +00:00
"nickname" : "startMoh" ,
2013-08-23 00:26:19 +00:00
"responseClass" : "void" ,
"parameters" : [
{
"name" : "bridgeId" ,
"description" : "Bridge's id" ,
"paramType" : "path" ,
"required" : true ,
"allowMultiple" : false ,
"dataType" : "string"
} ,
{
"name" : "mohClass" ,
"description" : "Channel's id" ,
"paramType" : "query" ,
"required" : false ,
"allowMultiple" : false ,
"dataType" : "string"
}
] ,
"errorResponses" : [
{
"code" : 404 ,
"reason" : "Bridge not found"
} ,
{
"code" : 409 ,
"reason" : "Bridge not in Stasis application"
}
]
2013-11-07 21:10:31 +00:00
} ,
2013-08-23 00:26:19 +00:00
{
2013-10-16 00:12:36 +00:00
"httpMethod" : "DELETE" ,
2025-01-27 08:30:40 -07:00
"since" : [
"12.0.0"
] ,
2013-08-23 00:26:19 +00:00
"summary" : "Stop playing music on hold to a bridge." ,
2013-11-07 21:10:31 +00:00
"notes" : "This will only stop music on hold being played via POST bridges/{bridgeId}/moh." ,
"nickname" : "stopMoh" ,
2013-08-23 00:26:19 +00:00
"responseClass" : "void" ,
"parameters" : [
{
"name" : "bridgeId" ,
"description" : "Bridge's id" ,
"paramType" : "path" ,
"required" : true ,
"allowMultiple" : false ,
"dataType" : "string"
}
] ,
"errorResponses" : [
{
"code" : 404 ,
"reason" : "Bridge not found"
} ,
{
"code" : 409 ,
"reason" : "Bridge not in Stasis application"
}
]
}
]
} ,
2013-07-19 19:35:21 +00:00
{
"path" : "/bridges/{bridgeId}/play" ,
"description" : "Play media to the participants of a bridge" ,
"operations" : [
{
"httpMethod" : "POST" ,
2025-01-27 08:30:40 -07:00
"since" : [
"12.0.0"
] ,
2013-07-19 19:35:21 +00:00
"summary" : "Start playback of media on a bridge." ,
2014-04-17 21:57:36 +00:00
"notes" : "The media URI may be any of a number of URI's. Currently sound:, recording:, number:, digits:, characters:, and tone: URI's are supported. This operation creates a playback resource that can be used to control the playback of media (pause, rewind, fast forward, etc.)" ,
2013-11-07 21:10:31 +00:00
"nickname" : "play" ,
2013-07-19 19:35:21 +00:00
"responseClass" : "Playback" ,
"parameters" : [
{
"name" : "bridgeId" ,
"description" : "Bridge's id" ,
"paramType" : "path" ,
"required" : true ,
"allowMultiple" : false ,
"dataType" : "string"
} ,
{
"name" : "media" ,
ARI: Add the ability to play multiple media URIs in a single operation
Many ARI applications will want to play multiple media files in a row to
a resource. The most common use case is when building long-ish IVR prompts
made up of multiple, smaller sound files. Today, that requires building a
small state machine, listening for each PlaybackFinished event, and triggering
the next sound file to play. While not especially challenging, it is tedious
work. Since requiring developers to write tedious code to do normal activities
stinks, this patch adds the ability to play back a list of media files to a
resource.
Each of the 'play' operations on supported resources (channels and bridges)
now accepts a comma delineated list of media URIs to play. A single Playback
resource is created as a handle to the entire list. The operation of playing
a list is identical to playing a single media URI, save that a new event,
PlaybackContinuing, is raised instead of a PlaybackFinished for each non-final
media URI. When the entire list is finished being played, a PlaybackFinished
event is raised.
In order to help inform applications where they are in the list playback, the
Playback resource now includes a new, optional attribute, 'next_media_uri',
that contains the next URI in the list to be played.
It's important to note the following:
- If an offset is provided to the 'play' operations, it only applies to the
first media URI, as it would be weird to skip n seconds forward in every
media resource.
- Operations that control the position of the media only affect the current
media being played. For example, once a media resource in the list
completes, a 'reverse' operation on a subsequent media resource will not
start a previously completed media resource at the appropiate offset.
- This patch does not add any new operations to control the list. Hopefully,
user feedback and/or future patches would add that if people want it.
ASTERISK-26022 #close
Change-Id: Ie1ea5356573447b8f51f2e7964915ea01792f16f
2016-04-18 18:17:08 -05:00
"description" : "Media URIs to play." ,
2013-07-19 19:35:21 +00:00
"paramType" : "query" ,
"required" : true ,
ARI: Add the ability to play multiple media URIs in a single operation
Many ARI applications will want to play multiple media files in a row to
a resource. The most common use case is when building long-ish IVR prompts
made up of multiple, smaller sound files. Today, that requires building a
small state machine, listening for each PlaybackFinished event, and triggering
the next sound file to play. While not especially challenging, it is tedious
work. Since requiring developers to write tedious code to do normal activities
stinks, this patch adds the ability to play back a list of media files to a
resource.
Each of the 'play' operations on supported resources (channels and bridges)
now accepts a comma delineated list of media URIs to play. A single Playback
resource is created as a handle to the entire list. The operation of playing
a list is identical to playing a single media URI, save that a new event,
PlaybackContinuing, is raised instead of a PlaybackFinished for each non-final
media URI. When the entire list is finished being played, a PlaybackFinished
event is raised.
In order to help inform applications where they are in the list playback, the
Playback resource now includes a new, optional attribute, 'next_media_uri',
that contains the next URI in the list to be played.
It's important to note the following:
- If an offset is provided to the 'play' operations, it only applies to the
first media URI, as it would be weird to skip n seconds forward in every
media resource.
- Operations that control the position of the media only affect the current
media being played. For example, once a media resource in the list
completes, a 'reverse' operation on a subsequent media resource will not
start a previously completed media resource at the appropiate offset.
- This patch does not add any new operations to control the list. Hopefully,
user feedback and/or future patches would add that if people want it.
ASTERISK-26022 #close
Change-Id: Ie1ea5356573447b8f51f2e7964915ea01792f16f
2016-04-18 18:17:08 -05:00
"allowMultiple" : true ,
2013-07-19 19:35:21 +00:00
"dataType" : "string"
} ,
{
"name" : "lang" ,
"description" : "For sounds, selects language for sound." ,
"paramType" : "query" ,
"required" : false ,
"allowMultiple" : false ,
"dataType" : "string"
} ,
{
"name" : "offsetms" ,
ARI: Add the ability to play multiple media URIs in a single operation
Many ARI applications will want to play multiple media files in a row to
a resource. The most common use case is when building long-ish IVR prompts
made up of multiple, smaller sound files. Today, that requires building a
small state machine, listening for each PlaybackFinished event, and triggering
the next sound file to play. While not especially challenging, it is tedious
work. Since requiring developers to write tedious code to do normal activities
stinks, this patch adds the ability to play back a list of media files to a
resource.
Each of the 'play' operations on supported resources (channels and bridges)
now accepts a comma delineated list of media URIs to play. A single Playback
resource is created as a handle to the entire list. The operation of playing
a list is identical to playing a single media URI, save that a new event,
PlaybackContinuing, is raised instead of a PlaybackFinished for each non-final
media URI. When the entire list is finished being played, a PlaybackFinished
event is raised.
In order to help inform applications where they are in the list playback, the
Playback resource now includes a new, optional attribute, 'next_media_uri',
that contains the next URI in the list to be played.
It's important to note the following:
- If an offset is provided to the 'play' operations, it only applies to the
first media URI, as it would be weird to skip n seconds forward in every
media resource.
- Operations that control the position of the media only affect the current
media being played. For example, once a media resource in the list
completes, a 'reverse' operation on a subsequent media resource will not
start a previously completed media resource at the appropiate offset.
- This patch does not add any new operations to control the list. Hopefully,
user feedback and/or future patches would add that if people want it.
ASTERISK-26022 #close
Change-Id: Ie1ea5356573447b8f51f2e7964915ea01792f16f
2016-04-18 18:17:08 -05:00
"description" : "Number of milliseconds to skip before playing. Only applies to the first URI if multiple media URIs are specified." ,
2013-07-19 19:35:21 +00:00
"paramType" : "query" ,
"required" : false ,
"allowMultiple" : false ,
"dataType" : "int" ,
"defaultValue" : 0 ,
"allowableValues" : {
"valueType" : "RANGE" ,
"min" : 0
}
} ,
{
"name" : "skipms" ,
"description" : "Number of milliseconds to skip for forward/reverse operations." ,
"paramType" : "query" ,
"required" : false ,
"allowMultiple" : false ,
"dataType" : "int" ,
"defaultValue" : 3000 ,
"allowableValues" : {
"valueType" : "RANGE" ,
"min" : 0
}
2014-04-18 20:09:24 +00:00
} ,
{
"name" : "playbackId" ,
"description" : "Playback Id." ,
"paramType" : "query" ,
"required" : false ,
"allowMultiple" : false ,
"dataType" : "string"
2013-07-19 19:35:21 +00:00
}
] ,
"errorResponses" : [
{
"code" : 404 ,
"reason" : "Bridge not found"
} ,
{
"code" : 409 ,
"reason" : "Bridge not in a Stasis application"
}
]
}
]
} ,
2014-04-18 20:09:24 +00:00
{
"path" : "/bridges/{bridgeId}/play/{playbackId}" ,
"description" : "Play media to a bridge" ,
"operations" : [
{
"httpMethod" : "POST" ,
2025-01-27 08:30:40 -07:00
"since" : [
"12.3.0"
] ,
2014-04-18 20:09:24 +00:00
"summary" : "Start playback of media on a bridge." ,
2015-01-27 17:21:03 +00:00
"notes" : "The media URI may be any of a number of URI's. Currently sound:, recording:, number:, digits:, characters:, and tone: URI's are supported. This operation creates a playback resource that can be used to control the playback of media (pause, rewind, fast forward, etc.)" ,
2014-04-18 20:09:24 +00:00
"nickname" : "playWithId" ,
"responseClass" : "Playback" ,
"parameters" : [
{
"name" : "bridgeId" ,
"description" : "Bridge's id" ,
"paramType" : "path" ,
"required" : true ,
"allowMultiple" : false ,
"dataType" : "string"
} ,
{
"name" : "playbackId" ,
"description" : "Playback ID." ,
"paramType" : "path" ,
"required" : true ,
"allowMultiple" : false ,
"dataType" : "string"
} ,
{
"name" : "media" ,
ARI: Add the ability to play multiple media URIs in a single operation
Many ARI applications will want to play multiple media files in a row to
a resource. The most common use case is when building long-ish IVR prompts
made up of multiple, smaller sound files. Today, that requires building a
small state machine, listening for each PlaybackFinished event, and triggering
the next sound file to play. While not especially challenging, it is tedious
work. Since requiring developers to write tedious code to do normal activities
stinks, this patch adds the ability to play back a list of media files to a
resource.
Each of the 'play' operations on supported resources (channels and bridges)
now accepts a comma delineated list of media URIs to play. A single Playback
resource is created as a handle to the entire list. The operation of playing
a list is identical to playing a single media URI, save that a new event,
PlaybackContinuing, is raised instead of a PlaybackFinished for each non-final
media URI. When the entire list is finished being played, a PlaybackFinished
event is raised.
In order to help inform applications where they are in the list playback, the
Playback resource now includes a new, optional attribute, 'next_media_uri',
that contains the next URI in the list to be played.
It's important to note the following:
- If an offset is provided to the 'play' operations, it only applies to the
first media URI, as it would be weird to skip n seconds forward in every
media resource.
- Operations that control the position of the media only affect the current
media being played. For example, once a media resource in the list
completes, a 'reverse' operation on a subsequent media resource will not
start a previously completed media resource at the appropiate offset.
- This patch does not add any new operations to control the list. Hopefully,
user feedback and/or future patches would add that if people want it.
ASTERISK-26022 #close
Change-Id: Ie1ea5356573447b8f51f2e7964915ea01792f16f
2016-04-18 18:17:08 -05:00
"description" : "Media URIs to play." ,
2014-04-18 20:09:24 +00:00
"paramType" : "query" ,
"required" : true ,
ARI: Add the ability to play multiple media URIs in a single operation
Many ARI applications will want to play multiple media files in a row to
a resource. The most common use case is when building long-ish IVR prompts
made up of multiple, smaller sound files. Today, that requires building a
small state machine, listening for each PlaybackFinished event, and triggering
the next sound file to play. While not especially challenging, it is tedious
work. Since requiring developers to write tedious code to do normal activities
stinks, this patch adds the ability to play back a list of media files to a
resource.
Each of the 'play' operations on supported resources (channels and bridges)
now accepts a comma delineated list of media URIs to play. A single Playback
resource is created as a handle to the entire list. The operation of playing
a list is identical to playing a single media URI, save that a new event,
PlaybackContinuing, is raised instead of a PlaybackFinished for each non-final
media URI. When the entire list is finished being played, a PlaybackFinished
event is raised.
In order to help inform applications where they are in the list playback, the
Playback resource now includes a new, optional attribute, 'next_media_uri',
that contains the next URI in the list to be played.
It's important to note the following:
- If an offset is provided to the 'play' operations, it only applies to the
first media URI, as it would be weird to skip n seconds forward in every
media resource.
- Operations that control the position of the media only affect the current
media being played. For example, once a media resource in the list
completes, a 'reverse' operation on a subsequent media resource will not
start a previously completed media resource at the appropiate offset.
- This patch does not add any new operations to control the list. Hopefully,
user feedback and/or future patches would add that if people want it.
ASTERISK-26022 #close
Change-Id: Ie1ea5356573447b8f51f2e7964915ea01792f16f
2016-04-18 18:17:08 -05:00
"allowMultiple" : true ,
2014-04-18 20:09:24 +00:00
"dataType" : "string"
} ,
{
"name" : "lang" ,
"description" : "For sounds, selects language for sound." ,
"paramType" : "query" ,
"required" : false ,
"allowMultiple" : false ,
"dataType" : "string"
} ,
{
"name" : "offsetms" ,
ARI: Add the ability to play multiple media URIs in a single operation
Many ARI applications will want to play multiple media files in a row to
a resource. The most common use case is when building long-ish IVR prompts
made up of multiple, smaller sound files. Today, that requires building a
small state machine, listening for each PlaybackFinished event, and triggering
the next sound file to play. While not especially challenging, it is tedious
work. Since requiring developers to write tedious code to do normal activities
stinks, this patch adds the ability to play back a list of media files to a
resource.
Each of the 'play' operations on supported resources (channels and bridges)
now accepts a comma delineated list of media URIs to play. A single Playback
resource is created as a handle to the entire list. The operation of playing
a list is identical to playing a single media URI, save that a new event,
PlaybackContinuing, is raised instead of a PlaybackFinished for each non-final
media URI. When the entire list is finished being played, a PlaybackFinished
event is raised.
In order to help inform applications where they are in the list playback, the
Playback resource now includes a new, optional attribute, 'next_media_uri',
that contains the next URI in the list to be played.
It's important to note the following:
- If an offset is provided to the 'play' operations, it only applies to the
first media URI, as it would be weird to skip n seconds forward in every
media resource.
- Operations that control the position of the media only affect the current
media being played. For example, once a media resource in the list
completes, a 'reverse' operation on a subsequent media resource will not
start a previously completed media resource at the appropiate offset.
- This patch does not add any new operations to control the list. Hopefully,
user feedback and/or future patches would add that if people want it.
ASTERISK-26022 #close
Change-Id: Ie1ea5356573447b8f51f2e7964915ea01792f16f
2016-04-18 18:17:08 -05:00
"description" : "Number of milliseconds to skip before playing. Only applies to the first URI if multiple media URIs are specified." ,
2014-04-18 20:09:24 +00:00
"paramType" : "query" ,
"required" : false ,
"allowMultiple" : false ,
"dataType" : "int" ,
"defaultValue" : 0 ,
"allowableValues" : {
"valueType" : "RANGE" ,
"min" : 0
}
} ,
{
"name" : "skipms" ,
"description" : "Number of milliseconds to skip for forward/reverse operations." ,
"paramType" : "query" ,
"required" : false ,
"allowMultiple" : false ,
"dataType" : "int" ,
"defaultValue" : 3000 ,
"allowableValues" : {
"valueType" : "RANGE" ,
"min" : 0
}
}
] ,
"errorResponses" : [
{
"code" : 404 ,
"reason" : "Bridge not found"
} ,
{
"code" : 409 ,
"reason" : "Bridge not in a Stasis application"
}
]
}
]
} ,
2013-04-22 14:58:53 +00:00
{
"path" : "/bridges/{bridgeId}/record" ,
"description" : "Record audio on a bridge" ,
"operations" : [
{
"httpMethod" : "POST" ,
2025-01-27 08:30:40 -07:00
"since" : [
"12.0.0"
] ,
2013-04-22 14:58:53 +00:00
"summary" : "Start a recording." ,
"notes" : "This records the mixed audio from all channels participating in this bridge." ,
2013-11-07 21:10:31 +00:00
"nickname" : "record" ,
2013-04-22 14:58:53 +00:00
"responseClass" : "LiveRecording" ,
"parameters" : [
{
"name" : "bridgeId" ,
"description" : "Bridge's id" ,
"paramType" : "path" ,
"required" : true ,
"allowMultiple" : false ,
"dataType" : "string"
} ,
{
"name" : "name" ,
"description" : "Recording's filename" ,
"paramType" : "query" ,
"required" : true ,
"allowMultiple" : false ,
"dataType" : "string"
} ,
2013-07-19 19:35:21 +00:00
{
"name" : "format" ,
"description" : "Format to encode audio in" ,
"paramType" : "query" ,
"required" : true ,
2013-08-02 14:36:32 +00:00
"allowMultiple" : false ,
2013-07-19 19:35:21 +00:00
"dataType" : "string"
} ,
2013-04-22 14:58:53 +00:00
{
"name" : "maxDurationSeconds" ,
"description" : "Maximum duration of the recording, in seconds. 0 for no limit." ,
"paramType" : "query" ,
"required" : false ,
"allowMultiple" : false ,
"dataType" : "int" ,
2013-07-19 19:35:21 +00:00
"defaultValue" : 0 ,
"allowableValues" : {
"valueType" : "RANGE" ,
"min" : 0
}
2013-04-22 14:58:53 +00:00
} ,
{
"name" : "maxSilenceSeconds" ,
"description" : "Maximum duration of silence, in seconds. 0 for no limit." ,
"paramType" : "query" ,
"required" : false ,
"allowMultiple" : false ,
"dataType" : "int" ,
2013-07-19 19:35:21 +00:00
"defaultValue" : 0 ,
"allowableValues" : {
"valueType" : "RANGE" ,
"min" : 0
}
2013-04-22 14:58:53 +00:00
} ,
{
2013-07-19 19:35:21 +00:00
"name" : "ifExists" ,
"description" : "Action to take if a recording with the same name already exists." ,
2013-04-22 14:58:53 +00:00
"paramType" : "query" ,
"required" : false ,
"allowMultiple" : false ,
2013-07-19 19:35:21 +00:00
"dataType" : "string" ,
"defaultValue" : "fail" ,
"allowableValues" : {
"valueType" : "LIST" ,
"values" : [
"fail" ,
"overwrite" ,
"append"
]
}
2013-04-22 14:58:53 +00:00
} ,
{
"name" : "beep" ,
"description" : "Play beep when recording begins" ,
"paramType" : "query" ,
"required" : false ,
"allowMultiple" : false ,
"dataType" : "boolean" ,
"defaultValue" : false
} ,
{
"name" : "terminateOn" ,
"description" : "DTMF input to terminate recording." ,
"paramType" : "query" ,
"required" : false ,
"allowMultiple" : false ,
"dataType" : "string" ,
"defaultValue" : "none" ,
"allowableValues" : {
"valueType" : "LIST" ,
"values" : [
"none" ,
"any" ,
"*" ,
"#"
]
}
}
2013-10-15 20:03:19 +00:00
] ,
2013-10-25 21:28:32 +00:00
"errorResponses" : [
{
"code" : 400 ,
"reason" : "Invalid parameters"
} ,
{
"code" : 404 ,
"reason" : "Bridge not found"
} ,
{
"code" : 409 ,
"reason" : "Bridge is not in a Stasis application; A recording with the same name already exists on the system and can not be overwritten because it is in progress or ifExists=fail"
2013-10-25 22:01:43 +00:00
} ,
{
"code" : 422 ,
"reason" : "The format specified is unknown on this system"
}
2013-10-25 21:28:32 +00:00
]
2013-04-22 14:58:53 +00:00
}
]
}
] ,
"models" : {
"Bridge" : {
"id" : "Bridge" ,
Update events to use Swagger 1.3 subtyping, and related aftermath
This patch started with the simple idea of changing the /events data
model to be more sane. The original model would send out events like:
{ "stasis_start": { "args": [], "channel": { ... } } }
The event discriminator was the field name instead of being a value in
the object, due to limitations in how Swagger 1.1 could model objects.
While technically sufficient in communicating event information, it was
really difficult to deal with in terms of client side JSON handling.
This patch takes advantage of a proposed extension[1] to Swagger which
allows type variance through the use of a discriminator field. This had
a domino effect that made this a surprisingly large patch.
[1]: https://groups.google.com/d/msg/wordnik-api/EC3rGajE0os/ey_5dBI_jWcJ
In changing the models, I also had to change the swagger_model.py
processor so it can handle the type discriminator and subtyping. I took
that a big step forward, and using that information to generate an
ari_model module, which can validate a JSON object against the Swagger
model.
The REST and WebSocket generators were changed to take advantage of the
validators. If compiled with AST_DEVMODE enabled, JSON objects that
don't match their corresponding models will not be sent out. For REST
API calls, a 500 Internal Server response is sent. For WebSockets, the
invalid JSON message is replaced with an error message.
Since this took over about half of the job of the existing JSON
generators, and the .to_json virtual function on messages took over the
other half, I reluctantly removed the generators.
The validators turned up all sorts of errors and inconsistencies in our
data models, and the code. These were cleaned up, with checks in the
code generator avoid some of the consistency problems in the future.
* The model for a channel snapshot was trimmed down to match the
information sent via AMI. Many of the field being sent were not
useful in the general case.
* The model for a bridge snapshot was updated to be more consistent
with the other ARI models.
Another impact of introducing subtyping was that the swagger-codegen
documentation generator was insufficient (at least until it catches up
with Swagger 1.2). I wanted it to be easier to generate docs for the API
anyways, so I ported the wiki pages to use the Asterisk Swagger
generator. In the process, I was able to clean up many of the model
links, which would occasionally give inconsistent results on the wiki. I
also added error responses to the wiki docs, making the wiki
documentation more complete.
Finally, since Stasis-HTTP will now be named Asterisk REST Interface
(ARI), any new functions and files I created carry the ari_ prefix. I
changed a few stasis_http references to ari where it was non-intrusive
and made sense.
(closes issue ASTERISK-21885)
Review: https://reviewboard.asterisk.org/r/2639/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393529 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-03 16:32:41 +00:00
"description" : "The merging of media from one or more channels.\n\nEveryone on the bridge receives the same audio." ,
2013-04-22 14:58:53 +00:00
"properties" : {
Update events to use Swagger 1.3 subtyping, and related aftermath
This patch started with the simple idea of changing the /events data
model to be more sane. The original model would send out events like:
{ "stasis_start": { "args": [], "channel": { ... } } }
The event discriminator was the field name instead of being a value in
the object, due to limitations in how Swagger 1.1 could model objects.
While technically sufficient in communicating event information, it was
really difficult to deal with in terms of client side JSON handling.
This patch takes advantage of a proposed extension[1] to Swagger which
allows type variance through the use of a discriminator field. This had
a domino effect that made this a surprisingly large patch.
[1]: https://groups.google.com/d/msg/wordnik-api/EC3rGajE0os/ey_5dBI_jWcJ
In changing the models, I also had to change the swagger_model.py
processor so it can handle the type discriminator and subtyping. I took
that a big step forward, and using that information to generate an
ari_model module, which can validate a JSON object against the Swagger
model.
The REST and WebSocket generators were changed to take advantage of the
validators. If compiled with AST_DEVMODE enabled, JSON objects that
don't match their corresponding models will not be sent out. For REST
API calls, a 500 Internal Server response is sent. For WebSockets, the
invalid JSON message is replaced with an error message.
Since this took over about half of the job of the existing JSON
generators, and the .to_json virtual function on messages took over the
other half, I reluctantly removed the generators.
The validators turned up all sorts of errors and inconsistencies in our
data models, and the code. These were cleaned up, with checks in the
code generator avoid some of the consistency problems in the future.
* The model for a channel snapshot was trimmed down to match the
information sent via AMI. Many of the field being sent were not
useful in the general case.
* The model for a bridge snapshot was updated to be more consistent
with the other ARI models.
Another impact of introducing subtyping was that the swagger-codegen
documentation generator was insufficient (at least until it catches up
with Swagger 1.2). I wanted it to be easier to generate docs for the API
anyways, so I ported the wiki pages to use the Asterisk Swagger
generator. In the process, I was able to clean up many of the model
links, which would occasionally give inconsistent results on the wiki. I
also added error responses to the wiki docs, making the wiki
documentation more complete.
Finally, since Stasis-HTTP will now be named Asterisk REST Interface
(ARI), any new functions and files I created carry the ari_ prefix. I
changed a few stasis_http references to ari where it was non-intrusive
and made sense.
(closes issue ASTERISK-21885)
Review: https://reviewboard.asterisk.org/r/2639/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393529 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-03 16:32:41 +00:00
"id" : {
"type" : "string" ,
"description" : "Unique identifier for this bridge" ,
"required" : true
} ,
"technology" : {
"type" : "string" ,
"description" : "Name of the current bridging technology" ,
"required" : true
} ,
"bridge_type" : {
2013-04-22 14:58:53 +00:00
"type" : "string" ,
"description" : "Type of bridge technology" ,
"required" : true ,
Update events to use Swagger 1.3 subtyping, and related aftermath
This patch started with the simple idea of changing the /events data
model to be more sane. The original model would send out events like:
{ "stasis_start": { "args": [], "channel": { ... } } }
The event discriminator was the field name instead of being a value in
the object, due to limitations in how Swagger 1.1 could model objects.
While technically sufficient in communicating event information, it was
really difficult to deal with in terms of client side JSON handling.
This patch takes advantage of a proposed extension[1] to Swagger which
allows type variance through the use of a discriminator field. This had
a domino effect that made this a surprisingly large patch.
[1]: https://groups.google.com/d/msg/wordnik-api/EC3rGajE0os/ey_5dBI_jWcJ
In changing the models, I also had to change the swagger_model.py
processor so it can handle the type discriminator and subtyping. I took
that a big step forward, and using that information to generate an
ari_model module, which can validate a JSON object against the Swagger
model.
The REST and WebSocket generators were changed to take advantage of the
validators. If compiled with AST_DEVMODE enabled, JSON objects that
don't match their corresponding models will not be sent out. For REST
API calls, a 500 Internal Server response is sent. For WebSockets, the
invalid JSON message is replaced with an error message.
Since this took over about half of the job of the existing JSON
generators, and the .to_json virtual function on messages took over the
other half, I reluctantly removed the generators.
The validators turned up all sorts of errors and inconsistencies in our
data models, and the code. These were cleaned up, with checks in the
code generator avoid some of the consistency problems in the future.
* The model for a channel snapshot was trimmed down to match the
information sent via AMI. Many of the field being sent were not
useful in the general case.
* The model for a bridge snapshot was updated to be more consistent
with the other ARI models.
Another impact of introducing subtyping was that the swagger-codegen
documentation generator was insufficient (at least until it catches up
with Swagger 1.2). I wanted it to be easier to generate docs for the API
anyways, so I ported the wiki pages to use the Asterisk Swagger
generator. In the process, I was able to clean up many of the model
links, which would occasionally give inconsistent results on the wiki. I
also added error responses to the wiki docs, making the wiki
documentation more complete.
Finally, since Stasis-HTTP will now be named Asterisk REST Interface
(ARI), any new functions and files I created carry the ari_ prefix. I
changed a few stasis_http references to ari where it was non-intrusive
and made sense.
(closes issue ASTERISK-21885)
Review: https://reviewboard.asterisk.org/r/2639/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393529 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-03 16:32:41 +00:00
"allowableValues" : {
"valueType" : "LIST" ,
2013-04-22 14:58:53 +00:00
"values" : [
2013-06-18 14:30:06 +00:00
"mixing" ,
2013-04-22 14:58:53 +00:00
"holding"
]
}
} ,
Update events to use Swagger 1.3 subtyping, and related aftermath
This patch started with the simple idea of changing the /events data
model to be more sane. The original model would send out events like:
{ "stasis_start": { "args": [], "channel": { ... } } }
The event discriminator was the field name instead of being a value in
the object, due to limitations in how Swagger 1.1 could model objects.
While technically sufficient in communicating event information, it was
really difficult to deal with in terms of client side JSON handling.
This patch takes advantage of a proposed extension[1] to Swagger which
allows type variance through the use of a discriminator field. This had
a domino effect that made this a surprisingly large patch.
[1]: https://groups.google.com/d/msg/wordnik-api/EC3rGajE0os/ey_5dBI_jWcJ
In changing the models, I also had to change the swagger_model.py
processor so it can handle the type discriminator and subtyping. I took
that a big step forward, and using that information to generate an
ari_model module, which can validate a JSON object against the Swagger
model.
The REST and WebSocket generators were changed to take advantage of the
validators. If compiled with AST_DEVMODE enabled, JSON objects that
don't match their corresponding models will not be sent out. For REST
API calls, a 500 Internal Server response is sent. For WebSockets, the
invalid JSON message is replaced with an error message.
Since this took over about half of the job of the existing JSON
generators, and the .to_json virtual function on messages took over the
other half, I reluctantly removed the generators.
The validators turned up all sorts of errors and inconsistencies in our
data models, and the code. These were cleaned up, with checks in the
code generator avoid some of the consistency problems in the future.
* The model for a channel snapshot was trimmed down to match the
information sent via AMI. Many of the field being sent were not
useful in the general case.
* The model for a bridge snapshot was updated to be more consistent
with the other ARI models.
Another impact of introducing subtyping was that the swagger-codegen
documentation generator was insufficient (at least until it catches up
with Swagger 1.2). I wanted it to be easier to generate docs for the API
anyways, so I ported the wiki pages to use the Asterisk Swagger
generator. In the process, I was able to clean up many of the model
links, which would occasionally give inconsistent results on the wiki. I
also added error responses to the wiki docs, making the wiki
documentation more complete.
Finally, since Stasis-HTTP will now be named Asterisk REST Interface
(ARI), any new functions and files I created carry the ari_ prefix. I
changed a few stasis_http references to ari where it was non-intrusive
and made sense.
(closes issue ASTERISK-21885)
Review: https://reviewboard.asterisk.org/r/2639/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393529 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-03 16:32:41 +00:00
"bridge_class" : {
"type" : "string" ,
"description" : "Bridging class" ,
"required" : true
} ,
2013-12-17 23:25:49 +00:00
"creator" : {
"type" : "string" ,
"description" : "Entity that created the bridge" ,
"required" : true
} ,
"name" : {
"type" : "string" ,
"description" : "Name the creator gave the bridge" ,
"required" : true
} ,
2013-04-22 14:58:53 +00:00
"channels" : {
"type" : "List[string]" ,
2013-08-02 14:36:32 +00:00
"description" : "Ids of channels participating in this bridge" ,
2013-04-22 14:58:53 +00:00
"required" : true
2016-11-08 10:11:41 -06:00
} ,
"video_mode" : {
"type" : "string" ,
2020-08-30 22:42:06 +02:00
"description" : "The video mode the bridge is using. One of 'none', 'talker', 'sfu', or 'single'." ,
2016-11-08 10:11:41 -06:00
"required" : false
} ,
"video_source_id" : {
"type" : "string" ,
"description" : "The ID of the channel that is the source of video in this bridge, if one exists." ,
"required" : false
2019-02-08 22:32:18 +01:00
} ,
"creationtime" : {
"required" : true ,
"type" : "Date" ,
"description" : "Timestamp when bridge was created"
2013-04-22 14:58:53 +00:00
}
}
}
}
}