{"id":18455433,"url":"https://github.com/enniel/adonis-asterisk-ami","last_synced_at":"2025-06-15T17:35:06.007Z","repository":{"id":57173523,"uuid":"88988696","full_name":"enniel/adonis-asterisk-ami","owner":"enniel","description":"integration asterisk manager interface (AMI) in adonis-framework","archived":false,"fork":false,"pushed_at":"2018-04-19T10:38:59.000Z","size":22,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-26T19:22:36.710Z","etag":null,"topics":["adonis","adonis-framework","adonisjs","ami","asterisk","asterisk-ami","asterisk-manager-api"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/enniel.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-21T13:50:32.000Z","updated_at":"2020-06-09T14:07:18.000Z","dependencies_parsed_at":"2022-08-24T13:31:06.876Z","dependency_job_id":null,"html_url":"https://github.com/enniel/adonis-asterisk-ami","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/enniel/adonis-asterisk-ami","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enniel%2Fadonis-asterisk-ami","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enniel%2Fadonis-asterisk-ami/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enniel%2Fadonis-asterisk-ami/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enniel%2Fadonis-asterisk-ami/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/enniel","download_url":"https://codeload.github.com/enniel/adonis-asterisk-ami/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enniel%2Fadonis-asterisk-ami/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260022825,"owners_count":22947235,"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":["adonis","adonis-framework","adonisjs","ami","asterisk","asterisk-ami","asterisk-manager-api"],"created_at":"2024-11-06T08:08:02.151Z","updated_at":"2025-06-15T17:35:05.947Z","avatar_url":"https://github.com/enniel.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Adonis Asterisk AMI\n\nEasy control via [asterisk](http://www.asterisk.org/) manager interface (AMI).\n\nInstallation and configuration\n----------------\n\nUsing npm:\n\n```sh\nnpm i adonis-asterisk-ami --save\n```\nUsing yarn:\n\n```sh\nyarn add adonis-asterisk-ami\n```\n\nOnce it's installed, you can register the service providers in `bootsrap/app.js`:\n\n```js\nconst providers = [\n  ...\n  'adonis-asterisk-ami/providers/AsteriskAmiProvider',\n  ...\n]\n\n...\n\nconst aceProviders = [\n  ...\n  'adonis-asterisk-ami/providers/CommandsProvider',\n  ...\n]\n```\n\nThen add `ami.js` file in `config` folder with this code:\n\n```js\n'use strict'\n\nconst Env = use('Env')\n\nmodule.exports = {\n  // client's parameters\n  reconnect: false,\n  maxAttemptsCount: 30,\n  attemptsDelay: 1000,\n  keepAlive: false,\n  keepAliveDelay: 1000,\n  emitEventsByTypes: true,\n  eventTypeToLowerCase: false,\n  emitResponsesById: true,\n  addTime: false,\n  eventFilter: null,\n  // connection parameters\n  host: Env.get('ASTERISK_AMI_HOST', '127.0.0.1'),\n  port: Env.get('ASTERISK_AMI_PORT', 5038),\n  username: Env.get('ASTERISK_AMI_USERNAME', ''),\n  secret: Env.get('ASTERISK_AMI_SECRET', ''),\n  dongle: {\n    sms: {\n      device: Env.get('ASTERISK_AMI_SMS_DEVICE', 'dongle1')\n    }\n  }\n}\n```\nFor more information abount client's parameters see [documentation](https://github.com/BelirafoN/asterisk-ami-client#clients-parameters).\n\nUsage\n----------------\n**Connection options**\n\nYou are can specify connection parameters for all commands.\n\n| Option     | Description                  |\n| ---------  | ---------------------------- |\n| --host     | Asterisk AMI server host     |\n| --port     | Asterisk AMI server port     |\n| --username | Asterisk AMI server username |\n| --secret   | Asterisk AMI server secret   |\n\n**Listen ami events**\n\n```sh\n./ace ami:listen\n```\n```js\n// app/Listeners/AsteriskAmi.js\n'use strict'\n\nconst AsteriskAmi = exports = module.exports = {}\n\nAsteriskAmi.onEvent = function * (event) {\n  console.log(`${event.Event} handled`)\n}\n\n// bootsrap/events.js\n...\nEvent.when('ami.events.*', 'AsteriskAmi.onEvent')\n...\n```\nFor more information about `event` property see [asterisk-ami-client](https://github.com/BelirafoN/asterisk-ami-client) documentation.\n\nIf would you like to see event log in the console use *debug* option\n```sh\n./ace ami:listen --debug\n```\n\n**Send ami action**\n\n```sh\n./ace ami:action \u003caction\u003e --props='\u003ckey1\u003e:\u003cvalue1\u003e;\u003ckey2\u003e:\u003cvalue2\u003e' --id=\u003cUNIQUE_ID?\u003e\n```\n\n```js\nconst props = _.reduce({\n  \u003ckey\u003e: \u003cvalue\u003e,\n  \u003ckey2\u003e: \u003cvalue2\u003e\n}, (result, value, key) =\u003e {\n  if (result.length) {\n    result = `${result};`\n  }\n  result += `${key}:${value}`\n  return result\n}, '')\n\n// Foo:Bar,ActionID:\u003cUNIQUE_ID?\u003e\nAce.call('ami:action', [\u003caction\u003e], {\n  props,\n  id: \u003cUNIQUE_ID?\u003e\n});\n```\nOptions `props` and `id` is not required.\n\n**Send sms messages using chan dongle**\n\n```sh\n./ace ami:dongle:sms \u003cphone\u003e \u003cmessage\u003e \u003cdevice?\u003e --id=\u003cUNIQUE_ID?\u003e\n```\n\n```js\nAce.call('ami:dongle:sms', [\n  \u003cphone\u003e,\n  \u003cmessage\u003e,\n  \u003cdevice?\u003e,\n], {\n  id: \u003cUNIQUE_ID?\u003e\n});\n```\nFor sending long messages use *pdu* mode.\n```sh\n./ace ami:dongle:sms \u003cphone\u003e \u003cmessage\u003e \u003cdevice?\u003e --pdu --id=\u003cUNIQUE_ID?\u003e\n```\n\n```js\nAce.call('ami:dongle:sms', [\n  \u003cphone\u003e,\n  \u003cmessage\u003e,\n  \u003cdevice?\u003e,\n], {\n  pdu: true,\n  id: \u003cUNIQUE_ID?\u003e\n});\n```\n\nArgument `device` and option `id` is not required.\n\n**Send ussd commands using chan dongle**\n\n```sh\n./ace ami:dongle:ussd \u003cdevice\u003e \u003cussd\u003e --id=\u003cUNIQUE_ID\u003e\n```\n\n```js\nAce.call('ami:dongle:ussd', [\n  \u003cussd\u003e,\n  \u003cdevice\u003e\n], {\n  id: \u003cUNIQUE_ID\u003e\n});\n```\n\nOption `id` is not required.\n\n**Without Adonis App**\n\nSee [bin folder](https://github.com/enniel/adonis-asterisk-ami/tree/master/bin)\n\n## Credits\n\n- [Evgeni Razumov](https://github.com/enniel)\n\n## Support\n\nHaving trouble? [Open an issue](https://github.com/enniel/adonis-asterisk-ami/issues/new)!\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenniel%2Fadonis-asterisk-ami","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenniel%2Fadonis-asterisk-ami","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenniel%2Fadonis-asterisk-ami/lists"}