Commit Graph

170 Commits

Author SHA1 Message Date
Naveen Albert d1fb397cfc general: Fix broken links.
This fixes a number of broken links throughout the
tree, mostly caused by wiki.asterisk.org being replaced
with docs.asterisk.org, which should eliminate the
need for sporadic fixes as in f28047db36.

Resolves: #430
2023-12-08 13:11:54 +00:00
Holger Hans Peter Freyther 69590ba33e ari: Provide the caller ID RDNIS for the channels
Provide the caller ID RDNIS when available. This will allow an
application to follow the redirect.
2023-11-07 14:27:15 +00:00
George Joseph c3c82441a2 Prepare master for Asterisk 22 2023-08-09 19:01:54 +00:00
Maximilian Fridrich 51a7b18038 core/ari/pjsip: Add refer mechanism
This change adds support for refers that are not session based. It
includes a refer implementation for the PJSIP technology which results
in out-of-dialog REFERs being sent to a PJSIP endpoint. These can be
triggered using the new ARI endpoint `/endpoints/refer`.

Resolves: #71

UserNote: There is a new ARI endpoint `/endpoints/refer` for referring
an endpoint to some URI or endpoint.
2023-08-09 15:10:46 +00:00
Joe Searle 8462154a03 res_stasis.c: Add new type 'sdp_label' for bridge creation.
Add new type 'sdp_label' when creating a bridge using the ARI. This will
add labels to the SDP for each stream, the label is set to the
corresponding channel id.

Resolves: #91

UserNote: When creating a bridge using the ARI the 'type' argument now
accepts a new value 'sdp_label' which will configure the bridge to add
labels for each stream in the SDP with the corresponding channel id.
2023-06-05 12:26:11 -06:00
Mike Bradeen 4095a382da chan_sip: Remove deprecated module.
ASTERISK-30297

Change-Id: Ic700168c80b68879d9cee8bb07afe2712fb17996
2023-01-03 09:00:42 -06:00
George Joseph b910857e13 Update master branch for Asterisk 21
Change-Id: Ic9f616e8f67011b2c5ca2eae40dfa893644fa937
2022-07-20 04:56:42 -06:00
Moritz Fain 4bf2473ac4 ari: expose channel driver's unique id to ARI channel resource
This change exposes the channel driver's unique id (i.e. the Call-ID
for chan_sip/chan_pjsip based channels) to ARI channel resources
as `protocol_id`.

ASTERISK-30027
Reported by: Moritz Fain
Tested by: Moritz Fain

Change-Id: I7cc6e7a9d29efe74bc27811d788dac20fe559b87
2022-05-22 15:40:33 -05:00
Ben Ford db7b025532 Update AMI and ARI versions for Asterisk 20.
Bumped AMI and ARI versions for the next major Asterisk version (20).

Change-Id: I2e65794f206d443178ab6895767fb53f04cc3e6a
2021-08-02 10:58:44 -05:00
Andre Barbosa a47308ccb2 res_stasis_playback: Send PlaybackFinish event only once for errors
When we try to play a list of sound files in the same Play command,
we get only one PlaybackFinish event, after all sounds are played.

But in the case where the Play fails (because channel is destroyed
for example), Asterisk will send one PlaybackFinish event for each
sound file still to be played. If the list is big, Asterisk is
sending many events.

This patch adds a failed state so we can understand that the play
failed. On that case we don't send the event, if we still have a
list of sounds to be played.

When we reach the last sound, we send the PlaybackFinish with
the failed state.

ASTERISK-29464 #close

Change-Id: I4c2e5921cc597702513af0d7c6c2c982e1798322
2021-06-24 10:43:19 -05:00
Sungtae Kim aae0904c7d res_stasis.c: Added video_single option for bridge creation
Currently, it was not possible to create bridge with video_mode single.
This made hard to put the bridge in a vidoe_single mode.
So, added video_single option for Bridge creation using the ARI.
This allows create a bridge with video_mode single.

ASTERISK-29055

Change-Id: I43e720e5c83fc75fafe10fe22808ae7f055da2ae
2020-09-10 09:53:27 -05:00
George Joseph 9c3b57822a Prepare master for the next Asterisk version
* Updated AMI version to 8.0.0
* Updated ARI version to 7.0.0
* Update make_ari_stubs.py to "Asterisk 19"

Change-Id: I51fb38c2e29f2db785f64a8bbd5565d56bea5af5
2020-07-21 07:37:23 -05:00
Joshua C. Colp 15cbff9d54 ari: Allow variables to be set on channel create.
This change adds the same variable functionality that
is available for originating a channel to the create
call. Now when creating a channel you can specify
dialplan variables to set instead of having to do another
API call.

