{"id":13401995,"url":"https://github.com/asterisk/node-ari-client","last_synced_at":"2025-05-16T12:10:04.344Z","repository":{"id":57183646,"uuid":"20269082","full_name":"asterisk/node-ari-client","owner":"asterisk","description":"Node.js client for ARI. This library is best effort with limited support.","archived":false,"fork":false,"pushed_at":"2024-06-03T15:36:19.000Z","size":436,"stargazers_count":253,"open_issues_count":40,"forks_count":99,"subscribers_count":35,"default_branch":"master","last_synced_at":"2024-10-01T18:37:59.142Z","etag":null,"topics":["ari","asterisk","javascript","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/asterisk.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-05-28T19:06:28.000Z","updated_at":"2024-09-30T17:09:35.000Z","dependencies_parsed_at":"2024-01-16T10:08:02.203Z","dependency_job_id":"b3f3dc02-2cd9-4f1c-add4-08ff5798c753","html_url":"https://github.com/asterisk/node-ari-client","commit_stats":{"total_commits":96,"total_committers":17,"mean_commits":5.647058823529412,"dds":0.6354166666666667,"last_synced_commit":"c2e516a75023ded19c8e2bf328d14ff36d005a86"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asterisk%2Fnode-ari-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asterisk%2Fnode-ari-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asterisk%2Fnode-ari-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asterisk%2Fnode-ari-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asterisk","download_url":"https://codeload.github.com/asterisk/node-ari-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247994119,"owners_count":21030050,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ari","asterisk","javascript","nodejs"],"created_at":"2024-07-30T19:01:10.244Z","updated_at":"2025-04-09T07:05:04.342Z","avatar_url":"https://github.com/asterisk.png","language":"JavaScript","readme":"[![build status][build_image]][build]\n\n# node-ari-client\n\nThis module contains the Node.js client library for the Asterisk REST Interface.\nIt builds upon the swagger-js library, providing an improved, Asterisk-specific\nAPI over the API generated by swagger-js.\n\n# Usage\n\n## Installation\n\n```bash\n$ npm install ari-client\n```\n\n## API\n\nThe client exposes a connect function that can be used to connect to an instance\nof ARI and to configure a client with all available resources and operations.\n\nCallbacks:\n\n```javascript\nvar client = require('ari-client');\nclient.connect(url, username, password, function (err, ari) {})\n```\n\nPromises:\n\n```javascript\nvar client = require('ari-client');\nclient.connect(url, username, password)\n  .then(function (ari) {})\n  .catch(function (err) {});\n```\n\nUpon connecting, a callback will be called passing a reference to a client with\nall available resources attached.\n\n```\nari.bridges, ari.channels, ari.endpoints...\n```\n\nThose properties expose operations that can be performed for that given resource.\n\nCallbacks:\n\n```javascript\nari.bridges.list(function (err, bridges) {});\nari.bridges.get({bridgeId: 'uniqueid'}, function (err, bridge) {});\n```\n\nPromises:\n\n```javascript\nari.bridges.list()\n  .then(function (bridges) {})\n  .catch(function (err) {});\n\nari.bridges.get({bridgeId: 'uniqueid'})\n  .then(function (bridge) {})\n  .catch(function (err) {});\n```\n\nOperations that return a resource or a list of resources expose the same operations tied to that given instance.\n\n```javascript\nbridge.addChannel({channel: 'uniqueid'});\n```\n\nNote that the bridge id was not required since the operation was called from a resource instance. The above operation is equivalent to the following:\n\n```javascript\nari.bridges.addChannel({bridgeId: 'uniqueid', channel: 'uniqueid'});\n```\n\nThe client also exposes functions to create new resources.\n\n```\nari.Bridge(), ari.Channel(), ari.Playback(), ari.LiveRecording()\n```\n\nThe instance returned by these functions can then be used to call a create operations in ARI.\n\nCallbacks:\n\n```javascript\nvar bridge = ari.Bridge();\nbridge.create(function (err, bridge) {});\n```\n\nPromises:\n\n```javascript\nvar bridge = ari.Bridge();\nbridge.create()\n  .then(function (bridge) {})\n  .catch(function (err) {});\n```\n\nNote that the create operation returns an updated copy of the bridge after creation.\n\nUsing this method of resource creation, it is possible to register event listeners for a resource before it is created in ARI.\n\nCallbacks:\n\n```javascript\nvar channel = ari.Channel();\nchannel.on('StasisStart', function (event, channel) {});\nchannel.on('ChannelDtmfReceived', function (event, channel) {});\nchannel.originate(\n    {endpoint: 'PJSIP/1000', app: 'application', appArgs: 'dialed'},\n    function (err, channel) {}\n);\n```\n\nPromises:\n\n```javascript\nvar channel = ari.Channel();\nchannel.on('StasisStart', function (event, channel) {});\nchannel.on('ChannelDtmfReceived', function (event, channel) {});\nchannel.originate({endpoint: 'PJSIP/1000', app: 'application', appArgs: 'dialed'})\n  .then(function (channel) {})\n  .catch(function (err) {});\n```\n\nSome create operations require an instance be passed in for this to work.\n\nCallbacks:\n\n```javascript\nvar playback = ari.Playback();\nchannel.play({media: 'sound:hello-world'}, playback, function (err, playback) {});\n```\n\nPromises:\n\n```javascript\nvar playback = ari.Playback();\nchannel.play({media: 'sound:hello-world'}, playback)\n  .then(function (playback) {})\n  .catch(function (err) {});\n```\n\nIf you are using the client directly to call a create operation instead of using an instance, you will have to pass the appropriate ids as part of the options to the create operation.\n\nCallbacks:\n\n```javascript\nvar playback = ari.Playback();\nari.channels.play({\n  media: 'sound:hello-world',\n  channelId: channel.id,\n  playbackId: playback.id\n}, function (err, playback) {});\n```\n\nPromises:\n\n```javascript\nvar playback = ari.Playback();\nari.channels.play({\n  media: 'sound:hello-world',\n  channelId: channel.id,\n  playbackId: playback.id\n}).then(function (playback) {}).catch(function (err) {});\n```\n\n### Operations\n\nThe following operations are defined:\n\n#### applications\n\n##### filter\n\nFilter application events types.\n\nCallbacks:\n\n```javascript\nari.applications.filter(\n  {applicationName: val},\n  function (err, application) {}\n);\n```\n\nPromises:\n\n```javascript\nari.applications.filter({\n    applicationName: val\n})\n  .then(function (application) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- applicationName (string) - Application's name\n- filter (object) - Specify which event types to allow/disallow\n\n##### get\n\nGet details of an application.\n\nCallbacks:\n\n```javascript\nari.applications.get(\n  {applicationName: val},\n  function (err, application) {}\n);\n```\n\nPromises:\n\n```javascript\nari.applications.get({\n    applicationName: val\n})\n  .then(function (application) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- applicationName (string) - Application's name\n\n##### list\n\nList all applications.\n\nCallbacks:\n\n```javascript\nari.applications.list(\n  function (err, applications) {}\n);\n```\n\nPromises:\n\n```javascript\nari.applications.list()\n  .then(function (applications) {})\n  .catch(function (err) {});\n```\n##### subscribe\n\nSubscribe an application to a event source.\n\nCallbacks:\n\n```javascript\nari.applications.subscribe(\n  {applicationName: val, eventSource: val},\n  function (err, application) {}\n);\n```\n\nPromises:\n\n```javascript\nari.applications.subscribe({\n    applicationName: val,\n    eventSource: val\n})\n  .then(function (application) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- applicationName (string) - Application's name\n- eventSource (string) - URI for event source (channel:{channelId}, bridge:{bridgeId}, endpoint:{tech}[/{resource}], deviceState:{deviceName}\n\n##### unsubscribe\n\nUnsubscribe an application from an event source.\n\nCallbacks:\n\n```javascript\nari.applications.unsubscribe(\n  {applicationName: val, eventSource: val},\n  function (err, application) {}\n);\n```\n\nPromises:\n\n```javascript\nari.applications.unsubscribe({\n    applicationName: val,\n    eventSource: val\n})\n  .then(function (application) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- applicationName (string) - Application's name\n- eventSource (string) - URI for event source (channel:{channelId}, bridge:{bridgeId}, endpoint:{tech}[/{resource}], deviceState:{deviceName}\n\n#### asterisk\n\n##### addLog\n\nAdds a log channel.\n\nCallbacks:\n\n```javascript\nari.asterisk.addLog(\n  {configuration: val, logChannelName: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.asterisk.addLog({\n    configuration: val,\n    logChannelName: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- configuration (string) - levels of the log channel\n- logChannelName (string) - The log channel to add\n\n##### deleteLog\n\nDeletes a log channel.\n\nCallbacks:\n\n```javascript\nari.asterisk.deleteLog(\n  {logChannelName: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.asterisk.deleteLog({\n    logChannelName: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- logChannelName (string) - Log channels name\n\n##### deleteObject\n\nDelete a dynamic configuration object.\n\nCallbacks:\n\n```javascript\nari.asterisk.deleteObject(\n  {configClass: val, id: val, objectType: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.asterisk.deleteObject({\n    configClass: val,\n    id: val,\n    objectType: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- configClass (string) - The configuration class containing dynamic configuration objects.\n- id (string) - The unique identifier of the object to delete.\n- objectType (string) - The type of configuration object to delete.\n\n##### getGlobalVar\n\nGet the value of a global variable.\n\nCallbacks:\n\n```javascript\nari.asterisk.getGlobalVar(\n  {variable: val},\n  function (err, variable) {}\n);\n```\n\nPromises:\n\n```javascript\nari.asterisk.getGlobalVar({\n    variable: val\n})\n  .then(function (variable) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- variable (string) - The variable to get\n\n##### getInfo\n\nGets Asterisk system information.\n\nCallbacks:\n\n```javascript\nari.asterisk.getInfo(\n  function (err, asteriskinfo) {}\n);\n```\n\nPromises:\n\n```javascript\nari.asterisk.getInfo()\n  .then(function (asteriskinfo) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- only (string) - Filter information returned\n\n##### getModule\n\nGet Asterisk module information.\n\nCallbacks:\n\n```javascript\nari.asterisk.getModule(\n  {moduleName: val},\n  function (err, module) {}\n);\n```\n\nPromises:\n\n```javascript\nari.asterisk.getModule({\n    moduleName: val\n})\n  .then(function (module) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- moduleName (string) - Module's name\n\n##### getObject\n\nRetrieve a dynamic configuration object.\n\nCallbacks:\n\n```javascript\nari.asterisk.getObject(\n  {configClass: val, id: val, objectType: val},\n  function (err, configtuples) {}\n);\n```\n\nPromises:\n\n```javascript\nari.asterisk.getObject({\n    configClass: val,\n    id: val,\n    objectType: val\n})\n  .then(function (configtuples) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- configClass (string) - The configuration class containing dynamic configuration objects.\n- id (string) - The unique identifier of the object to retrieve.\n- objectType (string) - The type of configuration object to retrieve.\n\n##### listLogChannels\n\nGets Asterisk log channel information.\n\nCallbacks:\n\n```javascript\nari.asterisk.listLogChannels(\n  function (err, logchannels) {}\n);\n```\n\nPromises:\n\n```javascript\nari.asterisk.listLogChannels()\n  .then(function (logchannels) {})\n  .catch(function (err) {});\n```\n##### listModules\n\nList Asterisk modules.\n\nCallbacks:\n\n```javascript\nari.asterisk.listModules(\n  function (err, modules) {}\n);\n```\n\nPromises:\n\n```javascript\nari.asterisk.listModules()\n  .then(function (modules) {})\n  .catch(function (err) {});\n```\n##### loadModule\n\nLoad an Asterisk module.\n\nCallbacks:\n\n```javascript\nari.asterisk.loadModule(\n  {moduleName: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.asterisk.loadModule({\n    moduleName: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- moduleName (string) - Module's name\n\n##### ping\n\nResponse pong message.\n\nCallbacks:\n\n```javascript\nari.asterisk.ping(\n  function (err, asteriskping) {}\n);\n```\n\nPromises:\n\n```javascript\nari.asterisk.ping()\n  .then(function (asteriskping) {})\n  .catch(function (err) {});\n```\n##### reloadModule\n\nReload an Asterisk module.\n\nCallbacks:\n\n```javascript\nari.asterisk.reloadModule(\n  {moduleName: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.asterisk.reloadModule({\n    moduleName: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- moduleName (string) - Module's name\n\n##### rotateLog\n\nRotates a log channel.\n\nCallbacks:\n\n```javascript\nari.asterisk.rotateLog(\n  {logChannelName: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.asterisk.rotateLog({\n    logChannelName: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- logChannelName (string) - Log channel's name\n\n##### setGlobalVar\n\nSet the value of a global variable.\n\nCallbacks:\n\n```javascript\nari.asterisk.setGlobalVar(\n  {variable: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.asterisk.setGlobalVar({\n    variable: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- value (string) - The value to set the variable to\n- variable (string) - The variable to set\n\n##### unloadModule\n\nUnload an Asterisk module.\n\nCallbacks:\n\n```javascript\nari.asterisk.unloadModule(\n  {moduleName: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.asterisk.unloadModule({\n    moduleName: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- moduleName (string) - Module's name\n\n##### updateObject\n\nCreate or update a dynamic configuration object.\n\nCallbacks:\n\n```javascript\nari.asterisk.updateObject(\n  {configClass: val, id: val, objectType: val},\n  function (err, configtuples) {}\n);\n```\n\nPromises:\n\n```javascript\nari.asterisk.updateObject({\n    configClass: val,\n    id: val,\n    objectType: val\n})\n  .then(function (configtuples) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- configClass (string) - The configuration class containing dynamic configuration objects.\n- fields (containers) - The body object should have a value that is a list of ConfigTuples, which provide the fields to update. Ex. [ { \"attribute\": \"directmedia\", \"value\": \"false\" } ]\n- id (string) - The unique identifier of the object to create or update.\n- objectType (string) - The type of configuration object to create or update.\n\n#### bridges\n\n##### addChannel\n\nAdd a channel to a bridge.\n\nCallbacks:\n\n```javascript\nari.bridges.addChannel(\n  {bridgeId: val, channel: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.bridges.addChannel({\n    bridgeId: val,\n    channel: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- absorbDTMF (boolean) - Absorb DTMF coming from this channel, preventing it to pass through to the bridge\n- bridgeId (string) - Bridge's id\n- channel (string) - Ids of channels to add to bridge\n- mute (boolean) - Mute audio from this channel, preventing it to pass through to the bridge\n- role (string) - Channel's role in the bridge\n\n##### clearVideoSource\n\nRemoves any explicit video source in a multi-party mixing bridge. This operation has no effect on bridges with two or fewer participants. When no explicit video source is set, talk detection will be used to determine the active video stream.\n\nCallbacks:\n\n```javascript\nari.bridges.clearVideoSource(\n  {bridgeId: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.bridges.clearVideoSource({\n    bridgeId: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- bridgeId (string) - Bridge's id\n\n##### create\n\nCreate a new bridge.\n\nCallbacks:\n\n```javascript\nari.bridges.create(\n  function (err, bridge) {}\n);\n```\n\nPromises:\n\n```javascript\nari.bridges.create()\n  .then(function (bridge) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- bridgeId (string) - Unique ID to give to the bridge being created.\n- name (string) - Name to give to the bridge being created.\n- type (string) - Comma separated list of bridge type attributes (mixing, holding, dtmf_events, proxy_media, video_sfu).\n\n##### createWithId\n\nCreate a new bridge or updates an existing one.\n\nCallbacks:\n\n```javascript\nari.bridges.createWithId(\n  {bridgeId: val},\n  function (err, bridge) {}\n);\n```\n\nPromises:\n\n```javascript\nari.bridges.createWithId({\n    bridgeId: val\n})\n  .then(function (bridge) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- bridgeId (string) - Unique ID to give to the bridge being created.\n- name (string) - Set the name of the bridge.\n- type (string) - Comma separated list of bridge type attributes (mixing, holding, dtmf_events, proxy_media, video_sfu) to set.\n\n##### destroy\n\nShut down a bridge.\n\nCallbacks:\n\n```javascript\nari.bridges.destroy(\n  {bridgeId: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.bridges.destroy({\n    bridgeId: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- bridgeId (string) - Bridge's id\n\n##### get\n\nGet bridge details.\n\nCallbacks:\n\n```javascript\nari.bridges.get(\n  {bridgeId: val},\n  function (err, bridge) {}\n);\n```\n\nPromises:\n\n```javascript\nari.bridges.get({\n    bridgeId: val\n})\n  .then(function (bridge) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- bridgeId (string) - Bridge's id\n\n##### list\n\nList all active bridges in Asterisk.\n\nCallbacks:\n\n```javascript\nari.bridges.list(\n  function (err, bridges) {}\n);\n```\n\nPromises:\n\n```javascript\nari.bridges.list()\n  .then(function (bridges) {})\n  .catch(function (err) {});\n```\n##### play\n\nStart playback of media on a bridge.\n\nCallbacks:\n\n```javascript\nari.bridges.play(\n  {bridgeId: val, media: val},\n  function (err, playback) {}\n);\n```\n\nPromises:\n\n```javascript\nari.bridges.play({\n    bridgeId: val,\n    media: val\n})\n  .then(function (playback) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- bridgeId (string) - Bridge's id\n- lang (string) - For sounds, selects language for sound.\n- media (string) - Media URIs to play.\n- offsetms (int) - Number of milliseconds to skip before playing. Only applies to the first URI if multiple media URIs are specified.\n- playbackId (string) - Playback Id.\n- skipms (int) - Number of milliseconds to skip for forward/reverse operations.\n\n##### playWithId\n\nStart playback of media on a bridge.\n\nCallbacks:\n\n```javascript\nari.bridges.playWithId(\n  {bridgeId: val, media: val, playbackId: val},\n  function (err, playback) {}\n);\n```\n\nPromises:\n\n```javascript\nari.bridges.playWithId({\n    bridgeId: val,\n    media: val,\n    playbackId: val\n})\n  .then(function (playback) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- bridgeId (string) - Bridge's id\n- lang (string) - For sounds, selects language for sound.\n- media (string) - Media URIs to play.\n- offsetms (int) - Number of milliseconds to skip before playing. Only applies to the first URI if multiple media URIs are specified.\n- playbackId (string) - Playback ID.\n- skipms (int) - Number of milliseconds to skip for forward/reverse operations.\n\n##### record\n\nStart a recording.\n\nCallbacks:\n\n```javascript\nari.bridges.record(\n  {bridgeId: val, format: val, name: val},\n  function (err, liverecording) {}\n);\n```\n\nPromises:\n\n```javascript\nari.bridges.record({\n    bridgeId: val,\n    format: val,\n    name: val\n})\n  .then(function (liverecording) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- beep (boolean) - Play beep when recording begins\n- bridgeId (string) - Bridge's id\n- format (string) - Format to encode audio in\n- ifExists (string) - Action to take if a recording with the same name already exists.\n- maxDurationSeconds (int) - Maximum duration of the recording, in seconds. 0 for no limit.\n- maxSilenceSeconds (int) - Maximum duration of silence, in seconds. 0 for no limit.\n- name (string) - Recording's filename\n- terminateOn (string) - DTMF input to terminate recording.\n\n##### removeChannel\n\nRemove a channel from a bridge.\n\nCallbacks:\n\n```javascript\nari.bridges.removeChannel(\n  {bridgeId: val, channel: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.bridges.removeChannel({\n    bridgeId: val,\n    channel: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- bridgeId (string) - Bridge's id\n- channel (string) - Ids of channels to remove from bridge\n\n##### setVideoSource\n\nSet a channel as the video source in a multi-party mixing bridge. This operation has no effect on bridges with two or fewer participants.\n\nCallbacks:\n\n```javascript\nari.bridges.setVideoSource(\n  {bridgeId: val, channelId: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.bridges.setVideoSource({\n    bridgeId: val,\n    channelId: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- bridgeId (string) - Bridge's id\n- channelId (string) - Channel's id\n\n##### startMoh\n\nPlay music on hold to a bridge or change the MOH class that is playing.\n\nCallbacks:\n\n```javascript\nari.bridges.startMoh(\n  {bridgeId: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.bridges.startMoh({\n    bridgeId: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- bridgeId (string) - Bridge's id\n- mohClass (string) - Channel's id\n\n##### stopMoh\n\nStop playing music on hold to a bridge.\n\nCallbacks:\n\n```javascript\nari.bridges.stopMoh(\n  {bridgeId: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.bridges.stopMoh({\n    bridgeId: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- bridgeId (string) - Bridge's id\n\n#### channels\n\n##### answer\n\nAnswer a channel.\n\nCallbacks:\n\n```javascript\nari.channels.answer(\n  {channelId: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.answer({\n    channelId: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- channelId (string) - Channel's id\n\n##### continueInDialplan\n\nExit application; continue execution in the dialplan.\n\nCallbacks:\n\n```javascript\nari.channels.continueInDialplan(\n  {channelId: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.continueInDialplan({\n    channelId: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- channelId (string) - Channel's id\n- context (string) - The context to continue to.\n- extension (string) - The extension to continue to.\n- label (string) - The label to continue to - will supersede 'priority' if both are provided.\n- priority (int) - The priority to continue to.\n\n##### create\n\nCreate channel.\n\nCallbacks:\n\n```javascript\nari.channels.create(\n  {app: val, endpoint: val},\n  function (err, channel) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.create({\n    app: val,\n    endpoint: val\n})\n  .then(function (channel) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- app (string) - Stasis Application to place channel into\n- appArgs (string) - The application arguments to pass to the Stasis application provided by 'app'. Mutually exclusive with 'context', 'extension', 'priority', and 'label'.\n- channelId (string) - The unique id to assign the channel on creation.\n- endpoint (string) - Endpoint for channel communication\n- formats (string) - The format name capability list to use if originator is not specified. Ex. \"ulaw,slin16\".  Format names can be found with \"core show codecs\".\n- originator (string) - Unique ID of the calling channel\n- otherChannelId (string) - The unique id to assign the second channel when using local channels.\n\n##### dial\n\nDial a created channel.\n\nCallbacks:\n\n```javascript\nari.channels.dial(\n  {channelId: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.dial({\n    channelId: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- caller (string) - Channel ID of caller\n- channelId (string) - Channel's id\n- timeout (int) - Dial timeout\n\n##### externalMedia\n\nStart an External Media session.\n\nCallbacks:\n\n```javascript\nari.channels.externalMedia(\n  {app: val, external_host: val, format: val},\n  function (err, channel) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.externalMedia({\n    app: val,\n    external_host: val,\n    format: val\n})\n  .then(function (channel) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- app (string) - Stasis Application to place channel into\n- channelId (string) - The unique id to assign the channel on creation.\n- connection_type (string) - Connection type (client/server)\n- direction (string) - External media direction\n- encapsulation (string) - Payload encapsulation protocol\n- external_host (string) - Hostname/ip:port of external host\n- format (string) - Format to encode audio in\n- transport (string) - Transport protocol\n- variables (containers) - The \"variables\" key in the body object holds variable key/value pairs to set on the channel on creation. Other keys in the body object are interpreted as query parameters. Ex. { \"endpoint\": \"SIP/Alice\", \"variables\": { \"CALLERID(name)\": \"Alice\" } }\n\n##### get\n\nChannel details.\n\nCallbacks:\n\n```javascript\nari.channels.get(\n  {channelId: val},\n  function (err, channel) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.get({\n    channelId: val\n})\n  .then(function (channel) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- channelId (string) - Channel's id\n\n##### getChannelVar\n\nGet the value of a channel variable or function.\n\nCallbacks:\n\n```javascript\nari.channels.getChannelVar(\n  {channelId: val, variable: val},\n  function (err, variable) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.getChannelVar({\n    channelId: val,\n    variable: val\n})\n  .then(function (variable) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- channelId (string) - Channel's id\n- variable (string) - The channel variable or function to get\n\n##### hangup\n\nDelete (i.e. hangup) a channel.\n\nCallbacks:\n\n```javascript\nari.channels.hangup(\n  {channelId: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.hangup({\n    channelId: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- channelId (string) - Channel's id\n- reason (string) - Reason for hanging up the channel\n\n##### hold\n\nHold a channel.\n\nCallbacks:\n\n```javascript\nari.channels.hold(\n  {channelId: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.hold({\n    channelId: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- channelId (string) - Channel's id\n\n##### list\n\nList all active channels in Asterisk.\n\nCallbacks:\n\n```javascript\nari.channels.list(\n  function (err, channels) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.list()\n  .then(function (channels) {})\n  .catch(function (err) {});\n```\n##### move\n\nMove the channel from one Stasis application to another.\n\nCallbacks:\n\n```javascript\nari.channels.move(\n  {app: val, channelId: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.move({\n    app: val,\n    channelId: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- app (string) - The channel will be passed to this Stasis application.\n- appArgs (string) - The application arguments to pass to the Stasis application provided by 'app'.\n- channelId (string) - Channel's id\n\n##### mute\n\nMute a channel.\n\nCallbacks:\n\n```javascript\nari.channels.mute(\n  {channelId: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.mute({\n    channelId: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- channelId (string) - Channel's id\n- direction (string) - Direction in which to mute audio\n\n##### originate\n\nCreate a new channel (originate).\n\nCallbacks:\n\n```javascript\nari.channels.originate(\n  {endpoint: val},\n  function (err, channel) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.originate({\n    endpoint: val\n})\n  .then(function (channel) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- app (string) - The application that is subscribed to the originated channel. When the channel is answered, it will be passed to this Stasis application. Mutually exclusive with 'context', 'extension', 'priority', and 'label'.\n- appArgs (string) - The application arguments to pass to the Stasis application provided by 'app'. Mutually exclusive with 'context', 'extension', 'priority', and 'label'.\n- callerId (string) - CallerID to use when dialing the endpoint or extension.\n- channelId (string) - The unique id to assign the channel on creation.\n- context (string) - The context to dial after the endpoint answers. If omitted, uses 'default'. Mutually exclusive with 'app'.\n- endpoint (string) - Endpoint to call.\n- extension (string) - The extension to dial after the endpoint answers. Mutually exclusive with 'app'.\n- formats (string) - The format name capability list to use if originator is not specified. Ex. \"ulaw,slin16\".  Format names can be found with \"core show codecs\".\n- label (string) - The label to dial after the endpoint answers. Will supersede 'priority' if provided. Mutually exclusive with 'app'.\n- originator (string) - The unique id of the channel which is originating this one.\n- otherChannelId (string) - The unique id to assign the second channel when using local channels.\n- priority (long) - The priority to dial after the endpoint answers. If omitted, uses 1. Mutually exclusive with 'app'.\n- timeout (int) - Timeout (in seconds) before giving up dialing, or -1 for no timeout.\n- variables (containers) - The \"variables\" key in the body object holds variable key/value pairs to set on the channel on creation. Other keys in the body object are interpreted as query parameters. Ex. { \"endpoint\": \"SIP/Alice\", \"variables\": { \"CALLERID(name)\": \"Alice\" } }\n\n##### originateWithId\n\nCreate a new channel (originate with id).\n\nCallbacks:\n\n```javascript\nari.channels.originateWithId(\n  {channelId: val, endpoint: val},\n  function (err, channel) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.originateWithId({\n    channelId: val,\n    endpoint: val\n})\n  .then(function (channel) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- app (string) - The application that is subscribed to the originated channel. When the channel is answered, it will be passed to this Stasis application. Mutually exclusive with 'context', 'extension', 'priority', and 'label'.\n- appArgs (string) - The application arguments to pass to the Stasis application provided by 'app'. Mutually exclusive with 'context', 'extension', 'priority', and 'label'.\n- callerId (string) - CallerID to use when dialing the endpoint or extension.\n- channelId (string) - The unique id to assign the channel on creation.\n- context (string) - The context to dial after the endpoint answers. If omitted, uses 'default'. Mutually exclusive with 'app'.\n- endpoint (string) - Endpoint to call.\n- extension (string) - The extension to dial after the endpoint answers. Mutually exclusive with 'app'.\n- formats (string) - The format name capability list to use if originator is not specified. Ex. \"ulaw,slin16\".  Format names can be found with \"core show codecs\".\n- label (string) - The label to dial after the endpoint answers. Will supersede 'priority' if provided. Mutually exclusive with 'app'.\n- originator (string) - The unique id of the channel which is originating this one.\n- otherChannelId (string) - The unique id to assign the second channel when using local channels.\n- priority (long) - The priority to dial after the endpoint answers. If omitted, uses 1. Mutually exclusive with 'app'.\n- timeout (int) - Timeout (in seconds) before giving up dialing, or -1 for no timeout.\n- variables (containers) - The \"variables\" key in the body object holds variable key/value pairs to set on the channel on creation. Other keys in the body object are interpreted as query parameters. Ex. { \"endpoint\": \"SIP/Alice\", \"variables\": { \"CALLERID(name)\": \"Alice\" } }\n\n##### play\n\nStart playback of media.\n\nCallbacks:\n\n```javascript\nari.channels.play(\n  {channelId: val, media: val},\n  function (err, playback) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.play({\n    channelId: val,\n    media: val\n})\n  .then(function (playback) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- channelId (string) - Channel's id\n- lang (string) - For sounds, selects language for sound.\n- media (string) - Media URIs to play.\n- offsetms (int) - Number of milliseconds to skip before playing. Only applies to the first URI if multiple media URIs are specified.\n- playbackId (string) - Playback ID.\n- skipms (int) - Number of milliseconds to skip for forward/reverse operations.\n\n##### playWithId\n\nStart playback of media and specify the playbackId.\n\nCallbacks:\n\n```javascript\nari.channels.playWithId(\n  {channelId: val, media: val, playbackId: val},\n  function (err, playback) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.playWithId({\n    channelId: val,\n    media: val,\n    playbackId: val\n})\n  .then(function (playback) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- channelId (string) - Channel's id\n- lang (string) - For sounds, selects language for sound.\n- media (string) - Media URIs to play.\n- offsetms (int) - Number of milliseconds to skip before playing. Only applies to the first URI if multiple media URIs are specified.\n- playbackId (string) - Playback ID.\n- skipms (int) - Number of milliseconds to skip for forward/reverse operations.\n\n##### record\n\nStart a recording.\n\nCallbacks:\n\n```javascript\nari.channels.record(\n  {channelId: val, format: val, name: val},\n  function (err, liverecording) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.record({\n    channelId: val,\n    format: val,\n    name: val\n})\n  .then(function (liverecording) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- beep (boolean) - Play beep when recording begins\n- channelId (string) - Channel's id\n- format (string) - Format to encode audio in\n- ifExists (string) - Action to take if a recording with the same name already exists.\n- maxDurationSeconds (int) - Maximum duration of the recording, in seconds. 0 for no limit\n- maxSilenceSeconds (int) - Maximum duration of silence, in seconds. 0 for no limit\n- name (string) - Recording's filename\n- terminateOn (string) - DTMF input to terminate recording\n\n##### redirect\n\nRedirect the channel to a different location.\n\nCallbacks:\n\n```javascript\nari.channels.redirect(\n  {channelId: val, endpoint: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.redirect({\n    channelId: val,\n    endpoint: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- channelId (string) - Channel's id\n- endpoint (string) - The endpoint to redirect the channel to\n\n##### ring\n\nIndicate ringing to a channel.\n\nCallbacks:\n\n```javascript\nari.channels.ring(\n  {channelId: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.ring({\n    channelId: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- channelId (string) - Channel's id\n\n##### ringStop\n\nStop ringing indication on a channel if locally generated.\n\nCallbacks:\n\n```javascript\nari.channels.ringStop(\n  {channelId: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.ringStop({\n    channelId: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- channelId (string) - Channel's id\n\n##### rtpstatistics\n\nRTP stats on a channel.\n\nCallbacks:\n\n```javascript\nari.channels.rtpstatistics(\n  {channelId: val},\n  function (err, rtpstat) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.rtpstatistics({\n    channelId: val\n})\n  .then(function (rtpstat) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- channelId (string) - Channel's id\n\n##### sendDTMF\n\nSend provided DTMF to a given channel.\n\nCallbacks:\n\n```javascript\nari.channels.sendDTMF(\n  {channelId: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.sendDTMF({\n    channelId: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- after (int) - Amount of time to wait after DTMF digits (specified in milliseconds) end.\n- before (int) - Amount of time to wait before DTMF digits (specified in milliseconds) start.\n- between (int) - Amount of time in between DTMF digits (specified in milliseconds).\n- channelId (string) - Channel's id\n- dtmf (string) - DTMF To send.\n- duration (int) - Length of each DTMF digit (specified in milliseconds).\n\n##### setChannelVar\n\nSet the value of a channel variable or function.\n\nCallbacks:\n\n```javascript\nari.channels.setChannelVar(\n  {channelId: val, variable: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.setChannelVar({\n    channelId: val,\n    variable: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- channelId (string) - Channel's id\n- value (string) - The value to set the variable to\n- variable (string) - The channel variable or function to set\n\n##### snoopChannel\n\nStart snooping.\n\nCallbacks:\n\n```javascript\nari.channels.snoopChannel(\n  {app: val, channelId: val},\n  function (err, channel) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.snoopChannel({\n    app: val,\n    channelId: val\n})\n  .then(function (channel) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- app (string) - Application the snooping channel is placed into\n- appArgs (string) - The application arguments to pass to the Stasis application\n- channelId (string) - Channel's id\n- snoopId (string) - Unique ID to assign to snooping channel\n- spy (string) - Direction of audio to spy on\n- whisper (string) - Direction of audio to whisper into\n\n##### snoopChannelWithId\n\nStart snooping.\n\nCallbacks:\n\n```javascript\nari.channels.snoopChannelWithId(\n  {app: val, channelId: val, snoopId: val},\n  function (err, channel) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.snoopChannelWithId({\n    app: val,\n    channelId: val,\n    snoopId: val\n})\n  .then(function (channel) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- app (string) - Application the snooping channel is placed into\n- appArgs (string) - The application arguments to pass to the Stasis application\n- channelId (string) - Channel's id\n- snoopId (string) - Unique ID to assign to snooping channel\n- spy (string) - Direction of audio to spy on\n- whisper (string) - Direction of audio to whisper into\n\n##### startMoh\n\nPlay music on hold to a channel.\n\nCallbacks:\n\n```javascript\nari.channels.startMoh(\n  {channelId: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.startMoh({\n    channelId: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- channelId (string) - Channel's id\n- mohClass (string) - Music on hold class to use\n\n##### startSilence\n\nPlay silence to a channel.\n\nCallbacks:\n\n```javascript\nari.channels.startSilence(\n  {channelId: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.startSilence({\n    channelId: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- channelId (string) - Channel's id\n\n##### stopMoh\n\nStop playing music on hold to a channel.\n\nCallbacks:\n\n```javascript\nari.channels.stopMoh(\n  {channelId: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.stopMoh({\n    channelId: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- channelId (string) - Channel's id\n\n##### stopSilence\n\nStop playing silence to a channel.\n\nCallbacks:\n\n```javascript\nari.channels.stopSilence(\n  {channelId: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.stopSilence({\n    channelId: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- channelId (string) - Channel's id\n\n##### unhold\n\nRemove a channel from hold.\n\nCallbacks:\n\n```javascript\nari.channels.unhold(\n  {channelId: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.unhold({\n    channelId: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- channelId (string) - Channel's id\n\n##### unmute\n\nUnmute a channel.\n\nCallbacks:\n\n```javascript\nari.channels.unmute(\n  {channelId: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.channels.unmute({\n    channelId: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- channelId (string) - Channel's id\n- direction (string) - Direction in which to unmute audio\n\n#### deviceStates\n\n##### delete\n\nDestroy a device-state controlled by ARI.\n\nCallbacks:\n\n```javascript\nari.deviceStates.delete(\n  {deviceName: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.deviceStates.delete({\n    deviceName: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- deviceName (string) - Name of the device\n\n##### get\n\nRetrieve the current state of a device.\n\nCallbacks:\n\n```javascript\nari.deviceStates.get(\n  {deviceName: val},\n  function (err, devicestate) {}\n);\n```\n\nPromises:\n\n```javascript\nari.deviceStates.get({\n    deviceName: val\n})\n  .then(function (devicestate) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- deviceName (string) - Name of the device\n\n##### list\n\nList all ARI controlled device states.\n\nCallbacks:\n\n```javascript\nari.deviceStates.list(\n  function (err, devicestates) {}\n);\n```\n\nPromises:\n\n```javascript\nari.deviceStates.list()\n  .then(function (devicestates) {})\n  .catch(function (err) {});\n```\n##### update\n\nChange the state of a device controlled by ARI. (Note - implicitly creates the device state).\n\nCallbacks:\n\n```javascript\nari.deviceStates.update(\n  {deviceName: val, deviceState: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.deviceStates.update({\n    deviceName: val,\n    deviceState: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- deviceName (string) - Name of the device\n- deviceState (string) - Device state value\n\n#### endpoints\n\n##### get\n\nDetails for an endpoint.\n\nCallbacks:\n\n```javascript\nari.endpoints.get(\n  function (err, endpoint) {}\n);\n```\n\nPromises:\n\n```javascript\nari.endpoints.get()\n  .then(function (endpoint) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- resource (string) - ID of the endpoint\n- tech (string) - Technology of the endpoint\n\n##### list\n\nList all endpoints.\n\nCallbacks:\n\n```javascript\nari.endpoints.list(\n  function (err, endpoints) {}\n);\n```\n\nPromises:\n\n```javascript\nari.endpoints.list()\n  .then(function (endpoints) {})\n  .catch(function (err) {});\n```\n##### listByTech\n\nList available endoints for a given endpoint technology.\n\nCallbacks:\n\n```javascript\nari.endpoints.listByTech(\n  function (err, endpoints) {}\n);\n```\n\nPromises:\n\n```javascript\nari.endpoints.listByTech()\n  .then(function (endpoints) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- tech (string) - Technology of the endpoints (sip,iax2,...)\n\n##### sendMessage\n\nSend a message to some technology URI or endpoint.\n\nCallbacks:\n\n```javascript\nari.endpoints.sendMessage(\n  {from: val, to: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.endpoints.sendMessage({\n    from: val,\n    to: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- body (string) - The body of the message\n- from (string) - The endpoint resource or technology specific identity to send this message from. Valid resources are sip, pjsip, and xmpp.\n- to (string) - The endpoint resource or technology specific URI to send the message to. Valid resources are sip, pjsip, and xmpp.\n- variables (containers) - undefined\n\n##### sendMessageToEndpoint\n\nSend a message to some endpoint in a technology.\n\nCallbacks:\n\n```javascript\nari.endpoints.sendMessageToEndpoint(\n  {from: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.endpoints.sendMessageToEndpoint({\n    from: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- body (string) - The body of the message\n- from (string) - The endpoint resource or technology specific identity to send this message from. Valid resources are sip, pjsip, and xmpp.\n- resource (string) - ID of the endpoint\n- tech (string) - Technology of the endpoint\n- variables (containers) - undefined\n\n#### mailboxes\n\n##### delete\n\nDestroy a mailbox.\n\nCallbacks:\n\n```javascript\nari.mailboxes.delete(\n  {mailboxName: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.mailboxes.delete({\n    mailboxName: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- mailboxName (string) - Name of the mailbox\n\n##### get\n\nRetrieve the current state of a mailbox.\n\nCallbacks:\n\n```javascript\nari.mailboxes.get(\n  {mailboxName: val},\n  function (err, mailbox) {}\n);\n```\n\nPromises:\n\n```javascript\nari.mailboxes.get({\n    mailboxName: val\n})\n  .then(function (mailbox) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- mailboxName (string) - Name of the mailbox\n\n##### list\n\nList all mailboxes.\n\nCallbacks:\n\n```javascript\nari.mailboxes.list(\n  function (err, mailboxs) {}\n);\n```\n\nPromises:\n\n```javascript\nari.mailboxes.list()\n  .then(function (mailboxs) {})\n  .catch(function (err) {});\n```\n##### update\n\nChange the state of a mailbox. (Note - implicitly creates the mailbox).\n\nCallbacks:\n\n```javascript\nari.mailboxes.update(\n  {mailboxName: val, newMessages: val, oldMessages: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.mailboxes.update({\n    mailboxName: val,\n    newMessages: val,\n    oldMessages: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- mailboxName (string) - Name of the mailbox\n- newMessages (int) - Count of new messages in the mailbox\n- oldMessages (int) - Count of old messages in the mailbox\n\n#### playbacks\n\n##### control\n\nControl a playback.\n\nCallbacks:\n\n```javascript\nari.playbacks.control(\n  {operation: val, playbackId: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.playbacks.control({\n    operation: val,\n    playbackId: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- operation (string) - Operation to perform on the playback.\n- playbackId (string) - Playback's id\n\n##### get\n\nGet a playback's details.\n\nCallbacks:\n\n```javascript\nari.playbacks.get(\n  {playbackId: val},\n  function (err, playback) {}\n);\n```\n\nPromises:\n\n```javascript\nari.playbacks.get({\n    playbackId: val\n})\n  .then(function (playback) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- playbackId (string) - Playback's id\n\n##### stop\n\nStop a playback.\n\nCallbacks:\n\n```javascript\nari.playbacks.stop(\n  {playbackId: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.playbacks.stop({\n    playbackId: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- playbackId (string) - Playback's id\n\n#### recordings\n\n##### cancel\n\nStop a live recording and discard it.\n\nCallbacks:\n\n```javascript\nari.recordings.cancel(\n  {recordingName: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.recordings.cancel({\n    recordingName: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- recordingName (string) - The name of the recording\n\n##### copyStored\n\nCopy a stored recording.\n\nCallbacks:\n\n```javascript\nari.recordings.copyStored(\n  {destinationRecordingName: val, recordingName: val},\n  function (err, storedrecording) {}\n);\n```\n\nPromises:\n\n```javascript\nari.recordings.copyStored({\n    destinationRecordingName: val,\n    recordingName: val\n})\n  .then(function (storedrecording) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- destinationRecordingName (string) - The destination name of the recording\n- recordingName (string) - The name of the recording to copy\n\n##### deleteStored\n\nDelete a stored recording.\n\nCallbacks:\n\n```javascript\nari.recordings.deleteStored(\n  {recordingName: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.recordings.deleteStored({\n    recordingName: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- recordingName (string) - The name of the recording\n\n##### getLive\n\nList live recordings.\n\nCallbacks:\n\n```javascript\nari.recordings.getLive(\n  {recordingName: val},\n  function (err, liverecording) {}\n);\n```\n\nPromises:\n\n```javascript\nari.recordings.getLive({\n    recordingName: val\n})\n  .then(function (liverecording) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- recordingName (string) - The name of the recording\n\n##### getStored\n\nGet a stored recording's details.\n\nCallbacks:\n\n```javascript\nari.recordings.getStored(\n  {recordingName: val},\n  function (err, storedrecording) {}\n);\n```\n\nPromises:\n\n```javascript\nari.recordings.getStored({\n    recordingName: val\n})\n  .then(function (storedrecording) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- recordingName (string) - The name of the recording\n\n##### getStoredFile\n\nGet the file associated with the stored recording.\n\nCallbacks:\n\n```javascript\nari.recordings.getStoredFile(\n  {recordingName: val},\n  function (err, binary) {}\n);\n```\n\nPromises:\n\n```javascript\nari.recordings.getStoredFile({\n    recordingName: val\n})\n  .then(function (binary) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- recordingName (string) - The name of the recording\n\n##### listStored\n\nList recordings that are complete.\n\nCallbacks:\n\n```javascript\nari.recordings.listStored(\n  function (err, storedrecordings) {}\n);\n```\n\nPromises:\n\n```javascript\nari.recordings.listStored()\n  .then(function (storedrecordings) {})\n  .catch(function (err) {});\n```\n##### mute\n\nMute a live recording.\n\nCallbacks:\n\n```javascript\nari.recordings.mute(\n  {recordingName: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.recordings.mute({\n    recordingName: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- recordingName (string) - The name of the recording\n\n##### pause\n\nPause a live recording.\n\nCallbacks:\n\n```javascript\nari.recordings.pause(\n  {recordingName: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.recordings.pause({\n    recordingName: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- recordingName (string) - The name of the recording\n\n##### stop\n\nStop a live recording and store it.\n\nCallbacks:\n\n```javascript\nari.recordings.stop(\n  {recordingName: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.recordings.stop({\n    recordingName: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- recordingName (string) - The name of the recording\n\n##### unmute\n\nUnmute a live recording.\n\nCallbacks:\n\n```javascript\nari.recordings.unmute(\n  {recordingName: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.recordings.unmute({\n    recordingName: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- recordingName (string) - The name of the recording\n\n##### unpause\n\nUnpause a live recording.\n\nCallbacks:\n\n```javascript\nari.recordings.unpause(\n  {recordingName: val},\n  function (err) {}\n);\n```\n\nPromises:\n\n```javascript\nari.recordings.unpause({\n    recordingName: val\n})\n  .then(function () {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- recordingName (string) - The name of the recording\n\n#### sounds\n\n##### get\n\nGet a sound's details.\n\nCallbacks:\n\n```javascript\nari.sounds.get(\n  {soundId: val},\n  function (err, sound) {}\n);\n```\n\nPromises:\n\n```javascript\nari.sounds.get({\n    soundId: val\n})\n  .then(function (sound) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- soundId (string) - Sound's id\n\n##### list\n\nList all sounds.\n\nCallbacks:\n\n```javascript\nari.sounds.list(\n  function (err, sounds) {}\n);\n```\n\nPromises:\n\n```javascript\nari.sounds.list()\n  .then(function (sounds) {})\n  .catch(function (err) {});\n```\n###### Available Parameters\n- format (string) - Lookup sound in a specific format.\n- lang (string) - Lookup sound for a specific language.\n\n\n### Events\n\nEvent listeners can be registered on the client as well as on resource instances.\n\n#### Client Events\n\nClient events are received for all events of a given type regardless of which resource the event is for.\n\n```javascript\nari.on('StasisStart', function (event, channelInstance) {\n    // will be called for all channels that enter the Stasis application\n});\n```\n\n#### Resource Instance Events\n\nResource instance events are only received for the given type and resource.\n\nCallbacks:\n\n```javascript\nvar channel = ari.Channel();\nchannel.on('StasisStart', function (event, channelInstance) {\n    // will only be called when the channel above enters the Stasis application\n});\n\nchannel.originate(\n  {endpoint: 'PJSIP/endpoint', app: 'applicationName'},\n  function (err, channelInstance) {}\n);\n```\n\nPromises:\n\n```javascript\nvar channel = ari.Channel();\nchannel.on('StasisStart', function (event, channelInstance) {\n    // will only be called when the channel above enters the Stasis application\n});\n\nchannel.originate({endpoint: 'PJSIP/endpoint', app: 'applicationName'})\n  .then(function (channelInstance) {})\n  .catch(function (err) {});\n```\n\n#### Managing Events\n\nWhen using events, it is important to note that the callbacks you provide to handle events cannot be garbage collected until they are unregistered as shown below.\n\nAt the client level:\n\n```javascript\nvar handler = function (event, channel) {};\n\n// receive all 'ChannelDtmfReceived' events\nari.on('ChannelDtmfReceived', handler);\n\n// at some point in your application, remove the event listener to ensure the handler function can be garbage collected\nari.removeListener('ChannelDtmfReceived', handler);\n// or remove all event listeners for a particular event type\nari.removeAllListeners('ChannelDtmfReceived');\n```\n\nAt the instance level:\n\n```javascript\nvar channel = ari.Channel();\nvar handler = function (event, channel) {};\n\n// receive all 'ChannelDtmfReceived' events for this channel\nchannel.on('ChannelDtmfReceived', handler);\n\n// at some point in your application, remove the event listener to ensure the handler function can be garbage collected\nchannel.removeListener('ChannelDtmfReceived', handler);\n// or remove all event listeners for a particular event type\nchannel.removeAllListeners('ChannelDtmfReceived');\n```\n\nFor events that are only expected to fire once, `once` can be used to register an event listener that will automatically be unregistered once the event fires as shown below:\n\n```javascript\nvar playback = ari.Playback();\nvar handler = function (event, playback) {};\n\n// receive 'PlaybackFinished' events for this playback\nplayback.once('PlaybackFinished', handler);\n```\n\n#### Supported Events\n\nThe following events are defined:\n\n##### APILoadError\n\nARI client failed to load.\n\n```javascript\nfunction (err) {}\n```\n\n##### ApplicationMoveFailed\n\nNotification that trying to move a channel to another Stasis application failed.\n\n```javascript\nfunction (event, channel) {}\n```\n###### Available Event Properties\n- args (List[string]) - Arguments to the application\n- channel (Channel) - undefined\n- destination (string) - undefined\n\n###### Resource Specific Emitters\nChannel\n\n##### ApplicationReplaced\n\nNotification that another WebSocket has taken over for an application.\n\nAn application may only be subscribed to by a single WebSocket at a time. If multiple WebSockets attempt to subscribe to the same application, the newer WebSocket wins, and the older one receives this event.\n\n```javascript\nfunction (event) {}\n```\n##### BridgeAttendedTransfer\n\nNotification that an attended transfer has occurred.\n\n```javascript\nfunction (event, {destination_link_first_leg: val, destination_link_second_leg: val, destination_threeway_bridge: val, destination_threeway_channel: val, replace_channel: val, transfer_target: val, transferee: val, transferer_first_leg: val, transferer_first_leg_bridge: val, transferer_second_leg: val, transferer_second_leg_bridge: val}) {}\n```\n###### Available Event Properties\n- destination_application (string) - Application that has been transferred into\n- destination_bridge (string) - Bridge that survived the merge result\n- destination_link_first_leg (Channel) - First leg of a link transfer result\n- destination_link_second_leg (Channel) - Second leg of a link transfer result\n- destination_threeway_bridge (Bridge) - Bridge that survived the threeway result\n- destination_threeway_channel (Channel) - Transferer channel that survived the threeway result\n- destination_type (string) - How the transfer was accomplished\n- is_external (boolean) - Whether the transfer was externally initiated or not\n- replace_channel (Channel) - The channel that is replacing transferer_first_leg in the swap\n- result (string) - The result of the transfer attempt\n- transfer_target (Channel) - The channel that is being transferred to\n- transferee (Channel) - The channel that is being transferred\n- transferer_first_leg (Channel) - First leg of the transferer\n- transferer_first_leg_bridge (Bridge) - Bridge the transferer first leg is in\n- transferer_second_leg (Channel) - Second leg of the transferer\n- transferer_second_leg_bridge (Bridge) - Bridge the transferer second leg is in\n\n###### Resource Specific Emitters\nChannel\nBridge\n\n##### BridgeBlindTransfer\n\nNotification that a blind transfer has occurred.\n\n```javascript\nfunction (event, {bridge: val, channel: val, replace_channel: val, transferee: val}) {}\n```\n###### Available Event Properties\n- bridge (Bridge) - The bridge being transferred\n- channel (Channel) - The channel performing the blind transfer\n- context (string) - The context transferred to\n- exten (string) - The extension transferred to\n- is_external (boolean) - Whether the transfer was externally initiated or not\n- replace_channel (Channel) - The channel that is replacing transferer when the transferee(s) can not be transferred directly\n- result (string) - The result of the transfer attempt\n- transferee (Channel) - The channel that is being transferred\n\n###### Resource Specific Emitters\nBridge\nChannel\n\n##### BridgeCreated\n\nNotification that a bridge has been created.\n\n```javascript\nfunction (event, bridge) {}\n```\n###### Available Event Properties\n- bridge (Bridge) - undefined\n\n###### Resource Specific Emitters\nBridge\n\n##### BridgeDestroyed\n\nNotification that a bridge has been destroyed.\n\n```javascript\nfunction (event, bridge) {}\n```\n###### Available Event Properties\n- bridge (Bridge) - undefined\n\n###### Resource Specific Emitters\nBridge\n\n##### BridgeMerged\n\nNotification that one bridge has merged into another.\n\n```javascript\nfunction (event, {bridge: val, bridge_from: val}) {}\n```\n###### Available Event Properties\n- bridge (Bridge) - undefined\n- bridge_from (Bridge) - undefined\n\n###### Resource Specific Emitters\nBridge\n\n##### BridgeVideoSourceChanged\n\nNotification that the source of video in a bridge has changed.\n\n```javascript\nfunction (event, bridge) {}\n```\n###### Available Event Properties\n- bridge (Bridge) - undefined\n- old_video_source_id (string) - undefined\n\n###### Resource Specific Emitters\nBridge\n\n##### ChannelCallerId\n\nChannel changed Caller ID.\n\n```javascript\nfunction (event, channel) {}\n```\n###### Available Event Properties\n- caller_presentation (int) - The integer representation of the Caller Presentation value.\n- caller_presentation_txt (string) - The text representation of the Caller Presentation value.\n- channel (Channel) - The channel that changed Caller ID.\n\n###### Resource Specific Emitters\nChannel\n\n##### ChannelConnectedLine\n\nChannel changed Connected Line.\n\n```javascript\nfunction (event, channel) {}\n```\n###### Available Event Properties\n- channel (Channel) - The channel whose connected line has changed.\n\n###### Resource Specific Emitters\nChannel\n\n##### ChannelCreated\n\nNotification that a channel has been created.\n\n```javascript\nfunction (event, channel) {}\n```\n###### Available Event Properties\n- channel (Channel) - undefined\n\n###### Resource Specific Emitters\nChannel\n\n##### ChannelDestroyed\n\nNotification that a channel has been destroyed.\n\n```javascript\nfunction (event, channel) {}\n```\n###### Available Event Properties\n- cause (int) - Integer representation of the cause of the hangup\n- cause_txt (string) - Text representation of the cause of the hangup\n- channel (Channel) - undefined\n\n###### Resource Specific Emitters\nChannel\n\n##### ChannelDialplan\n\nChannel changed location in the dialplan.\n\n```javascript\nfunction (event, channel) {}\n```\n###### Available Event Properties\n- channel (Channel) - The channel that changed dialplan location.\n- dialplan_app (string) - The application about to be executed.\n- dialplan_app_data (string) - The data to be passed to the application.\n\n###### Resource Specific Emitters\nChannel\n\n##### ChannelDtmfReceived\n\nDTMF received on a channel.\n\nThis event is sent when the DTMF ends. There is no notification about the start of DTMF\n\n```javascript\nfunction (event, channel) {}\n```\n###### Available Event Properties\n- channel (Channel) - The channel on which DTMF was received\n- digit (string) - DTMF digit received (0-9, A-E, # or *)\n- duration_ms (int) - Number of milliseconds DTMF was received\n\n###### Resource Specific Emitters\nChannel\n\n##### ChannelEnteredBridge\n\nNotification that a channel has entered a bridge.\n\n```javascript\nfunction (event, {bridge: val, channel: val}) {}\n```\n###### Available Event Properties\n- bridge (Bridge) - undefined\n- channel (Channel) - undefined\n\n###### Resource Specific Emitters\nBridge\nChannel\n\n##### ChannelHangupRequest\n\nA hangup was requested on the channel.\n\n```javascript\nfunction (event, channel) {}\n```\n###### Available Event Properties\n- cause (int) - Integer representation of the cause of the hangup.\n- channel (Channel) - The channel on which the hangup was requested.\n- soft (boolean) - Whether the hangup request was a soft hangup request.\n\n###### Resource Specific Emitters\nChannel\n\n##### ChannelHold\n\nA channel initiated a media hold.\n\n```javascript\nfunction (event, channel) {}\n```\n###### Available Event Properties\n- channel (Channel) - The channel that initiated the hold event.\n- musicclass (string) - The music on hold class that the initiator requested.\n\n###### Resource Specific Emitters\nChannel\n\n##### ChannelLeftBridge\n\nNotification that a channel has left a bridge.\n\n```javascript\nfunction (event, {bridge: val, channel: val}) {}\n```\n###### Available Event Properties\n- bridge (Bridge) - undefined\n- channel (Channel) - undefined\n\n###### Resource Specific Emitters\nBridge\nChannel\n\n##### ChannelStateChange\n\nNotification of a channel's state change.\n\n```javascript\nfunction (event, channel) {}\n```\n###### Available Event Properties\n- channel (Channel) - undefined\n\n###### Resource Specific Emitters\nChannel\n\n##### ChannelTalkingFinished\n\nTalking is no longer detected on the channel.\n\n```javascript\nfunction (event, channel) {}\n```\n###### Available Event Properties\n- channel (Channel) - The channel on which talking completed.\n- duration (int) - The length of time, in milliseconds, that talking was detected on the channel\n\n###### Resource Specific Emitters\nChannel\n\n##### ChannelTalkingStarted\n\nTalking was detected on the channel.\n\n```javascript\nfunction (event, channel) {}\n```\n###### Available Event Properties\n- channel (Channel) - The channel on which talking started.\n\n###### Resource Specific Emitters\nChannel\n\n##### ChannelUnhold\n\nA channel initiated a media unhold.\n\n```javascript\nfunction (event, channel) {}\n```\n###### Available Event Properties\n- channel (Channel) - The channel that initiated the unhold event.\n\n###### Resource Specific Emitters\nChannel\n\n##### ChannelUserevent\n\nUser-generated event with additional user-defined fields in the object.\n\n```javascript\nfunction (event, {bridge: val, channel: val, endpoint: val}) {}\n```\n###### Available Event Properties\n- bridge (Bridge) - A bridge that is signaled with the user event.\n- channel (Channel) - A channel that is signaled with the user event.\n- endpoint (Endpoint) - A endpoint that is signaled with the user event.\n- eventname (string) - The name of the user event.\n- userevent (object) - Custom Userevent data\n\n###### Resource Specific Emitters\nBridge\nChannel\nEndpoint\n\n##### ChannelVarset\n\nChannel variable changed.\n\n```javascript\nfunction (event, channel) {}\n```\n###### Available Event Properties\n- channel (Channel) - The channel on which the variable was set.\n\nIf missing, the variable is a global variable.\n- value (string) - The new value of the variable.\n- variable (string) - The variable that changed.\n\n###### Resource Specific Emitters\nChannel\n\n##### ContactInfo\n\nDetailed information about a contact on an endpoint.\n\n```javascript\nfunction (event) {}\n```\n###### Available Event Properties\n- aor (string) - The Address of Record this contact belongs to.\n- contact_status (string) - The current status of the contact.\n- roundtrip_usec (string) - Current round trip time, in microseconds, for the contact.\n- uri (string) - The location of the contact.\n\n##### ContactStatusChange\n\nThe state of a contact on an endpoint has changed.\n\n```javascript\nfunction (event, endpoint) {}\n```\n###### Available Event Properties\n- contact_info (ContactInfo) - undefined\n- endpoint (Endpoint) - undefined\n\n###### Resource Specific Emitters\nEndpoint\n\n##### DeviceStateChanged\n\nNotification that a device state has changed.\n\n```javascript\nfunction (event, device_state) {}\n```\n###### Available Event Properties\n- device_state (DeviceState) - Device state object\n\n###### Resource Specific Emitters\nDeviceState\n\n##### Dial\n\nDialing state has changed.\n\n```javascript\nfunction (event, {caller: val, forwarded: val, peer: val}) {}\n```\n###### Available Event Properties\n- caller (Channel) - The calling channel.\n- dialstatus (string) - Current status of the dialing attempt to the peer.\n- dialstring (string) - The dial string for calling the peer channel.\n- forward (string) - Forwarding target requested by the original dialed channel.\n- forwarded (Channel) - Channel that the caller has been forwarded to.\n- peer (Channel) - The dialed channel.\n\n###### Resource Specific Emitters\nChannel\n\n##### EndpointStateChange\n\nEndpoint state changed.\n\n```javascript\nfunction (event, endpoint) {}\n```\n###### Available Event Properties\n- endpoint (Endpoint) - undefined\n\n###### Resource Specific Emitters\nEndpoint\n\n##### MissingParams\n\nError event sent when required params are missing.\n\n```javascript\nfunction (event) {}\n```\n###### Available Event Properties\n- params (List[string]) - A list of the missing parameters\n\n##### Peer\n\nDetailed information about a remote peer that communicates with Asterisk.\n\n```javascript\nfunction (event) {}\n```\n###### Available Event Properties\n- address (string) - The IP address of the peer.\n- cause (string) - An optional reason associated with the change in peer_status.\n- peer_status (string) - The current state of the peer. Note that the values of the status are dependent on the underlying peer technology.\n- port (string) - The port of the peer.\n- time (string) - The last known time the peer was contacted.\n\n##### PeerStatusChange\n\nThe state of a peer associated with an endpoint has changed.\n\n```javascript\nfunction (event, endpoint) {}\n```\n###### Available Event Properties\n- endpoint (Endpoint) - undefined\n- peer (Peer) - undefined\n\n###### Resource Specific Emitters\nEndpoint\n\n##### PlaybackContinuing\n\nEvent showing the continuation of a media playback operation from one media URI to the next in the list.\n\n```javascript\nfunction (event, playback) {}\n```\n###### Available Event Properties\n- playback (Playback) - Playback control object\n\n###### Resource Specific Emitters\nPlayback\n\n##### PlaybackFinished\n\nEvent showing the completion of a media playback operation.\n\n```javascript\nfunction (event, playback) {}\n```\n###### Available Event Properties\n- playback (Playback) - Playback control object\n\n###### Resource Specific Emitters\nPlayback\n\n##### PlaybackStarted\n\nEvent showing the start of a media playback operation.\n\n```javascript\nfunction (event, playback) {}\n```\n###### Available Event Properties\n- playback (Playback) - Playback control object\n\n###### Resource Specific Emitters\nPlayback\n\n##### RecordingFailed\n\nEvent showing failure of a recording operation.\n\n```javascript\nfunction (event, recording) {}\n```\n###### Available Event Properties\n- recording (LiveRecording) - Recording control object\n\n###### Resource Specific Emitters\nLiveRecording\n\n##### RecordingFinished\n\nEvent showing the completion of a recording operation.\n\n```javascript\nfunction (event, recording) {}\n```\n###### Available Event Properties\n- recording (LiveRecording) - Recording control object\n\n###### Resource Specific Emitters\nLiveRecording\n\n##### RecordingStarted\n\nEvent showing the start of a recording operation.\n\n```javascript\nfunction (event, recording) {}\n```\n###### Available Event Properties\n- recording (LiveRecording) - Recording control object\n\n###### Resource Specific Emitters\nLiveRecording\n\n##### StasisEnd\n\nNotification that a channel has left a Stasis application.\n\n```javascript\nfunction (event, channel) {}\n```\n###### Available Event Properties\n- channel (Channel) - undefined\n\n###### Resource Specific Emitters\nChannel\n\n##### StasisStart\n\nNotification that a channel has entered a Stasis application.\n\n```javascript\nfunction (event, {channel: val, replace_channel: val}) {}\n```\n###### Available Event Properties\n- args (List[string]) - Arguments to the application\n- channel (Channel) - undefined\n- replace_channel (Channel) - undefined\n\n###### Resource Specific Emitters\nChannel\n\n##### TextMessageReceived\n\nA text message was received from an endpoint.\n\n```javascript\nfunction (event, endpoint) {}\n```\n###### Available Event Properties\n- endpoint (Endpoint) - undefined\n- message (TextMessage) - undefined\n\n###### Resource Specific Emitters\nEndpoint\n\n\n\n##### WebSocketReconnecting\n\nWebSocket has disconnected, and the client is attempting to reconnect.\n\n```JavaScript\nfunction (err) {}\n```\n\n##### WebSocketConnected\n\nWebSocket has connected. Note that normally this event is emitted prior to resolving the `connect()` promise, so you probably will not get an even on the initial connection.\n\n```JavaScript\nfunction () {}\n```\n\n##### WebSocketMaxRetries\n\nClient will no longer attempt to reconnect to the WebSocket for the current application(s).\n\n```JavaScript\nfunction (err) {}\n```\n\n# Examples\n\nCallbacks:\n\n```javascript\nvar client = require('ari-client'),\n    util = require('util');\n\nclient.connect('http://localhost:8088', 'user', 'secret', client_loaded);\n\nfunction client_loaded (err, ari) {\n\n  if (err) {\n    throw err; // program will crash if it fails to connect\n  }\n\n  ari.once('StasisStart', channel_joined);\n\n  function channel_joined (event, incoming) {\n    incoming.on('ChannelDtmfReceived', dtmf_received);\n\n    incoming.answer(function (err) {\n      play(incoming, 'sound:hello-world');\n    });\n  }\n\n  function dtmf_received (event, channel) {\n    var digit = event.digit;\n    switch (digit) {\n      case '#':\n        play(channel, 'sound:vm-goodbye', function (err) {\n          channel.hangup(function (err) {\n            process.exit(0);\n          });\n        });\n        break;\n      case '*':\n        play(channel, 'sound:tt-monkeys');\n        break;\n      default:\n        play(channel, util.format('sound:digits/%s', digit));\n    }\n  }\n\n  function play (channel, sound, callback) {\n    var playback = ari.Playback();\n\n    playback.on('PlaybackFinished', function (event, playback) {\n      if (callback) {\n        callback(null);\n      }\n    });\n\n    channel.play({media: sound}, playback, function (err, playback) {});\n  }\n\n  ari.start('hello');\n}\n```\n\nPromises:\n\n```javascript\nvar client = require('ari-client'),\n    Promise = require('bluebird'),\n    util = require('util');\n\nclient.connect('http://localhost:8088', 'user', 'secret')\n  .then(function (ari) {\n\n    ari.once('StasisStart', channelJoined);\n\n    function channelJoined (event, incoming) {\n      incoming.on('ChannelDtmfReceived', dtmfReceived);\n\n      incoming.answer()\n        .then(function () {\n          return play(incoming, 'sound:hello-world');\n        })\n        .catch(function (err) {});\n    }\n\n    function dtmfReceived (event, channel) {\n      var digit = event.digit;\n      switch (digit) {\n        case '#':\n          play(channel, 'sound:vm-goodbye')\n            .then(function () {\n              return channel.hangup();\n            })\n            .finally(function () {\n              process.exit(0);\n            });\n          break;\n        case '*':\n          play(channel, 'sound:tt-monkeys');\n          break;\n        default:\n          play(channel, util.format('sound:digits/%s', digit));\n      }\n    }\n\n    function play (channel, sound) {\n      var playback = ari.Playback();\n\n      return new Promise(function (resolve, reject) {\n        playback.on('PlaybackFinished', function (event, playback) {\n          resolve(playback);\n        });\n\n        channel.play({media: sound}, playback)\n          .catch(function (err) {\n            reject(err);\n          });\n      });\n    }\n\n    ari.start('hello');\n  })\n  .done(); // program will crash if it fails to connect\n```\n\n# Testing\n\nTo run the mocha tests for ari-client, run the following:\n\n```bash\n$ npm test\n```\n\nThe tests run against a mocked ARI REST endpoint and websocket server.\n\n# Development\n\nAfter cloning the git repository, run the following to install all dev dependencies:\n\n```bash\n$ npm install\n$ npm link\n```\n\nThen run the following to run jshint and mocha tests:\n\n```bash\n$ npm test\n```\n\njshint will enforce a minimal style guide. It is also a good idea to create unit tests when adding new features to ari-client.\n\nTo generate a test coverage report run the following:\n\n```bash\n$ npm run check-coverage\n```\n\nThis will also ensure a coverage threshold is met by the tests.\n\nUnit test fixtures for ARI resources can be generated from a local asterisk instance by running the following:\n\n```bash\n$ grunt genfixtures\n```\n\nOnce you have done this and loaded a mocked ARI server, individual calls can be mocked using the hock library. Websocket events can be mocked by creating a websocket server and calling its send method. The helpers module exposes methods for creating a mocked ARI server and a mocked websocket server for use in writing unit tests.\n\nDeveloper documentation can ge generated by running the following:\n\n```bash\n$ grunt jsdoc\n```\n\n# License\n\nApache, Version 2.0. Copyright (c) 2014, Digium, Inc. All rights reserved.\n\n[build]: https://travis-ci.org/asterisk/node-ari-client\n[build_image]: https://travis-ci.org/asterisk/node-ari-client.svg?branch=master\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasterisk%2Fnode-ari-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasterisk%2Fnode-ari-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasterisk%2Fnode-ari-client/lists"}