{"id":25970566,"url":"https://github.com/twilio/twilio-voice.js","last_synced_at":"2025-04-02T05:02:49.500Z","repository":{"id":38038188,"uuid":"362223560","full_name":"twilio/twilio-voice.js","owner":"twilio","description":"Twilio's JavaScript Voice SDK","archived":false,"fork":false,"pushed_at":"2025-03-21T18:52:24.000Z","size":16199,"stargazers_count":64,"open_issues_count":25,"forks_count":53,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-03-26T04:02:44.245Z","etag":null,"topics":["client","sdk","twilio","voice","webrtc"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/twilio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2021-04-27T19:10:31.000Z","updated_at":"2025-03-21T18:52:22.000Z","dependencies_parsed_at":"2024-01-18T22:37:44.278Z","dependency_job_id":"d46867ff-0c60-4852-a3d3-763d34d2ff3e","html_url":"https://github.com/twilio/twilio-voice.js","commit_stats":{"total_commits":659,"total_committers":22,"mean_commits":"29.954545454545453","dds":0.6358118361153262,"last_synced_commit":"8b1a47138a6ddd8a1ff62c26dd67cf2e44bc86c2"},"previous_names":[],"tags_count":77,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twilio%2Ftwilio-voice.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twilio%2Ftwilio-voice.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twilio%2Ftwilio-voice.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twilio%2Ftwilio-voice.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/twilio","download_url":"https://codeload.github.com/twilio/twilio-voice.js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246752635,"owners_count":20827987,"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":["client","sdk","twilio","voice","webrtc"],"created_at":"2025-03-04T23:17:48.601Z","updated_at":"2025-04-02T05:02:49.472Z","avatar_url":"https://github.com/twilio.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Migration from twilio-client.js 1.x\nThis product, Twilio's JavaScript Voice SDK, is the next version of Twilio's Javascript Client SDK. It is\nnow in GA and we recommend all customers migrate in order to continue receiving future feature additions.\nFor help on migrating from 1.x, see our [migration guide](https://www.twilio.com/docs/voice/client/migrating-to-js-voice-sdk-20).\n\n@twilio/voice-sdk\n=================\n\n[![NPM](https://img.shields.io/npm/v/%40twilio/voice-sdk.svg)](https://www.npmjs.com/package/%40twilio/voice-sdk) [![CircleCI](https://dl.circleci.com/status-badge/img/gh/twilio/twilio-voice.js/tree/master.svg?style=shield)](https://circleci.com/gh/twilio/twilio-voice.js/tree/master)\n\nTwilio's Voice SDK allows you to add real-time voice and PSTN calling to your web apps.\n\n* [API Docs](https://twilio.github.io/twilio-voice.js/index.html)\n* [More Docs](https://www.twilio.com/docs/voice/sdks/javascript)\n* [Quickstart](https://www.twilio.com/docs/voice/client/javascript/quickstart)\n* [Reference Components](https://www.twilio.com/docs/voice/sdks/javascript/reference-components)\n* [Changelog](https://github.com/twilio/twilio-voice.js/blob/master/CHANGELOG.md)\n\n### Issues and Support\nPlease check out our [common issues](COMMON_ISSUES.md) page or file any issues you find here on Github. For general inquiries related to the Voice SDK you can file a support ticket. Please ensure that you are not sharing any [Personally Identifiable Information(PII)](https://www.twilio.com/docs/glossary/what-is-personally-identifiable-information-pii) or sensitive account information (API keys, credentials, etc.) when reporting an issue.\n\nInstallation\n------------\n\n### NPM\n\nWe recommend using `npm` to add the Voice SDK as a dependency.\n\n```\nnpm install @twilio/voice-sdk --save\n```\n\nUsing this method, you can `import` the Voice SDK using ES Module or TypeScript syntax:\n\n```js\nimport { Device } from '@twilio/voice-sdk';\n\n```\n\nOr using CommonJS:\n\n```js\nconst Device = require('@twilio/voice-sdk').Device;\n```\n\n### CDN\nAs of 2.0, the Twilio Voice SDK is no longer hosted via CDN.\n\n### GitHub\n\nAlthough we recommend using `npm` to add the Voice SDK as a dependency, you can also get the Twilio Voice SDK code\nfrom GitHub and include it in your project directly. To do so, navigate to\n[\"Tags\"](https://github.com/twilio/twilio-voice.js/tags) and find the most recent release, or\nthe particular release version you'd like to use.\n\n\u003e **Note:** releases tagged with \"-rc\" are \"Release Candidate\" versions\n\u003e and are still being tested. Unless you specifically know that you want to use a release candidate\n\u003e version, you should not use a release with \"-rc\" in the name.\n\nDownload either the `zip` or the `tar.gz` and then extract the files. For example, if you downloaded the\ntarball for the `2.0.0` release, you could then extract the files with the `tar` command:\n\n```\ntar -xvzf twilio-voice.js-2.0.0.tar.gz\ncd twilio-voice.js-2.0.0\n```\n\nOnce you've extracted the folder, the `twilio.js` and `twilio.min.js` files that\nyou can include in your project will be in the `/dist` directory. `twilio.min.js` is the\nminified version of the code.\n\nYou can copy either the `twilio.js` or the `twilio.min.js` file into your project and\nthen provide a link to it in your html. For example:\n\n```\n\u003cscript type=\"text/javascript\" src=\"twilio.min.js\"\u003e\u003c/script\u003e\n```\n\nUsing this method, you can access the SDK through the browser global:\n\n```\nconst Device = Twilio.Device;\n```\n\nTesting\n-------\n\nRunning unit tests requires no setup aside from installation (above). You can run unit tests via:\n\n```\nnpm run test:unit\n```\n\nIntegration tests require some set up:\n\n1. If the account you want to use doesn't already have a TwiML app set up, create one using the\n   TwiML code below.\n2. Copy config.example.yaml to config.yaml, replacing the placeholder information with valid credentials.\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cResponse\u003e\n  \u003cDial\u003e\n    \u003cClient\u003e\n      \u003cIdentity\u003e{{To}}\u003c/Identity\u003e\n      \u003cParameter name=\"duplicate\" value=\"12345\" /\u003e\n      \u003cParameter name=\"duplicate\" value=\"123456\" /\u003e\n      \u003cParameter name=\"custom + param\" value=\"我不吃蛋\" /\u003e\n      \u003cParameter name=\"foobar\" value=\"some + value\" /\u003e\n      \u003cParameter name=\"custom1\" value=\"{{Custom1}}\" /\u003e\n      \u003cParameter name=\"custom2\" value=\"{{Custom2}}\" /\u003e\n      \u003cParameter name=\"custom3\" value=\"{{Custom3}}\" /\u003e\n    \u003c/Client\u003e\n  \u003c/Dial\u003e\n\u003c/Response\u003e\n```\n\nIntegration tests can be run via:\n\n```\nnpm run test:integration\n```\n\nThese tests will run via karma, one at a time, in your system's default Chrome and then Firefox.\n\nNetwork tests have been split out into their own docker processes, and can be run via\n\n```\nnpm run test:docker\n```\n\nContent Security Policy (CSP)\n----------------------------\n\nUse the following policy directives to enable [CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) that is compatible with twilio-voice.js.\n\n```\nscript-src https://media.twiliocdn.com https://sdk.twilio.com\nmedia-src mediastream: https://media.twiliocdn.com https://sdk.twilio.com\nconnect-src https://eventgw.twilio.com wss://voice-js.roaming.twilio.com https://media.twiliocdn.com https://sdk.twilio.com\n```\n\nIf you are providing a non-default value for `Device.ConnectOptions.edge` parameter, you need to add the Signaling URI `wss://voice-js.{edgeId}.twilio.com` in your `connect-src` directive where `edgeId` is the `Edge ID` as defined in this [page](https://www.twilio.com/docs/global-infrastructure/edge-locations). See examples below.\n\n**If `Device.ConnectOptions.edge` is `ashburn`**\n\n```\nconnect-src https://eventgw.twilio.com https://media.twiliocdn.com https://sdk.twilio.com wss://voice-js.ashburn.twilio.com\n```\n\n**If `Device.ConnectOptions.edge` is `['ashburn', 'sydney', 'roaming']`**\n\n```\nconnect-src https://eventgw.twilio.com https://media.twiliocdn.com https://sdk.twilio.com wss://voice-js.ashburn.twilio.com wss://voice-js.sydney.twilio.com wss://voice-js.roaming.twilio.com\n```\n\nIf you are providing a home region grant into your [Twilio access token](https://www.twilio.com/docs/iam/access-tokens), you need to add the insights endpoint in your `connect-src` directive using `eventgw.{homeRegion}.twilio.com` format. Below is an example if your home region grant is `sg1`.\n\n```\nconnect-src https://eventgw.sg1.twilio.com wss://voice-js.roaming.twilio.com https://media.twiliocdn.com https://sdk.twilio.com\n```\n\nLicense\n-------\n\nSee [LICENSE.md](https://github.com/twilio/twilio-voice.js/blob/master/LICENSE.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwilio%2Ftwilio-voice.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwilio%2Ftwilio-voice.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwilio%2Ftwilio-voice.js/lists"}