ASTERISK-28896

Change-Id: If13997ba818136d7c070585504fc4164378aa992
2020-05-15 06:41:45 -05:00
Kevin Harwell a715cf5aaa message & stasis/messaging: make text message variables work in ARI
When a text message was received any associated variable was not written to
the ARI TextMessageReceived event. This occurred because Asterisk only wrote
out "send" variables. However, even those "send" variables would fail ARI
validation due to a TextMessageVariable formatting bug.

Since it seems the TextMessageReceived event has never been able to include
actual variables it was decided to remove the TextMessageVariable object type
from ARI, and simply return a JSON object of key/value pairs for variables.
This aligns more with how the ARI sendMessage handles variables, and other
places in ARI.

ASTERISK-28755 #close

Change-Id: Ia6051c01a53b30cf7edef84c27df4ed4479b8b6f
2020-03-02 12:12:11 -06:00
Friendly Automation 4255277ffd Merge "feat: AudioSocket channel, application, and ARI support." 2020-01-15 07:22:08 -06:00
Seán C McCord 163efbd724 feat: AudioSocket channel, application, and ARI support.
This commit adds support for
[AudioSocket](
https://wiki.asterisk.org/wiki/display/AST/AudioSocket),
a very simple bidirectional audio streaming protocol. There are both
channel and application interfaces.

A description of the protocol can be found on the above referenced
GitHub page.  A short talk about the reasons and implementation can be
found on [YouTube](https://www.youtube.com/watch?v=tjduXbZZEgI), from
CommCon 2019.

ARI support has also been added via the existing "externalMedia" ARI
functionality. The UUID is specified using the arbitrary "data" field.

ASTERISK-28484 #close

Change-Id: Ie866e6c4fa13178ec76f2a6971ad3590a3a588b5
2020-01-14 09:36:44 -06:00
Jean Aunis 034ac357ad ARI: Ability to inhibit COLP frames when adding channels to a bridge
This patch adds a new flag "inhibitConnectedLineUpdates" to the 'addChannel'
operation in the Bridges REST API. When set, this flag avoids generating COLP
frames when the specified channels enter the bridge.

ASTERISK-28629

Change-Id: Ib995d4f0c6106279aa448b34b042b68f0f2ca5dc
2020-01-02 15:06:15 +00:00
George Joseph d71d0f9489 ExternalMedia: Change return object from ExternalMedia to Channel
When we created the External Media addition to ARI we created an
ExternalMedia object to be returned from the channels/externalMedia
REST endpoint.  This object contained the channel object that was
created plus local_address and local_port attributes (which are
also in the Channel variables).  At the time, we thought that
creating an ExternalMedia object would give us more flexibility
in the future but as we created the sample speech to text
application, we discovered that it doesn't work so well with ARI
client libraries that a) don't have the ExternalMedia object
defined and/or b) can't promote the embedded channel structure
to a first-class Channel object.

This change causes the channels/externalMedia REST endpoint to
return a Channel object (like channels/create and channels/originate)
instead of the ExternalMedia object.

Change-Id: If280094debd35102cf21e0a31a5e0846fec14af9
2019-10-18 08:09:25 -05:00
George Joseph 2ae1a22e0e ARI: External Media
The Channel resource has a new sub-resource "externalMedia".
This allows an application to create a channel for the sole purpose
of exchanging media with an external server.  Once created, this
channel could be placed into a bridge with existing channels to
allow the external server to inject audio into the bridge or
receive audio from the bridge.
See https://wiki.asterisk.org/wiki/display/AST/External+Media+and+ARI
for more information.

Change-Id: I9618899198880b4c650354581b50c0401b58bc46
2019-09-10 10:44:16 -05:00
George Joseph 8d10028b98 Update master for Asterisk 18
Change-Id: I8b8ed97001446fab0c14d7c89391ee572fb29dd6
2019-07-29 10:04:48 -06:00
sungtae kim 613a335de5 res/ari/resource_channels.c: Added hangup reason code for channels
Currently, DELETE /ari/channels/<channelID> supports only few hangup reasons.
It's good enough for simple use, but when it needs to set the detail reason,
it comes challenges.
Added reason_code query parameter for that.

ASTERISK-28385

