summaryrefslogtreecommitdiff
path: root/res/ari
AgeCommit message (Collapse)Author
2016-08-02rest-api: Code out of sync with the modelKevin Harwell
Change-Id: Idccaa26fd4a423d47d013ee592b8fa6a0349c006
2016-06-20ARI: Ensure announcer channels are destroyed.Mark Michelson
Announcer channels were not being destroyed because the stasis_app_control structure that referenced them was not being destroyed. The control structure was not being destroyed because it was not being unlinked from its container. It was not being unlinked from its container because the after bridge callback for the announcer channel was not being run. The after bridge callback was not being run because the after bridge datastore was not being removed from the channel on destruction. The channel was not being destroyed because the hangup that used to destroy the channel was now only reducing the reference count to one. The reference count of the channel was only being reduced to one because the stasis_app_control structure was holding the final reference... The control structure used to not keep a reference to the channel, so that loop described above did not happen. The solution is to manually remove the control structure from its container when the playback on a bridge is complete. ASTERISK-26083 #close Reported by Joshua Colp Change-Id: I0ddc0f64484ea0016245800b409b567dfe85cfb4
2016-06-03ari/resource_channels: Add 'formats' to channel create/originateGeorge Joseph
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-05-14res_ari: Correct Location headers returned by some ARI resourcesSean Bright
The Location headers returned by: * /bridges/{bridgeId}/play * /bridges/{bridgeId}/record * /channels/{channelId}/play * /channels/{channelId}/record Did not have the '/ari' prefix, and in the case of the 'play' resources, were using 'playback' instead of 'playbacks.' Change-Id: I957c58a3a1471bf477dae7c67faa1b74fcd9241c
2016-03-31Merge "res_stasis: Add control ref to playback and recording structs." into 13zuul
2016-03-30res_ari: Cannot get control also means channel is unavailable.Richard Mudgett
The only caller of ari_bridges_play_found() has this note: If ari_bridges_play_found fails because the channel is unavailable for playback, The channel will be removed from the playback list soon. We can keep trying to get channels from the list until we either get one that will work or else there isn't a channel for this bridge anymore, in which case we'll revert to ari_bridges_play_new. Change-Id: Ib068141b367ccaa17be0dab4181c98e26c5127d6
2016-03-30res_stasis: Add control ref to playback and recording structs.Richard Mudgett
The stasis_app_playback and stasis_app_recording structs need to have a struct stasis_app_control ref. Other threads can get a reference to the playback and recording structs from their respective global container. These other threads can then use the control pointer they contain after the control struct has gone. * Add control ref to stasis_app_playback and stasis_app_recording structs. With the refs added, the control command queue can now have a circular control reference which will cause the control struct to never get released if the control's command queue is not flushed when the channel leaves the Stasis application. Also the command queue needs better protection from adding commands if the control->is_done flag is set. * Flush the control command queue on exit. ASTERISK-25882 #close Change-Id: I3cf1fb59cbe6f50f20d9e35a2c07ac07d7f4320d
2015-09-29res/ari/config.c: Fix user sort compare function.Richard Mudgett
Made use the ao2 sort compare template function and OBJ_SEARCH_xxx identifiers. Change-Id: Ic53005dc5aafa7a36c72300dd89b75fb63c92f4c
2015-09-29res/ari/config.c: Optimize conf_alloc() object init.Richard Mudgett
* Now conf_alloc() has more off nominal error checking. * Eliminated RAII_VAR() use in conf_alloc(). * Eliminated a dubius shortcut when destroying cfg->general in conf_destructor() that would cause a crash if cfg->general failed to get allocated. * Add some ACO registration section comments. Change-Id: Ia40c2b1b2d0777d641605118ae019c5a73865e1a
2015-09-29res/ari/config.c: Fix conf_alloc() object init.Richard Mudgett
Need to finish initializing the string fields in the ao2 object before putting any default strings into them. ASTERISK-25383 #close Reported by: yaron nahum Change-Id: I9f7f3a03f0c4991a01593abf8697b9a587c0ea84
2015-09-22ARI: Add events for Contact and Peer Status changesMatt Jordan
This patch adds support for receiving events regarding Peer status changes and Contact status changes. This is particularly useful in scenarios where we are subscribed to all endpoints and channels, where we often want to know more about the state of channel technology specific items than a single endpoint's state. ASTERISK-24870 Change-Id: I6137459cdc25ce27efc134ad58abf065653da4e9
2015-09-22ARI: Add the ability to subscribe to all eventsMatt Jordan
This patch adds the ability to subscribe to all events. There are two possible ways to accomplish this: (1) On initial WebSocket connection. This patch adds a new query parameter, 'subscribeAll'. If present and True, Asterisk will subscribe the applications to all ARI events. (2) Via the applications resource. When subscribing in this manner, an ARI client should merely specify a blank resource name, i.e., 'channels:' instead of 'channels:12354'. This will subscribe the application to all resources of the 'channels' type. ASTERISK-24870 #close Change-Id: I4a943b4db24442cf28bc64b24bfd541249790ad6
2015-08-19ari/ari_websockets.c: Fix ast_debug parameter type mismatch.Richard Mudgett
This is a type mismatch fix of the debugging commit c63316eec10e1990a88bf4712238d6deb375bfa9 made to find out why a testsuite test was failing only on one of the continuous integration build agents. Change-Id: Iba34f6e87cec331f6ac80e4daff6476ea6f00a75
2015-08-07ARI: Retrieve existing log channelsScott Emidy
An http request can be sent to get the existing Asterisk logs. The command "curl -v -u user:pass -X GET 'http://localhost:8088 /ari/asterisk/logging'" can be run in the terminal to access the newly implemented functionality. * Retrieve all existing log channels ASTERISK-25252 Change-Id: I7bb08b93e3b938c991f3f56cc5d188654768a808
2015-08-07ARI: Creating log channelsScott Emidy
An http request can be sent to create a log channel in Asterisk. The command "curl -v -u user:pass -X POST 'http://localhost:088/ari/asterisk/logging/mylog? configuration=notice,warning'" can be run in the terminal to access the newly implemented functionality for ARI. * Ability to create log channels using ARI ASTERISK-25252 Change-Id: I9a20e5c75716dfbb6b62fd3474faf55be20bd782
2015-08-06ARI: Deleting log channelsScott Emidy
An http request can be sent to delete a log channel in Asterisk. The command "curl -v -u user:pass -X DELETE 'http://localhost:8088 /ari/asterisk/logging/mylog'" can be run in the terminal to access the newly implemented functionally for ARI. * Able to delete log channels using ARI ASTERISK-25252 Change-Id: Id6eeb54ebcc511595f0418d586ff55914bc3aae6
2015-08-04res_http_websocket: Debug write lengths.Mark Michelson
Commit 39cc28f6ea2140ad6d561fd4c9e9a66f065cecee attempted to fix a test failure observed on 32 bit test agents by ensuring that a cast from a 32 bit unsigned integer to a 64 bit unsigned integer was happening in a predictable place. As it turns out, this did not cause test runs to succeed. This commit adds several redundant debug messages that print the payload lengths of websocket frames. The idea here is that this commit will not cause tests to succeed for the faulty test agent, but we might deduce where the fault lies more easily this way by observing at what point the expected value (537) changes to some ungangly huge number. If you are wondering why something like this is being committed to the branch, keep in mind that in commit 39cc28f6ea2140ad6d561fd4c9e9a66f065cecee I noted that the observed test failures only happen when automated tests are run. Attempts to run the tests by hand manually on the test agent result in the tests passing. Change-Id: I14a65c19d8af40dadcdbd52348de3b0016e1ae8d
2015-08-03res_http_websocket: Avoid passing strlen() to ast_websocket_write().Mark Michelson
We have seen a rash of test failures on a 32-bit build agent. Commit 48698a5e21d7307f61b5fb2bd39fd593bc1423ca solved an obvious problem where we were not encoding a 64-bit value correctly over the wire. This commit, however, did not solve the test failures. In the failing tests, ARI is attempting to send a 537 byte text frame over a websocket. When sending a frame this small, 16 bits are all that is required in order to encode the payload length on the websocket frame. However, ast_websocket_write() thinks that the payload length is greater than 65535 and therefore writes out a 64 bit payload length. Inspecting this payload length, the lower 32 bits are exactly what we would expect it to be, 537 in hex. The upper 32 bits, are junk values that are not expected to be there. In the failure, we are passing the result of strlen() to a function that expects a uint64_t parameter to be passed in. strlen() returns a size_t, which on this 32-bit machine is 32 bits wide. Normally, passing a 32-bit unsigned value to somewhere where a 64-bit unsigned value is expected would cause no problems. In fact, in manual runs of failing tests, this works just fine. However, ast_websocket_write() uses the Asterisk optional API, which means that rather than a simple function call, there are a series of macros that are used for its declaration and implementation. These macros may be causing some sort of error to occur when converting from a 32 bit quantity to a 64 bit quantity. This commit changes the logic by making existing ast_websocket_write() calls use ast_websocket_write_string() instead. Within ast_websocket_write_string(), the 64-bit converted strlen is saved in a local variable, and that variable is passed to ast_websocket_write() instead. Note that this commit message is full of speculation rather than certainty. This is because the observed test failures, while always present in automated test runs, never occur when tests are manually attempted on the same test agent. The idea behind this commit is to fix a theoretical issue by performing changes that should, at the least, cause no harm. If it turns out that this change does not fix the failing tests, then this commit should be reverted. Change-Id: I4458dd87d785ca322b89c152b223a540a3d23e67
2015-07-31ARI: Rotate log channels.Benjamin Ford
An http request can be sent to rotate a specified log channel. If the channel does not exist, an error response will be returned. The command "curl -v -u user:pass -X PUT 'http://localhost:8088 /ari/asterisk/logging/logChannelName/rotate'" can be run in the terminal to access this new functionality. * Added the ability to rotate log files through ARI ASTERISK-25252 Change-Id: Iaefa21cbbc1b29effb33004ee3d89c977e76ab01
2015-07-17Merge "ARI: Add support for push configuration of dynamic object" into 13Matt Jordan
2015-07-16ARI: Add support for push configuration of dynamic objectMatt Jordan
This patch adds support for push configuration of dynamic, i.e., sorcery, objects in Asterisk. It adds three new REST API calls to the 'asterisk' resource: * GET /asterisk/{configClass}/{objectType}/{id}: retrieve the current object given its ID. This returns back a list of ConfigTuples, which define the fields and their present values that make up the object. * PUT /asterisk/{configClass}/{objectType}/{id}: create or update an object. A body may be passed with the request that contains fields to populate in the object. The same format as what is retrieved using the GET operation is used for the body, save that we specify that the list of fields to update are contained in the "fields" attribute. * DELETE /asterisk/{configClass}/{objectType}/{id}: remove a dynamic object from its backing storage. Note that the success/failure of these operations is somewhat configuration dependent, i.e., you must be using a sorcery wizard that supports the operation in question. If a sorcery wizard does not support the create or delete mechanisms, then the REST API call will fail with a 403 forbidden. ASTERISK-25238 #close Change-Id: I28cd5c7bf6f67f8e9e437ff097f8fd171d30ff5c
2015-07-15Merge "ARI: Fixed unload mode for unload module." into 13Mark Michelson
2015-07-15ARI: Fixed unload mode for unload module.Benjamin Ford
Changed the unload mode to AST_FORCE_SOFT from AST_FORCE_FIRM, which would unload a module even if it was in use. * Changed unload mode to proper mode ASTERISK-25173 Change-Id: If2402487b5bce05d9770f25f65f5c8e292ad5533
2015-07-14ARI: Added new functionality to reload a single module.Benjamin Ford
An http request can be sent to reload an Asterisk module. If the module can not be reloaded or is not already loaded, an error response will be returned. The command "curl -v -u user:pass -X PUT 'http://localhost:8088 /ari/asterisk/modules/{moduleName}'" (or something similar, based on configuration) can be run in the terminal to access this new functionality. For more information, see: https://wiki.asterisk.org/wiki.display/~bford/Asterisk+ARI+Resource * Added new ARI functionality * Asterisk modules can be reloaded through http requests ASTERISK-25173 Change-Id: I289188bcae182b2083bdbd9ebfffd50b62f58ae1
2015-07-14ARI: Added new functionality to unload a single module.Benjamin Ford
An http request can be sent to unload an Asterisk module. If the module can not be unloaded or is already unloaded, an error response will be returned. The command "curl -v -u user:pass -X DELETE 'http://localhost:8088 /ari/asterisk/modules/{moduleName}'" (or something similar, depending on configuration) can be run in the terminal to access this new functionality. For more information, see: https://wiki.asterisk.org/wiki.display/~bford/Asterisk+ARI+Resource * Added new ARI functionality * Asterisk modules can be unloaded through http requests ASTERISK-25173 Change-Id: I535a95f5676deb02651522761ecbdc0b00b5ac57
2015-07-13ARI: Added new functionality to load a single module.Benjamin Ford
An http request can be sent to load an Asterisk module. If the module can not be loaded or is loaded already, an error response will be returned. The command curl -v -u user:pass -X POST 'http://localhost:8088/ari /asterisk/modules/{moduleName}'" (or something similar, depending on configuration) can be run in the terminal to access this new functionality. For more information, see: https://wiki.asterisk.org/wiki.display/~bford/Asterisk+ARI+Resource * Added new ARI functionality * Asterisk modules can be loaded through http requests ASTERISK-25173 Change-Id: I9e05d5b8c5c666ecfef341504f9edc1aa84fda33
2015-07-13ARI: Added new functionality to get information on a single module.Benjamin Ford
An http request can be sent to retrieve information on a single module, including the resource name, description, use count, status, and support level. The command "curl -v -u user:pass -X GET 'http://localhost:8088/ari /asterisk/modules/{moduleName}'" (or something similar, depending on configuration) can be run in the terminal to access this new functionality. For more information, see: https://wiki.asterisk.org/wiki.display/~bford/Asterisk+ARI+Resource * Added new ARI functionality * Information on a single module can now be retrieved ASTERISK-25173 Change-Id: Ibce5a94e70ecdf4e90329cf0ba66c33a62d37463
2015-07-10ARI: Added new functionality to get all module information.Benjamin Ford
An http request can be sent to retrieve a list of all existing modules, including the resource name, description, use count, status, and support level. The command "curl -v -u user:pass -X GET 'http://localhost:8088/ari/ asterisk/modules" (or something similar, depending on configuration) can be run in the terminal to access this new functionality. For more information, see: https://wiki.asterisk.org/wiki.display/~bford/Asterisk+ARI+Resource * Added new ARI functionality * Information on modules can now be retrieved Change-Id: I63cbbf0ec0c3544cc45ed2a588dceabe91c5e0b0
2015-05-22res/ari: Register Stasis application on WebSocket attemptMatt Jordan
Prior to this patch, when a WebSocket connection is made, ARI would not be informed of the connection until after the WebSocket layer had accepted the connection. This created a brief race condition where the ARI client would be notified that it was connected, a channel would be sent into the Stasis dialplan application, but ARI would not yet have registered the Stasis application presented in the HTTP request that established the WebSocket. This patch resolves this issue by doing the following: * When a WebSocket attempt is made, a callback is made into the ARI application layer, which verifies and registers the apps presented in the HTTP request. Because we do not yet have a WebSocket, we cannot have an event session for the corresponding applications. Some defensive checks were thus added to make the application objects tolerant to a NULL event session. * When a WebSocket connection is made, the registered application is updated with the newly created event session that wraps the WebSocket connection. ASTERISK-24988 #close Reported by: Joshua Colp Change-Id: Ia5dc60dc2b6bee76cd5aff0f69dd53b36e83f636
2015-05-05res_ari_bridges: Add missing dependencies.Corey Farrell
Missed this module in the previous commit. res_ari_bridges uses symbols from res_stasis_playback and res_stasis_recording. ASTERISK-25027 #close Reported by: Corey Farrell Change-Id: I90bf756abd25adfc4920d2869ebe7feb636b8c5f
2015-04-30res_ari_device_states: Fix dependency on res_stasis_device_state.Joshua Colp
The res_ari_device_states module depends on res_stasis_device_state, not res_stasis_device_states. Change-Id: I26e02ad37f9e36bcc859867e2fad1b90452ec3de
2015-04-29ARI: Fix missing dependencies.Corey Farrell
ARI modules that are generated by 'make ari-stubs' are all dependent on res_ari_model. Additionally some of the same modules depend on one or more res_stasis_* modules. ASTERISK-25027 #close Reported by: Corey Farrell Change-Id: I8e07fe7e81fedacb87232f2b6f8b5f47927b4153
2015-04-10res/ari: Fix model validation for ChannelHold eventMatthew Jordan
When the ChannelHold event was added, the 'musicclass' parameter was erroneously removed. This caused the ChannelHold events to be rejected as they failed model validation. This patch updates the Swagger schema such that it now properly reflects the event that is being created. Hooray for tests that catch things like this. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@434597 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-04-09clang compiler warnings: Fix autological comparisonsMatthew Jordan
This fixes autological comparison warnings in the following: * chan_skinny: letohl may return a signed or unsigned value, depending on the macro chosen * func_curl: Provide a specific cast to CURLoption to prevent mismatch * cel: Fix enum comparisons where the enum can never be negative * enum: Fix comparison of return result of dn_expand, which returns a signed int value * event: Fix enum comparisons where the enum can never be negative * indications: tone_data.freq1 and freq2 are unsigned, and hence can never be negative * presencestate: Use the actual enum value for INVALID state * security_events: Fix enum comparisons where the enum can never be negative * udptl: Don't bother to check if the return value from encode_length is less than 0, as it returns an unsigned int * translate: Since the parameters are unsigned int, don't bother checking to see if they are negative. The cast to unsigned int would already blow past the matrix bounds. * res_pjsip_exten_state: Use a temporary value to cache the return of ast_hint_presence_state * res_stasis_playback: Fix enum comparisons where the enum can never be negative * res_stasis_recording: Add an enum value for the case where the recording operation is in error; fix enum comparisons * resource_bridges: Use enum value as opposed to -1 * resource_channels: Use enum value as opposed to -1 Review: https://reviewboard.asterisk.org/r/4533 ASTERISK-24917 Reported by: dkdegroot patches: rb4533.patch submitted by dkdegroot (License 6600) ........ Merged revisions 434469 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@434470 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-04-07ARI: Add the ability to intercept hold and raise an eventMatthew Jordan
For some applications - such as SLA - a phone pressing hold should not behave in the fashion that the Asterisk core would like it to. Instead, the hold action has some application specific behaviour associated with it - such as disconnecting the channel that initiated the hold; only playing MoH to channels in the bridge if the channels are of a particular type, etc. One way of accomplishing this is to use a framehook to intercept the hold/unhold frames, raise an event, and eat the frame. Tasty. This patch accomplishes that using a new dialplan function, HOLD_INTERCEPT. In addition, some general cleanup of raising hold/unhold Stasis messages was done, including removing some RAII_VAR usage. Review: https://reviewboard.asterisk.org/r/4549/ ASTERISK-24922 #close git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@434216 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-27ARI: Fix crash if integer values used in JSON payload 'variables' object.Richard Mudgett
Sending the following ARI commands caused Asterisk to crash if the JSON body 'variables' object passes values of types other than strings. POST /ari/channels POST /ari/channels/{channelid} PUT /ari/endpoints/sendMessage PUT /ari/endpoints/{tech}/{resource}/sendMessage * Eliminated RAII_VAR usage in ast_ari_channels_originate_with_id(), ast_ari_channels_originate(), ast_ari_endpoints_send_message(), and ast_ari_endpoints_send_message_to_endpoint(). ASTERISK-24751 #close Reported by: jeffrey putnam Review: https://reviewboard.asterisk.org/r/4447/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@432404 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-24ARI/PJSIP: Apply requesting channel's format cap to created channelsMatthew Jordan
This patch addresses the following problems: * ari/resource_channels: In ARI, we currently create a format capability structure of SLIN and apply it to the new channel being created. This was originally done when the PBX core was used to create the channel, as there was a condition where a newly created channel could be created without any formats. Unfortunately, now that the Dial API is being used, this has two drawbacks: (a) SLIN, while it will ensure audio will flows, can cause a lot of needless transcodings to occur, particularly when a Local channel is created to the dialplan. When no format capabilities are available, the Dial API handles this better by handing all audio formats to the requsted channels. As such, we defer to that API to provide the format capabilities. (b) If a channel (requester) is causing this channel to be created, we currently don't use its format capabilities as we are passing in our own. However, the Dial API will use the requester channel's formats if none are passed into it, and the requester channel exists and has format capabilities. This is the "best" scenario, as it is the most likely to create a media path that minimizes transcoding. Fixing this simply entails removing the providing of the format capabilities structure to the Dial API. * chan_pjsip: Rather than blindly picking the first format in the format capability structure - which actually *can* be a video or text format - we select an audio format, and only pick the first format if that fails. That minimizes the weird scenario where we attempt to transcode between video/audio. * res_pjsip_sdp_rtp: Applied the joint capapbilites to the format structure. Since ast_request already limits us down to one format capability once the format capabilities are passed along, there's no reason to squelch it here. * channel: Fixed a comment. The reason we have to minimize our requested format capabilities down to a single format is due to Asterisk's inability to convey the format to be used back "up" a channel chain. Consider the following: PJSIP/A => L;1 <=> L;2 => PJSIP/B g,u,a g,u,a g,u,a u That is, we have PJSIP/A dialing a Local channel, where the Local;2 dials PJSIP/B. PJSIP/A has native format capabilities g722,ulaw,alaw; the Local channel has inherited those format capabilities down the line; PJSIP/B supports only ulaw. According to these format capabilities, ulaw is acceptable and should be selected across all the channels, and no transcoding should occur. However, there is no way to convey this: when L;2 and PJSIP/B are put into a bridge, we will select ulaw, but that is not conveyed to PJSIP/A and L;1. Thus, we end up with: PJSIP/A <=> L;1 <=> L;2 <=> PJSIP/B g g X u u Which causes g722 to be written to PJSIP/B. Even if we can convey the 'ulaw' choice back up the chain (which through some severe hacking in Local channels was accomplished), such that the chain looks like: PJSIP/A <=> L;1 <=> L;2 <=> PJSIP/B u u u u We have no way to tell PJSIP/A's *channel driver* to Answer in the SDP back with only 'ulaw'. This results in all the channel structures being set up correctly, but PJSIP/A *still* sending g722 and causing the chain to fall apart. There's a lot of difficulty just in setting this up, as there are numerous race conditions in the act of bridging, and no clean mechanism to pass the selected format backwards down an established channel chain. As such, the best that can be done at this point in time is clarifying the comment. Review: https://reviewboard.asterisk.org/r/4434/ ASTERISK-24812 #close Reported by: Matt Jordan git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@432195 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-21res_ari_channels: Return a 404 response when a requested channel variable ↵Joshua Colp
does not exist. This change makes it so that if a channel variable is requested and it does not exist a 404 response will be returned instead of an allocation failed response. This makes it easier to debug and figure out what is going on for a user. ASTERISK-24677 #close Reported by: Joshua Colp git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@432154 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-12ARI/PJSIP: Add the ability to redirect (transfer) a channel in a Stasis appMatthew Jordan
This patch adds a new feature to ARI to redirect a channel to another server, and fixes a few bugs in PJSIP's handling of the Transfer dialplan application/ARI redirect capability. *New Feature* A new operation has been added to the ARI channels resource, redirect. With this, a channel in a Stasis application can be redirected to another endpoint of the same underlying channel technology. *Bug fixes* In the process of writing this new feature, two bugs were fixed in the PJSIP stack: (1) The existing .transfer channel callback had the limitation that it could only transfer channels to a SIP URI, i.e., you had to pass 'PJSIP/sip:foo@my_provider.com' to the dialplan application. While this is still supported, it is somewhat unintuitive - particularly in a world full of endpoints. As such, we now also support specifying the PJSIP endpoint to transfer to. (2) res_pjsip_multihomed was, unfortunately, trying to 'help' a 302 redirect by updating its Contact header. Alas, that resulted in the forwarding destination set by the dialplan application/ARI resource/whatever being rewritten with very incorrect information. Hence, we now don't bother updating an outgoing response if it is a 302. Since this took a looong time to find, some additional debug statements have been added to those modules that update the Contact headers. Review: https://reviewboard.asterisk.org/r/4316/ ASTERISK-24015 #close Reported by: Private Name ASTERISK-24703 #close Reported by: Matt Jordan git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@431717 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-11ari_websockets: removed extra check on websocket session readKevin Harwell
When merging the websocket timeout issue (ASTERISK-24701) an extra, almost duplicate, check was left in the code that should not have been. This removes it. ASTERISK-24701 #close Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/4412/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@431693 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-11res_http_websocket: websocket write timeout fails to fully disconnectKevin Harwell
When writing to a websocket if a timeout occurred the underlying socket did not get closed/disconnected. This patch makes sure the websocket gets disconnected on a write timeout. Also a notice is logged stating that the websocket was disconnected. ASTERISK-24701 #close Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/4412/ ........ Merged revisions 431669 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@431670 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-09res/ari/resource_channels: Add missing 'no_answer' reason to DELETE /channelsMatthew Jordan
One of the canonical reasons for hanging up a channel is because the far end failed to answer - or because someone else answered, and we want to get rid of this channel. This patch adds the missing value to the 'reason' query parameter for the DELETE /channels operation. Review: https://reviewboard.asterisk.org/r/4400 ASTERISK-24745 #close Reported by: Ben Merrills patches: add_no_answer_ari_hangup_cause.diff uploaded by Ben Merrills (License 6678) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@431622 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-27ARI: Improve wiki documentationMatthew Jordan
This patch improves the documentation of ARI on the wiki. Specifically, it addresses the following: * Allowed values and allowed ranges weren't documented. This was particularly frustrating, as Asterisk would reject query parameters with disallowed values - but we didn't tell anyone what the allowed values were. * The /play/id operation on /channels and /bridges failed to document all of the added media resource types. * Documentation for creating a channel into a Stasis application failed to note when it occurred, and that creating a channel into Stasis conflicts with creating a channel into the dialplan. * Some other minor tweaks in the mustache templates, including italicizing the parameter type, putting the default value on its own sub-bullet, and some other nicities. Review: https://reviewboard.asterisk.org/r/4351 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@431145 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-20ARI: Fixed crash that occurred when updating a bridge when the optional ↵Ashley Sanders
query parameter 'name' was not supplied. Prior to this changeset, posting to the: /ari/bridges/{bridgeId} endpoint without specifying a value for the [name] query parameter, would crash Asterisk if the bridge you are attempting to create (or update) had the same ID as an existing bridge. The internal mechanism of the POST operation interpreted a null value for name, thus resulting in an error condition that crashed Asterisk. ASTERISK-24560 #close Reported By: Kinsey Moore Review: https://reviewboard.asterisk.org/r/4349/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@430818 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-07Add the ability to continue and originate using priority labels.Mark Michelson
With this patch, the following two ARI commands POST /channels POST /channels/{id}/continue Accept a new parameter, label, that can be used to continue to or originate to a priority label in the dialplan. Because this is adding a new parameter to ARI commands, the API version of ARI has been bumped from 1.6.0 to 1.7.0. This patch comes courtesy of Nir Simionovich from Greenfield Tech. Thanks! ASTERISK-24412 #close Reported by Nir Simionovich Review: https://reviewboard.asterisk.org/r/4285 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@430337 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-12-09ARI/AMI: Include language in standard channel snapshot outputKevin Harwell
The channel "language" was already part of a channel snapshot, however is was not sent out over AMI or ARI. This patch makes it so the channel "language" is included in the appropriate AMI or ARI events. ASTERISK-24553 #close Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/4245/ ........ Merged revisions 429204 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@429206 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-12-09ari: Add support for specifying an originator channel when originating.Joshua Colp
If an originator channel is specified when originating a channel the linked ID of it will be applied to the newly originated outgoing channel. This allows an association to be made between the two so it is known that the originator has dialed the originated channel. ASTERISK-24552 #close Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/4243/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@429153 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-12-08Add new AMI and ARI events for connected line changes on a channel.Mark Michelson
The AMI event is called NewConnectedLine and the ARI event is called ChannelConnectedLine. ASTERISK-24554 #close Reported by Matt Jordan Review: https://reviewboard.asterisk.org/r/4231 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@429064 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-20Stasis: Add information to blind transfer eventKinsey Moore
When a blind transfer occurs that is forced to create a local channel pair to satisfy the transfer request, information about the local channel pair is not published. This adds a field to describe that channel to the blind transfer message struct so that this information is conveyed properly to consumers of the blind transfer message. This also fixes a bug in which Stasis() was unable to properly identify the channel that was replacing an existing Stasis-controlled channel due to a blind transfer. Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/3921/ ........ Merged revisions 421537 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@421538 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-18res/ari/resource_channels: Fix compilation issueMatthew Jordan
Forgot a parameter. Whoops. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@421312 65c4cc65-6c06-0410-ace0-fbb531ad65f3