Commit Graph

79 Commits

Author SHA1 Message Date
George Joseph dfb0efdcda api.wiki.mustache: Fix indentation in generated markdown
The '*' list indicator for default values and allowable values for
path, query and POST parameters need to be indented 4 spaces
instead of 2.

Should resolve issue 38 in the documentation repo.
2023-10-25 14:41:13 +00:00
George Joseph 1862a36c3b ari-stubs: Fix more local anchor references
Also allow CreateDocs job to be run manually with default branches.
2023-09-05 13:35:03 -06:00
George Joseph 8ce313c5b3 ari-stubs: Fix broken documentation anchors
All of the links that reference page anchors with capital letters in
the ids (#Something) have been changed to lower case to match the
anchors that are generated by mkdocs.
2023-09-05 09:51:19 -06:00
George Joseph 359f9434de rest-api: Updates for new documentation site
The new documentation site uses traditional markdown instead
of the Confluence flavored version.  This required changes in
the mustache templates and the python that generates the files.
2023-06-27 14:28:44 +00:00
George Joseph b910857e13 Update master branch for Asterisk 21
Change-Id: Ic9f616e8f67011b2c5ca2eae40dfa893644fa937
2022-07-20 04:56:42 -06:00
Alexander Traud 634e3ebdb8 res_ari: Fix for Doxygen.
ASTERISK-29756

Change-Id: I2f1c1eea1c902492b77b74de9950f20ebbb7e758
2021-11-18 16:25:51 -06:00
Alexander Traud 9ae084ff44 ari-stubs: Avoid 'is' as comparism with an literal.
Python 3.9.7 gave a syntax warning.

Change-Id: I3e3a982fe720726bc0015bcdb0e638a626ec89d4
2021-11-18 15:31:38 -06:00
Josh Soref ff11d74331 rest-api-templates: Spelling fixes
Correct typos of the following word families:

overwritten
descendants

ASTERISK-29714

Change-Id: I2307e35887a3437e50317a4b86f0893f25f9fd3b
2021-11-15 15:50:05 -06: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
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 Colp 360936ead5 res_ari_events: Add module reference when a WebSocket is open.
This change ensures that the module isn't unloaded when a
WebSocket is open. Previously it was possible to unload the
module manually or during shutdown which could cause a crash
when any active WebSockets were terminated.

ASTERISK-28585

Change-Id: I85c71ab112f99875b586419a34c08c8b34c14c5c
2019-10-24 05:26:57 -05:00
George Joseph 8d10028b98 Update master for Asterisk 18
Change-Id: I8b8ed97001446fab0c14d7c89391ee572fb29dd6
2019-07-29 10:04:48 -06:00
Kevin Harwell 574128dec6 rest-api-templates/asterisk_processor - replace http line breaks with line feed
Including line breaks (<br>, <br/>, <br />) in certain parts of the rest-api
json definition (e.g. summary, notes) displays them correctly in swagger.
However, when the field gets converted to the wiki format those breaks get
escaped and show up in the text as the actual string literal "<br>" etc...

This patch makes it so when converting to the wiki format it replaces all line
break values (<br>, etc...) with line feeds ('\n').

Change-Id: Ie1c9faa0d1c5d622804cc0a21ce769095b08aa3d
2019-02-25 17:31:57 -06:00
Walter Doekes bc8cdcefa8 optional_api: Remove unused nonoptreq fields
As they're not actively used, they only grow stale. The moduleinfo field itself
is kept in Asterisk 13/15 for ABI compatibility.

ASTERISK-28046 #close

Change-Id: I8df66a7007f807840414bb348511a8c14c05a9fc
2018-09-12 12:34:54 -05:00
Joshua Colp e01e636959 Update UPDATE.txt for 16 and update ARI stubs.
Copied UPGRADE.txt -> UPGRADE-16.txt
Created new UPGRADE.txt

Updated ARI stubs version to 17.

Change-Id: I4210e53f8022a2a68c7653595bdd13fbebac41ee
2018-07-18 19:23:02 +00:00
Corey Farrell 879e592baf Build System: Enable python3 compatibility.
* Consistently use spaces in rest-api-templates/asterisk_processor.py.
* Exclude third-party from docs/full-en_US.xml.
* Add docs/full-en_US.xml to .gitignore.
* Use list() to convert python3 view.
* Use python3 print function.
* Replace cmp() with equivalent equation.
* Replace reference to out of scope subtype variable with name
  parameter.
* Use unescaping triple bracket notation in mustache templates where
  needed.  This causes behavior of Python2 to be maintained when using
  Python3.
* Fix references to has_websocket / is_websocket in
  res_ari_resource.c.mustache.
* Update calculation of has_websocket to use any().
* Use unicode mode for writing output file in transform.py.
* Replace 'from swagger_model import *' with explicit import of required
  symbols.

I have not tested spandspflow2pcap.py or voicemailpwcheck.py, only the
print syntax has been fixed.

Change-Id: If5c5b556a2800d41a3e2cfef080ac2e151178c33
2018-04-09 10:07:38 -04:00
Jenkins2 a231e1d155 Merge "Remove redundant module checks and references." 2018-01-29 12:39:34 -06:00
Corey Farrell 527cf5a570 Remove redundant module checks and references.
This removes references that are no longer needed due to automatic
references created by module dependencies.

In addition this removes most calls to ast_module_check as they were
checking modules which are listed as dependencies.

Change-Id: I332a6e8383d4c72c8e89d988a184ab8320c4872e
2018-01-24 13:37:29 -05: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
Corey Farrell 9cfdb81e91 loader: Add dependency fields to module structures.
* Declare 'requires' and 'enhances' text fields on module info structure.
* Rename 'nonoptreq' to 'optional_modules'.
* Update doxygen comments.

Still need to investigate dependencies among modules I cannot compile.

Change-Id: I3ad9547a0a6442409ff4e352a6d897bef2cc04bf
2018-01-15 13:25:51 -05:00
Sean Bright fd0ca1c3f9 Remove as much trailing whitespace as possible.
Change-Id: I873c1c6d00f447269bd841494459efccdd2c19c0
2017-12-22 09:23:22 -05:00
George Joseph 063c9a935f Update make_ari_stubs in master to make the version 16
Ready for next major version

Change-Id: If9dc99b3b78768529e69a297d8f87e23582ca6d0
2017-07-21 10:41:20 -06:00
George Joseph 1ac0096512 res_ari: Add "module loaded" check to ari stubs
The recent change to make the use of LOAD_DECLINE more consistent
caused res_ari to unload itself before declining if the ari.conf
file wasn't found.  The ari stubs though still tried to use the
configuration resulting in segfaults.

This patch creates a new CHECK_ARI_MODULE_LOADED macro which tests
to see if res_ari is actually loaded and causes the stubs to also
decline if it isn't.  The macro was then added to the mustache
template's "load_module" function.

ASTERISK-27026 #close
Reported-by: Ronald Raikes

Change-Id: I263d56efa628ee3c411bdcd16d49af6260c6c91d
2017-06-15 19:34:03 -05:00
George Joseph 6db0939b96 modules: change module LOAD_FAILUREs to LOAD_DECLINES (14)
Change-Id: If99e3b4fc2d7e86fc3e61182aa6c835b407ed49e
2017-04-12 15:57:39 -06:00
George Joseph 747beb1ed1 modules: change module LOAD_FAILUREs to LOAD_DECLINES
In all non-pbx modules, AST_MODULE_LOAD_FAILURE has been changed
to AST_MODULE_LOAD_DECLINE.  This prevents asterisk from exiting
if a module can't be loaded.  If the user wishes to retain the
FAILURE behavior for a specific module, they can use the "require"
or "preload-require" keyword in modules.conf.

A new API was added to logger: ast_is_logger_initialized().  This
allows asterisk.c/check_init() to print to the error log once the
logger subsystem is ready instead of just to stdout.  If something
does fail before the logger is initialized, we now print to stderr
instead of stdout.

Change-Id: I5f4b50623d9b5a6cb7c5624a8c5c1274c13b2b25
2017-04-12 15:57:21 -06:00
George Joseph 6691606723 ari: Implement 'debug all' and request/response logging
The 'ari set debug' command has been enhanced to accept 'all' as an
application name.  This allows dumping of all apps even if an app
hasn't registered yet.  To accomplish this, a new global_debug global
variable was added to res/stasis/app.c and new APIs were added to
set and query the value.

'ari set debug' now displays requests and responses as well as events.
This required refactoring the existing debug code.

* The implementation for 'ari set debug' was moved from stasis/cli.{c,h}
  to ari/cli.{c,h}, and stasis/cli.{c,h} were deleted.
* In order to print the body of incoming requests even if a request
  failed, the consumption of the body was moved from the ari stubs
  to ast_ari_callback in res_ari.c and the moustache templates were
  then regenerated.  The body is now passed to ast_ari_invoke and then
  on to the handlers.  This results in code savings since that template
  was inserted multiple times into all the stubs.

An additional change was made to the ao2_str_container implementation
to add partial key searching and a sort function.  The existing cli
code assumed it was already there when it wasn't so the tab completion
was never working.

Change-Id: Ief936f747ce47f1fb14035fbe61152cf766406bf
(cherry picked from commit 1d890874f3)
2017-01-23 10:25:58 -07:00
Tzafrir Cohen bab253ac9f Fixes to various issues reported by pyflakes
Pyflake is a python (2) source checker. This patch fixes various
(mostly trivial) errors and warnings it reports.

Change-Id: Ia35c5ac61751b927814cf693994c632c412386ea
2016-12-21 11:02:20 +02:00
Corey Farrell a6e5bae3ef Remove ASTERISK_REGISTER_FILE.
ASTERISK_REGISTER_FILE no longer has any purpose so this commit removes
all traces of it.

Previously exported symbols removed:
* __ast_register_file
* __ast_unregister_file
* ast_complete_source_filename

This also removes the mtx_prof static variable that was declared when
MTX_PROFILE was enabled.  This variable was only used in lock.c so it
is now initialized in that file only.

ASTERISK-26480 #close

Change-Id: I1074af07d71f9e159c48ef36631aa432c86f9966
2016-10-27 09:53:55 -04:00
zuul 8932877044 Merge "rest-api: Swagger scripts were not replacing format variable in file brief" 2016-08-19 13:20:17 -05:00
Kevin Harwell 7ea133f2ab rest-api: Swagger scripts were not replacing format variable in file brief
Given resource paths did not have 'json' substituted in for the '{format}'. For
some auto generated documentation/comment strings it resulted in something like
the following:

"... REST handler for /api-docs/sounds.{format}"

This patch makes sure the resource api's path is properly substituted.

ASTERISK-25472 #close

Change-Id: Ie3e950a35db4043e284019d6c9061f3b03922e23
2016-08-18 17:02:24 -05:00
George Joseph a5c0cf4922 ari: Add documentation that path parameters are case-sensitive
Added to api.wiki.mustache so that the generated object pages
have the notation in the table header as well as under each method
that has path parameters.

ASTERISK-25492 #close

Change-Id: I36c46c6dc0c9ac350470394a999a1b19ef3fcdaf
2016-08-16 12:27:14 -05:00
Matt Jordan e773e3a9bb ARI: Add the ability to download the media associated with a stored recording
This patch adds a new feature to ARI that allows a client to download
the media associated with a stored recording. The new route is
/recordings/stored/{name}/file, and transmits the underlying binary file
using Asterisk's HTTP server's underlying file transfer facilities.

Because this REST route returns non-JSON, a few small enhancements had
to be made to the Python Swagger generation code, as well as the
mustache templates that generate the ARI bindings.

ASTERISK-26042 #close

Change-Id: I49ec5c4afdec30bb665d9c977ab423b5387e0181
2016-05-20 09:06:12 -05:00
Matt Jordan b425850f8b rest-api-templates: Wikify error code response reasons
Error response code descriptions may contain wiki markup that need to be
escaped. Without this patch, Confluence will reject the document being sent
and the responsible script will raise an exception.

Change-Id: I21fcb66fee7f6332381f2b99b1b0195dff215ee5
2015-10-20 22:41:55 -05:00
Corey Farrell b19860c03a res_ari_events: Fix memory leak in mustache template.
ASTERISK-25308 fixed a memory leak in res_ari_events.c, but
this file is regenerated by a template and the template was
not fixed.

Change-Id: Ied4c6deae89d21f87f9cf99676b1d055aa83b38b
2015-10-16 23:01:36 -04:00
Matt Jordan 5206aa9d30 ARI: Add events for Contact and Peer Status changes
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-21 08:21:58 -05:00
Richard Mudgett 03eb6cbc10 res_ari_events: Fix shutdown ref leak.
ASTERISK-25308 #close
Reported by: Joshua Colp

Change-Id: I592785bf70ff4b63d00e535b482f40da8e82a082
2015-08-18 16:44:06 -05:00
Ashley Sanders fe804b09b3 ARI: Channels added to Stasis application during WebSocket creation ...
Prior to ASTERISK-24988, the WebSocket handshake was resolved before Stasis
applications were registered. This was done such that the WebSocket would be
ready when an application is registered. However, by creating the WebSocket
first, the client had the ability to make requests for the Stasis application
it thought had been created with the initial handshake request. The inevitable
conclusion of this scenario was the cart being put before the horse.

ASTERISK-24988 resolved half of the problem by ensuring that the applications
were created and registered with Stasis prior to completing the handshake
with the client. While this meant that Stasis was ready when the client
received the green-light from Asterisk, it also meant that the WebSocket was
not yet ready for Stasis to dispatch messages.

This patch introduces a message queuing mechanism for delaying messages from
Stasis applications while the WebSocket is being constructed. When the ARI
event processor receives the message from the WebSocket that it is being
created, the event processor instantiates an event session which contains a
message queue. It then tries to create and register the requested applications
with Stasis. Messages that are dispatched from Stasis between this point and
the point at which the event processor is notified the WebSocket is ready, are
stashed in the queue. Once the WebSocket has been built, the queue's messages
are dispatched in the order in which they were originally received and the
queue is concurrently cleared.

ASTERISK-25181 #close
Reported By: Matt Jordan

Change-Id: Iafef7b85a2e0bf78c114db4c87ffc3d16d671a17
2015-07-31 11:28:10 -05:00
Matt Jordan 9cffcca5f9 res/ari: Register Stasis application on WebSocket attempt
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-22 11:13:34 -05:00
Rodrigo Ramírez Norambuena eec010829a AST_MODULE_INFO: Format corrections to the usages of AST_MODULE_INFO macro.
Change-Id: Icf88f9f861c6b2a16e5f626ff25795218a6f2723
2015-05-13 16:34:23 -05:00
Matt Jordan 7fe923d20b Merge "ARI: Fix missing dependencies." 2015-04-29 16:44:09 -05:00
Corey Farrell f226bd6f60 ARI: Fix missing dependencies.
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-29 07:46:44 -04:00
Corey Farrell 55a780d211 Git Conversion: Switch Non-C files to ASTERISK_REGISTER_FILE.
This switches files used to generate other sources to use the new
ASTERISK_REGISTER_FILE macro.

ASTERISK-25026 #close
Reported by: Corey Farrell

Change-Id: Ieb2537b83421cad07c8955e5f90c405ccf079740
2015-04-29 01:02:10 -04:00
Corey Farrell 62508d6891 Build System: Create Makefile macro MOD_ADD_SOURCE.
This new macro allows a single line to add all additional
sources to a module.  This helps prevent modules from
missing steps, and makes future changes easier since
they can be made in a single place.

ASTERISK-24960 #close
Reported by: Corey Farrell

Change-Id: I38f12d8b72c5e7bb37a879b2fb51761a2855eb4b
2015-04-14 12:53:03 -04:00
Matthew Jordan fb8a2e0399 ARI: Improve wiki documentation
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
........

Merged revisions 431145 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431148 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-27 17:21:03 +00:00
Kevin Harwell ca02121ef7 Investigate and fix memory leaks in Asterisk
Fixed memory leaks that were found in Asterisk.

ASTERISK-24693 #close
Reported by:  Kevin Harwell
Review: https://reviewboard.asterisk.org/r/4347/
........

Merged revisions 430999 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431010 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-23 15:21:56 +00:00
Matthew Jordan 86e927a714 make_ari_stubs: Update wiki prefix to '13'
........

Merged revisions 420538 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420539 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-08 12:40:16 +00:00
Matthew Jordan 1f35fccda1 res_ari_resource.c.mustache: Update template to emit module support level
........

Merged revisions 420536 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420537 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-08 12:38:18 +00:00
Sam Galarneau 5db3f38d5a api.wiki.mustache: Update wiki template to support body parameters
This patch updates the api.wiki.mustache template and the swagger_model python
script to understand if an operation has a body parameter. If an operation
does have a body parameter, it will now be displayed in the corresponding
wiki entry.
........

Merged revisions 407389 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417877 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-03 15:35:22 +00:00
Jonathan Rose a69e0cd32a ARI: Remove unnecessary \briefs from automatically generated documentation
Review: https://reviewboard.asterisk.org/r/3440/
........

Merged revisions 412653 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417770 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-02 21:13:46 +00:00
Kinsey Moore 1590d32ab0 ARI: Support channel variables in originate
This adds back in support for specifying channel variables during an
originate without compromising the ability to specify query parameters
in the JSON body. This was accomplished by generating the body-parsing
code in a separate function instead of being integrated with the URI
query parameter parsing code such that it could be called by paths with
body parameters. This is transparent to the user of the API and
prevents manual duplication of code or data structures.

(closes issue ASTERISK-23051)
Review: https://reviewboard.asterisk.org/r/3122/
Reported by: Matt Jordan
........

Merged revisions 406003 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406006 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-21 14:27:21 +00:00