Change-Id: I1cf1d991ffd759d0591b347445a55f416ddc3ff2
2019-06-27 11:03:08 -05:00
George Joseph 2f13cdd315 Merge "res/res_ari: Added ARI resource /ari/channels/{channelId}/rtp_statistics" 2019-04-08 10:51:45 -05:00
Friendly Automation 6a83c99c36 Merge "main/json.c: Added app_name, app_data to channel type" 2019-04-08 10:32:16 -05:00
sungtae kim 76768ad6ce main/json.c: Added app_name, app_data to channel type
It was difficult to check the channel's current application and
parameters using ARI for current channels. Added app_name, app_data
items to show the current application information.

ASTERISK-28343

Change-Id: Ia48972b3850e5099deab0faeaaf51223a1f2f38c
2019-03-26 21:16:47 +01:00
sungtae kim 71c0c7f631 res/res_ari: Added ARI resource /ari/channels/{channelId}/rtp_statistics
Added ARI resource for channel statistics.
GET /ari/channels/{channelId}/rtp_statistics : It returns given
channel's rtp statistics detail.

ASTERISK-28320

Change-Id: I4343eec070438cec13f2a4f22e7fd9e574381376
2019-03-13 23:00:03 +01:00
sungtae kim e2eb19b363 res/res_ari: Added timestamp as a requirement for all ARI events
Changed to requirement to having timestamp for all of ARI events.
The below ARI events were changed to having timestamp.
PlaybackStarted, PlaybackContinuing, PlaybackFinished,
RecordingStarted, RecordingFinished, RecordingFailed,
ApplicationReplaced, ApplicationMoveFailed

ASTERISK-28326

Change-Id: I382c2fef58f5fe107e1074869a6d05310accb41f
2019-03-11 23:57:01 +01:00
George Joseph 5f6890a8f9 Merge "res_stasis: Add ability to switch applications." 2019-03-08 12:43:45 -06:00
Ben Ford 6626df586e res_stasis: Add ability to switch applications.
Added the ability to move between Stasis applications within Stasis.
This can be done by calling 'move' in an application, providing (at
minimum) the channel's id and the application to switch to. If the
application is not registered or active, nothing will happen and the
channel will remain in the current application, and an event will be
triggered to let the application know that the move failed. The event
name is "ApplicationMoveFailed", and provides the "destination" that the
channel was attempting to move to, as well as the usual channel
information. Optionally, a list of arguments can be passed to the
function call for the receiving application. A full example of a 'move'
call would look like this:

client.channels.move(channelId, app, appArgs)

The control object used to control the channel in Stasis can now switch
which application it belongs to, rather than belonging to one Stasis
application for its lifetime. This allows us to use the same control
object instead of having to tear down the current one and create
another.

ASTERISK-28267 #close

Change-Id: I43d12b10045a98a8d42541889b85695be26f288a
2019-03-07 07:53:01 -06:00
sungtae kim 3638c433ac bridging: Add creation timestamps
This small feature will help to checking the bridge's status to
figure out which bridge is in old/zombie or not. Also added
detail items for the 'bridge show *' cli to provide more detail
info. And added creation item to the ARI as well.

ASTERISK-28279

Change-Id: I460238c488eca4d216b9176576211cb03286e040
2019-03-03 05:25:22 -06:00
Kevin Harwell 8681fc9db7 ARI event type filtering
Event type filtering is now enabled, and configurable per application. An app is
now able to specify which events are sent to the application by configuring an
allowed and/or disallowed list(s). This can be done by issuing the following:

PUT /applications/{applicationName}/eventFilter

And then enumerating the allowed/disallowed event types as a body parameter.

ASTERISK-28106

Change-Id: I9671ba1fcdb3b6c830b553d4c5365aed5d588d5b
2019-02-20 09:56:22 -06:00
sungtae kim ac90968afd Added ARI resource /ari/asterisk/ping
Added ARI resource.
GET /ari/asterisk/ping : It returns "pong" message with timestamp
and asterisk id. It would be useful for simple heath check.

Change-Id: I8d24e1dcc96f60f73437c68d9463ed746f688b29
2019-01-30 12:51:03 +00:00
Sebastian Damm a24bb1c4b6 res/res_ari: Add additional hangup reasons
The ARI DELETE /channels command takes a "reason" parameter
Previously, there were only five reasons implemented
This patch adds more reasons to choose from for more
complex setups

ASTERISK-28198 #close

Change-Id: I85996f1076c9946d65c778413f040a845a90fecc
2018-12-11 11:20:44 +01:00
Joshua Colp e7a76ffee1 Update ARI version for master/16.
ARI goes from 3.0.0 to 4.0.0

Change-Id: I0649fa34926dc4fc89a166f1d2e3bbd965ef9ebe
2018-07-18 19:18:13 +00:00
Corey Farrell 679fa5fb34 Add missing OPTIONAL_API and ARI dependences.
I've audited all modules that include any header which includes
asterisk/optional_api.h.  All modules which use OPTIONAL_API now declare
those dependencies in AST_MODULE_INFO using requires or optional_modules
as appropriate.

In addition ARI dependency declarations have been reworked.  Instead of
declaring additional required modules in res/ari/resource_*.c we now add
them to an optional array "requiresModules" in api-docs for each module.
This allows the AST_MODULE_INFO dependencies to include those missing
modules.

Change-Id: Ia0c70571f5566784f63605e78e1ceccb4f79c606
2018-01-22 12:16:58 -05:00
Kevin Harwell b088cddc03 pjsip_options: wrongly applied "UNKNOWN" status
A couple of places were setting the status to "UNKNOWN" when qualifies were
being disabled. Instead this should be set to the "CREATED" status that
represents when a contact is given (uri available), but the qualify frequency
is set to zero so we don't know the status.

This patch updates the relevant places with "CREATED". It also updates the
"CREATED" status description (value shown in CLI/AMI/ARI output) to a value
of "NonQualified"/"NonQual" as this description is hopefully less confusing.

ASTERISK-27467

Change-Id: Id67509d25df92a72eb3683720ad2a95a27b50c89
2017-12-11 15:27:29 -06:00
Seán C McCord e8bde6916a ari/bridge: Add mute, dtmf suppression controls
Add bridge_features structure to bridge creation.  Specifically, this
implements mute and DTMF suppression, but others should be able to be
easily added to the same structure.

ASTERISK-27322 #close
Reported by: Darren Sessions
Sponsored by: AVOXI

Change-Id: Id4002adfb65c9a8027ee9e1a5f477e0f01cf9d61
2017-10-11 08:23:05 -04:00
Joshua Colp f21408c866 res_stasis: Add 'video_sfu' as a requested bridge type.
This change adds 'video_sfu' as a requested bridge type when
creating a bridge. By specifying this a mixing type bridge is
created that exchanges video in an SFU fashion.

Change-Id: I2ada47cf5f3fc176518b647c0b4aa39d55339606
2017-09-28 05:34:15 -05:00
George Joseph 3e8d628c0e Update AMI and ARI versions for master/15 and update UPDATE.txt
AMI goes from 3.2.0 to 4.0.0
ARI goes from 2.0.0 to 3.0.0

Copied UPGRADE.txt -> UPGRADE-15.txt
Created new UPGRADE.txt
Removed a log file that was accidentally checked in a while ago

Change-Id: I1c794f910038459b13e16f9c3a12c44e56f142f7
2017-07-20 10:05:48 -06:00
Mark Michelson 7a8d6bc81b Bump ARI version to 2.0.0
In order to not have version number overlap between different versions
of Asterisk, each new major version of Asterisk will mean we also bump
the ARI major version number.

This particular change does NOT introduce any known breaking changes to
ARI.

For discussion relating to this topice, see:
http://lists.digium.com/pipermail/asterisk-dev/2016-November/075964.html

Change-Id: I712ee0df177a8fe1252da2bc029705268b97b665
2016-11-18 10:56:31 -05:00
zuul d0474f6322 Merge "res/ari/resource_bridges: Add the ability to manipulate the video source" 2016-11-16 16:48:09 -06:00
Matt Jordan a72ef38113 res/ari/resource_bridges: Add the ability to manipulate the video source
In multi-party bridges, Asterisk currently supports two video modes:
 * Follow the talker, in which the speaker with the most energy is shown
   to all participants but the speaker, and the speaker sees the
   previous video source
 * Explicitly set video sources, in which all participants see a locked
   video source

Prior to this patch, ARI had no ability to manipulate the video source.
This isn't important for two-party bridges, in which Asterisk merely
relays the video between the participants. However, in a multi-party
bridge, it can be advantageous to allow an external application to
manipulate the video source.

This patch provides two new routes to accomplish this:
(1) setVideoSource: POST /bridges/{bridgeId}/videoSource/{channelId}
    Sets a video source to an explicit channel
(2) clearVideoSource: DELETE /bridges/{bridgeId}/videoSource
    Removes any explicit video source, and sets the video mode to talk
    detection

ASTERISK-26595 #close

Change-Id: I98e455d5bffc08ea5e8d6b84ccaf063c714e6621
2016-11-14 17:03:09 -05:00
Sebastien Duthil c6d755de11 res_ari: Add support for channel variables in ARI events.
This works the same as for AMI manager variables. Set
"channelvars=foo,bar" in your ari.conf general section, and then the
channel variables "foo" and "bar" (along with their values), will
appear in every Stasis websocket channel event.

