Skip to content

ARI: Added paths to get and set multiple channel variables.#1869

Open
bkford wants to merge 1 commit intoasterisk:masterfrom
bkford:ari-multiple-get-set
Open

ARI: Added paths to get and set multiple channel variables.#1869
bkford wants to merge 1 commit intoasterisk:masterfrom
bkford:ari-multiple-get-set

Conversation

@bkford
Copy link
Copy Markdown
Contributor

@bkford bkford commented Apr 15, 2026

Two new paths exist for ARI to get and set multiple channel variables at
the same time. This is done via GET and POST like the single get and set
variable equivalents. Leading and trailing whitespace will be stripped
from the variable names for both paths. When setting variables, the
values will be read as-is, whitespace included. GET takes in a single
string with comma-separated values, while POST takes in a dictionary of
key value pairs. The code follows the same paths as when setting
multiple variables when originating a channel via ARI.

UserNote: Added new ARI paths for getting and setting multiple channel
variables at a time. For GET, this takes in a single string of
comma-separated variable names, while POST takes in a dictionary of key
value pairs. The behavior is the same as passing in variables when
originating a channel.

@bkford
Copy link
Copy Markdown
Contributor Author

bkford commented Apr 15, 2026

cherry-pick-to: 23
cherry-pick-to: 22
cherry-pick-to: 20

@github-actions
Copy link
Copy Markdown

Workflow Check completed successfully

@github-actions
Copy link
Copy Markdown

Workflow Check completed successfully

Comment thread rest-api/api-docs/channels.json
@gtjoseph
Copy link
Copy Markdown
Member

In the commit message, I don't understand what the following means...

You can also use getChannelVars and setChannelVars in your applications.

@bkford
Copy link
Copy Markdown
Contributor Author

bkford commented Apr 17, 2026

NOTE
One concern I have is the locking, so extra eyes on that would be greatly appreciated. The main concerns are:

  1. When setting multiple variables, ast_set_variables is called and locks the channel. It eventually gets to pbx_builtin_setvar_helper, which ALSO locks the channel. Originating a channel also does this.
  2. When setting a single variable (the original, existing path), it calls a different function: stasis_app_control_set_channel_var. This does NOT lock the channel before calling, but it ALSO eventually gets to pbx_builtin_setvar_helper.
  3. In the original, existing get variable function, it makes a note of not locking when reading from the channel due to potential locking issues, especially with autoservice dialplan functions. It may not have anything to do with a write, but it's a concern I had.

@github-actions
Copy link
Copy Markdown

Workflow Check completed successfully

Comment thread rest-api/api-docs/channels.json Outdated
Comment thread res/ari/resource_channels.c Outdated
@github-actions
Copy link
Copy Markdown

Workflow Check completed successfully

@bkford bkford requested a review from gtjoseph April 20, 2026 14:47
Comment thread res/ari/resource_channels.c Outdated
Comment thread res/ari/resource_channels.c Outdated
Comment thread res/ari/resource_channels.c Outdated
@github-actions
Copy link
Copy Markdown

Workflow Check completed successfully

Copy link
Copy Markdown
Member

@gtjoseph gtjoseph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM pending the addition of the testsuite test.
When that's ready, don't forget to update this PR with a testsuite-test-pr: nnnn comment so the two PRs can be tested together.

Comment thread rest-api/api-docs/channels.json Outdated
Comment thread rest-api/api-docs/channels.json Outdated
Two new paths exist for ARI to get and set multiple channel variables at
the same time. This is done via GET and POST like the single get and set
variable equivalents. Leading and trailing whitespace will be stripped
from the variable names for both paths. When setting variables, the
values will be read as-is, whitespace included. GET takes in a single
string with comma-separated values, while POST takes in a dictionary of
key value pairs. The code follows the same paths as when setting
multiple variables when originating a channel via ARI.

UserNote: Added new ARI paths for getting and setting multiple channel
variables at a time. For GET, this takes in a single string of
comma-separated variable names, while POST takes in a dictionary of key
value pairs. The behavior is the same as passing in variables when
originating a channel.
@bkford
Copy link
Copy Markdown
Contributor Author

bkford commented Apr 22, 2026

testsuite-test-pr: 131

@github-actions
Copy link
Copy Markdown

Workflow Check completed successfully

@github-actions
Copy link
Copy Markdown

Workflow Check failed
master-app_dial: FAILED TEST: apps/queues/transfer/caller_attended
master-ari2: FAILED TEST: rest_api/channels/channel_variables/get_set_multiple

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants