[Home]

Summary:ASTERISK-25630: ari: Creating bridge with id of one that exists outside of ARI doesn't cause error
Reporter:Sylvain Boily (sboily_proformatique)Labels:
Date Opened:2015-12-15 14:40:22.000-0600Date Closed:
Priority:MinorRegression?No
Status:Open/NewComponents:Resources/res_ari_bridges
Versions:13.6.0 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:Hello,

A call B
B answer

You have a bridge

On my asterisk CLI:

{code}
xivo*CLI>  bridge show b1d8fb21-ec6d-469a-9dde-bb6bfd5618cc
Id: b1d8fb21-ec6d-469a-9dde-bb6bfd5618cc
Type: basic
Technology: simple_bridge
Num-Channels: 2
Channel: SIP/tcu9tz-00000032
Channel: SIP/c4i2zd-00000031
{code}

Now with swagger UI on bridges section.

{code}
POST /bridges/b1d8fb21-ec6d-469a-9dde-bb6bfd5618cc with type holding for
example.

200 ok
{code}

On asterisk CLI:

{code}
xivo*CLI>  bridge show b1d8fb21-ec6d-469a-9dde-bb6bfd5618cc
Id: b1d8fb21-ec6d-469a-9dde-bb6bfd5618cc
Type: stasis
Technology: holding_bridge
Num-Channels: 0
{code}

On swagger UI:

{code}
DELETE /bridges/b1d8fb21-ec6d-469a-9dde-bb6bfd5618cc

204 ok
{code}

On asterisk CLI:

{code}
xivo*CLI>  bridge show b1d8fb21-ec6d-469a-9dde-bb6bfd5618cc
Bridge 'b1d8fb21-ec6d-469a-9dde-bb6bfd5618cc' not found
{code}
Comments:By: Asterisk Team (asteriskteam) 2015-12-15 14:40:24.857-0600

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

By: Matt Jordan (mjordan) 2015-12-15 17:09:55.792-0600

This isn't a bug - the {{POST}} HTTP request will create or update an existing bridge. (Yes, it should have been a {{PUT}}... sorry about that :-( )

Quoting the wiki page here:

{quote}
createWithId: POST /bridges/{bridgeId}

Create a new bridge or updates an existing one. This bridge persists until it has been shut down, or Asterisk has been shut down.
Path parameters

   bridgeId: string - Unique ID to give to the bridge being created.

Query parameters

   type: string - Comma separated list of bridge type attributes (mixing, holding, dtmf_events, proxy_media) to set.
   name: string - Set the name of the bridge.
{quote}

So, when you ran the ARI query on the existing bridge, you changed the mixing type from {{simple_bridge}} to {{holding}}. That's a pretty intrusive change to make ... but it did it anyway. When you deleted the bridge, it then destroyed it.

ARI is very careful about protecting the users from manipulating channels they don't own. It isn't quite so careful about bridges, simply because bridges have a much looser ownership model internally in Asterisk. As such, you're free to shoot yourself in the foot with ARI when it comes to updating bridges that already exist.

By: Matt Jordan (mjordan) 2015-12-15 17:10:12.918-0600

Wiki page: https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Bridges+REST+API#Asterisk13BridgesRESTAPI-createWithId

By: Sylvain Boily (sboily_proformatique) 2015-12-15 17:19:03.590-0600

Ok, but is it normal when we POST an update on a non stasis bridge, it overriding the existing bridge (non stasis) ? We loose the channels on this bridge on API and CLI, but call is up. The status in incoherent if we do this. Maybe it would be better to raise an error when you want to update a non stasis bridge ?

By: Richard Mudgett (rmudgett) 2015-12-15 20:39:27.205-0600

[~mjordan] already answered that:
{quote}
ARI is very careful about protecting the users from manipulating channels they don't own. It isn't quite so careful about bridges, simply because bridges have a much looser ownership model internally in Asterisk. As such, you're free to shoot yourself in the foot with ARI when it comes to updating bridges that already exist.
{quote}


By: Sylvain Boily (sboily_proformatique) 2015-12-16 06:27:29.743-0600

ok no problem it's a choice of implementation :)
This bug has been open because Josh asked on mailing list to open it on jira.
My point is that the functional is different if you have a stasis bridge or a non stasis bridge with the ari API.
You can close it, if you're ok with it.

By: Joshua C. Colp (jcolp) 2015-12-20 17:23:27.042-0600

There is an actual error here as you should not be able to create a bridge in this case, it should return an error.