[Home]

Summary:ASTERISK-23051: ARI: channel variables in JSON breaks passing parameters in JSON
Reporter:Matt Jordan (mjordan)Labels:
Date Opened:2013-12-20 15:34:40.000-0600Date Closed:2014-01-21 08:17:03.000-0600
Priority:CriticalRegression?
Status:Closed/CompleteComponents:Resources/res_ari
Versions:12.0.0 Frequency of
Occurrence
Related
Issues:
is caused byASTERISK-22872 ARI: Allow specifying channel variables during a POST /channels
Environment:Attachments:
Description:So, since the variables thing was added to the ARI call origination, it now acts differently from all the other calls.

The other POST calls can all take their parameters as either url params or from an application/json body document.

Unfortunately, the post body of the originate (POST /ari/channels) behaves differently; fields passed in the JSON object are treated as variable names, not as parameters.  For this one call, you must pass parameters in the URL.

Ideally, this would have been just:
{noformat}
    { "endpoint": "SIP/200", ..... "variables":  { "name1": "value1", "name2": "value2"} }
{noformat}

Comments:By: Kevin Harwell (kharwell) 2013-12-20 15:58:35.864-0600

Something to think about when this gets put back in: The channel variables are still being set post originate.  So a call goes out, the variables are set, a snapshot is taken and then the ARI reply goes out.  Depending this could cause some discrepancy between an endpoint and an app for an amount of time.

By: Kinsey Moore (kmoore) 2014-01-10 12:11:44.622-0600

Unfortunately, I don't think it can be as simple as suggested in the issue description given that swagger defines arrays as the only container type. Using a custom Variable swagger model with an array container might yield something like the following:

{noformat}
    { "endpoint": "SIP/200", ..... "variables":  { { "key": "name1", "value": "value1" }, { "key": "name2", "value": "value2" } } }
{noformat}

Edit: I take it back; this would rely on the same body trick as was just removed.

By: Kinsey Moore (kmoore) 2014-01-13 11:19:37.372-0600

Added reviewboard link to issue.

By: Kinsey Moore (kmoore) 2014-01-13 12:37:46.861-0600

To clarify, the patch on reviewboard allows the format suggested by the issue creator without code duplication and without breaking the ARI API.

By: Matt DiMeo (mdimeo) 2014-01-29 16:04:32.506-0600

I just noticed Kevin Harwell's Dec 13 comment.  If the variables are being set after the originate, will that cause problems with variables not being correctly __ propagated to the far side of a local channel bridge?

-m@

By: Matt Jordan (mjordan) 2014-01-29 16:16:26.856-0600

Hm. There's at least a chance of that happening.

Luckily, it's an easy fix: {{ast_pbx_outgoing_app}}/{{ast_pbx_outgoing_exten}} have a parameter for variables specifically for this reason. We just have to pass the variable list into the function call; really, it should just be done that way regardless of whether or not it propagates to the Local channels. I'll go ahead and make that change.