ASTERISK-26492 #close
patches:
  ari_vars.diff submitted by Mark Michelson

Change-Id: I5609ba239259577c0948645df776d7f3bc864229
2016-11-14 13:51:56 -05:00
Mark Michelson 3bd76dd679 ARI: Add duplicate channel ID checking for channel creation.
This is similar to what is done for origination, but for the 14 and up
channel creation method. When attempting to create a channel, if a
channel ID is specified and a channel already exists with that ID, then
a 409 is returned.

Change-Id: I77f9253278c6947939c418073b6b31065489187c
2016-10-20 13:00:10 -05:00
Mark Michelson e459b8dadf ARI: Detect duplicate channel IDs
ARI and AMI allow for an explicit channel ID to be specified
when originating channels. Unfortunately, there is nothing in
place to prevent someone from using the same ID for multiple
channels. Further complicating things, adding ID validation to channel
allocation makes it impossible for ARI to discern why channel allocation
failed, resulting in a vague error code being returned.

The fix for this is to institute a new method for channel errors to be
discerned. The method mirrors errno, in that when an error occurs, the
caller can consult the channel errno value to determine what the error
was. This initial iteration of the feature only introduces "unknown" and
"channel ID exists" errors. However, it's possible to add more errors as
needed.

ARI uses this feature to determine why channel allocation failed and can
return a 409 error during origination to show that a channel with the
given ID already exists.

ASTERISK-26421

Change-Id: Ibba7ae68842dab6df0c2e9c45559208bc89d3d06
2016-10-20 12:59:06 -05:00
Matt Jordan dd5129d84a res/ari: Add the Asterisk EID field to outgoing events
This patch adds the Asterisk EID field to all outgoing ARI events.
Because this field should be added to all events as they are
transmitted, it is appended to the JSON message just prior to it being
handed off to the application message handler. This makes it somewhat
resilient to both new events being added to ARI, as well as other
potential event transport mechanisms.

ASTERISK-26470 #close

Change-Id: Ieff0ecc24464e83f3f44e9c3e7bd9a5d70b87a1d
2016-10-17 08:15:08 -05:00
Jean Aunis 91993ebaa5 resource_channels.c: add hangup reason "answered_elsewhere".
In ARI, the channels API allows to hangup a channel with a hangup reason.
This commit adds a new reason "answered_elsewhere".
When using a SIP channel, this will eventually allow Asterisk to add a proper
"Reason" header to a CANCEL message.

ASTERISK-26321

Change-Id: Ia97675bd4acd6a7f58eb467953dfb94559f6583d
2016-08-31 12:33:28 +02:00
Joshua Colp 9db420c69d ari: Update version.
New functionality has been added so the version has been
bumped to one over the 13 version.

Change-Id: I5d30077f62640c0ac83599b4e9a9b657bf184f69
2016-07-24 16:53:41 -05:00
zuul 39e6d80937 Merge "ARI: Ensure proper channel state on operations." 2016-06-09 21:50:07 -05:00
Mark Michelson 1fd3a7849e ARI: Ensure proper channel state on operations.
ARI was recently outfitted with operations to create and dial channels.
This leads to the ability to try funny stuff. You could create a channel
and then immediately try to play back media on it. You could create a
channel, dial it, and while it is ringing attempt to make it continue in
the dialplan.

This commit attempts to fix this by adding a channel state check to
operations that should not be able to operate on outbound channels that
have not yet answered. If a channel is in an invalid state, we will send
a 412 response.

ASTERISK-26047 #close
Reported by Mark Michelson

Change-Id: I2ca51bf9ef2b44a1dc5a73f2d2de35c62c37dfd8
2016-06-09 14:43:15 -05:00
George Joseph a2f820e8dc ari/resource_channels: Add 'formats' to channel create/originate
If you create a local channel and don't specify an originator channel
to take capabilities from, we automatically add all audio formats to
the new channel's capabilities. When we try to make the channel
compatible with another, the "best format" functions pick the best
format available, which in this case will be slin192.  While this is
great for preserving quality, it's the worst for performance and
overkill for the vast majority of applications.

In the absense of any other information, adding all formats is the
correct thing to do and it's not always possible to supply an
originator so a new parameter 'formats' has been added to the channel
create/originate functions. It's just a comma separated list of formats
to make availalble for the channel. Example: "ulaw,slin,slin16".
'formats' and 'originator' are mutually exclusive.

To facilitate determination of format names, the format name has been
added to "core show codecs".

ASTERISK-26070 #close

Change-Id: I091b23ecd41c1b4128d85028209772ee139f604b
2016-06-03 17:30:40 -05:00