{"id":21406638,"url":"https://github.com/ringcentral/ringcentral-call-control-js","last_synced_at":"2025-07-14T00:32:38.994Z","repository":{"id":40491585,"uuid":"200818333","full_name":"ringcentral/ringcentral-call-control-js","owner":"ringcentral","description":"RingCentral Call Control SDK in JavaScript to control RingCentral calls on any endpoint. Demo URL:","archived":false,"fork":false,"pushed_at":"2024-12-02T07:23:38.000Z","size":440,"stargazers_count":8,"open_issues_count":1,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-08T21:43:47.877Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://ringcentral.github.io/ringcentral-call-control-js/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ringcentral.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2019-08-06T09:18:17.000Z","updated_at":"2025-06-30T20:50:45.000Z","dependencies_parsed_at":"2023-02-09T03:15:39.904Z","dependency_job_id":"a968e02a-32df-48b7-8468-b5c9910f8082","html_url":"https://github.com/ringcentral/ringcentral-call-control-js","commit_stats":{"total_commits":92,"total_committers":5,"mean_commits":18.4,"dds":0.3369565217391305,"last_synced_commit":"a1ddc6a7de289ef48374eec68cac837764cc1f99"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/ringcentral/ringcentral-call-control-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ringcentral%2Fringcentral-call-control-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ringcentral%2Fringcentral-call-control-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ringcentral%2Fringcentral-call-control-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ringcentral%2Fringcentral-call-control-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ringcentral","download_url":"https://codeload.github.com/ringcentral/ringcentral-call-control-js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ringcentral%2Fringcentral-call-control-js/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265227898,"owners_count":23731059,"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":[],"created_at":"2024-11-22T16:41:07.688Z","updated_at":"2025-07-14T00:32:38.307Z","avatar_url":"https://github.com/ringcentral.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RingCentral Call Control JS SDK\n\n[![Coverage Status](https://coveralls.io/repos/github/ringcentral/ringcentral-call-control-js/badge.svg?branch=master)](https://coveralls.io/github/ringcentral/ringcentral-call-control-js?branch=master)\n[![NPM Version](https://img.shields.io/npm/v/ringcentral-call-control.svg?style=flat-square)](https://www.npmjs.com/package/ringcentral-call-control)\n[![Build Status](https://github.com/ringcentral/ringcentral-call-control-js/workflows/CI%20Pipeline/badge.svg?branch=master)](https://github.com/ringcentral/ringcentral-call-control-js/actions)\n\nRingCentral Call Control JS SDK is wrapper of RingCentral JS SDK to help developers call [RingCentral Call Control API](https://developers.ringcentral.com/api-reference/Call-Control/) more functionally.\n\n## Features:\n\nWe added the following key features to do the heavy lifting for you.\n\n* Call session management to load existing call sessions or create call session.\n* Call session event. Handle telephony session notifications, manage call session lifecycle\n* Call session management with functional API.\n* Devices management to load user’s devices.\n\n**Notice**: This library doesn't provide ability of voice transmission. For working with `WebRTC` voice transimission, please use [RingCentral Call JS SDK](https://github.com/ringcentral/ringcentral-call-js). It combines WebRTC voice transimission and Call Control RESTful APIs.\n\n## Prerequisites\n\n* You will need an active RingCentral account to create RingCentral app. Don't have an account? [Get your Free RingCentral Developer Account Now!](https://developers.ringcentral.com/)\n* A RingCentral app\n    * App type: Browser-Based or Server/Web\n    * Permissions: 'Call Control', 'Read Accounts', 'Read Presence', 'Webhook Subscriptions'\n\n## Table of Contents\n\n* [Install](#install)\n* [Usage](#usage)\n* [Demo](#demo)\n* [API](#api)\n  * [Init](#init)\n  * [Events](#events)\n  * [Sessions List](#sessions-list)\n  * [Session API](#session-api)\n  * [Session Events](#session-events)\n  * [Devices](#devices)\n\n## Install\n\nUse npm or yarn\n\n```bash\n$ yarn add @ringcentral/sdk @ringcentral/subscriptions ringcentral-call-control\n```\n\nCDN\n\n```html\n\u003cscript type=\"text/javascript\" src=\"https://unpkg.com/es6-promise@latest/dist/es6-promise.auto.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\" src=\"https://unpkg.com/pubnub@latest/dist/web/pubnub.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\" src=\"https://unpkg.com/whatwg-fetch@latest/dist/fetch.umd.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\" src=\"https://unpkg.com/@ringcentral/sdk@latest/dist/ringcentral.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\" src=\"https://unpkg.com/@ringcentral/subscriptions@latest/dist/ringcentral-subscriptions.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\" src=\"https://unpkg.com/ringcentral-call-control@0.2.0/build/index.js\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\nFor this example you will also need to have [RingCentral JS SDK](https://github.com/ringcentral/ringcentral-js/tree/master/sdk#installation) and [RingCentral JS Subscriptions SDK](https://github.com/ringcentral/ringcentral-js/tree/master/subscriptions#installation) installed.\n\nConfigure and new Call Control instance:\n\n```js\n// npm import\n// import { RingCentralCallControl } from 'ringcentral-call-control';\n// or use CDN\n// window.RingCentralCallControl\n\nvar appClientId = '...'; \nvar appClientSecret = '...';\nvar appName = '...';\nvar appVersion = '...';\n\nvar sdk = new RingCentral.SDK({\n  clientId: appClientId,\n  clientSecret: appClientSecret,\n  appName: appName,\n  appVersion: appVersion,\n  server: RingCentral.SDK.server.production // or .sandbox\n});\nvar subscriptions = new RingCentral.Subscriptions({\n  sdk: sdk\n});\nvar platform = sdk.platform();\n\nplatform\n  .login({\n    username: '...',\n    password: '...'\n  })\n  .then(function() {\n    var rcCallControl = new RingCentralCallControl({ sdk: sdk });\n    var subscription = subscriptions.createSubscription();\n\n    subscription.setEventFilters(['/restapi/v1.0/account/~/extension/~/telephony/sessions']);\n    subscription.on(subscription.events.notification, function(msg) {\n       rcCallControl.onNotificationEvent(msg)\n    });\n    subscription.register();\n    return rcCallControl;\n  })\n```\n\n## Demo\n\n```bash\n$ git clone https://github.com/ringcentral/ringcentral-call-control-js.git\n$ cd ringcentral-call-control-js\n$ yarn\n$ yarn build\n$ yarn start\n```\n\nOpen `http://localhost:8080/demo/`, and login with RingCentral Sandbox account to test.\n\nGet online demo [here](https://ringcentral.github.io/ringcentral-call-control-js/).\n\n## API\n\n### Init\n\nFirstly, we need to create Call Control instance after user login with [RingCentral JS SDK](https://github.com/ringcentral/ringcentral-js/tree/v3#login). Then connect `onNotificationEvent` with [subscription](https://github.com/ringcentral/ringcentral-js/tree/master/subscriptions#ringcentral-subscriptions-sdk) notification event.\n\n```js\nvar rcCallControl = new RingCentralCallControl({ sdk: sdk });\nvar initialized = false;\nvar subscription = subscriptions.createSubscription();\nsubscription.setEventFilters(['/restapi/v1.0/account/~/extension/~/telephony/sessions']);\nsubscription.on(subscription.events.notification, function(msg) {\n  rcCallControl.onNotificationEvent(msg)\n});\nsubscription.register();\nrcCallControl.on('initialized', function() {\n  initialized = true;\n});\n```\n\n### Events\n\n#### New session event\n\n```js\nvar session = null;\n\nrcCallControl.on('new', (newSession) =\u003e {\n  session = newSession;\n});\n```\n\n#### Initialized\n\n```js\nrcCallControl.on('initialized', function() {\n  initialized = true;\n});\n```\n\n### Sessions List\n\n```js\nvar sessions = rcCallControl.sessions;\n```\n\n## Session API\n\n#### Create a Call Session\n\n```js\nvar session = null;\nvar deviceId = rcCallControl.devices.filter(d =\u003e d.status === 'Online')[0].id;\nrcCallControl.createCall(deviceId, { phoneNumber: 'phoneNumberToCall' }).then((newSession) =\u003e {\n  session = newSession;\n  // ...\n})\n```\n\n#### Drop Session\n\nDrops a call session.\n\n```js\nsession.drop().then(...);\n```\n\n#### Hold Unhold\n\nPuts the party to stand-alone mode and starts to play Hold Music according to configuration \u0026 state to peers. There is a known limitation for Hold API - hold via REST API doesn't work with hold placed via RingCentral apps or HardPhone. It means that if you muted participant via Call Control API and RingCentral Desktop app, then you need to unhold both endpoints to remove Hold Music and bring media back.\n\n```js\nsession.hold().then(...);\nsession.unhold().then(...);\n```\n\n#### Mute Unmute\n\nCallee will be put on mute or unmute\n\n```js\nsession.mute().then(...);\nsession.unmute().then(...);\n```\n\n#### To Voicemail\n\n```js\nsession.toVoicemail().then(...);\n```\n\n#### Ignore in call queue\n\n```js\nsession.ignore({ deviceId: 'your_device_id' }).then(...);\n```\n\n#### Answer\n\n```js\nsession.answer({ deviceId: 'your_device_id' }).then(...);\n```\n\n#### Reply with message\n\n```js\nsession.reply({ replyWithText: 'On my way' }).then(...);\nsession.reply({\n  replyWithPattern: {\n    pattern: 'WillCallYouBack',\n    time: 10,\n    timeUnit: 'Minute'\n  }\n}).then(...);\n```\n\n#### Forward\n\nDistributes a non-answered call to the defined target. Applicable for \"Setup\" or \"Proceeding\" states\n\n```js\nsession.forward({ phoneNumber: 'phoneNumber' }).then(...);\n```\n\n#### Transfer\n\nTransfers a party by placing a new call to the specified target\n\n```js\nsession.transfer({ phoneNumber: 'phoneNumber' }).then(...);\n```\n\n#### Flip\n\nPerforms call flip procedure by holding opposite party and calling to the specified target.\n\n```js\nsession.flip({ callFlipId: 'callFlipId' }).then(...);\n```\n\n#### Park\n\nPerforms call park procedure to set on park one of the call parties in call dialog.\n\n```js\nsession.park().then(...);\n```\n\n#### Recording\n\nStarts a new call recording for the party\n\n```js\nsession.createRecord().then(...);\n```\n\nPause/resume recording\n\n```js\nsession.pauseRecord('recordingId').then(...);\nsession.resumeRecord('recordingId').then(...);\n```\n\n#### Supervise\n\nAllows to monitor a call in 'Listen' mode. Input parameters should contain extension number of a monitored user and internal identifier of a supervisor's device. Call session should be specified in path. Currently is not supported for Sandbox environment.\n\n```js\nsession.supervise({\n  mode: 'Listen',\n  deviceId: 'your deviceId',\n  extensionNumber: 'extensionNumber'\n}).then(...);\n```\n\n### Session Events\n\n#### Status\n\n```js\nsession.on('status', (event) =\u003e {\n  // on status changed\n  var party = event.party;\n  var status = party.status;\n  // ...\n});\n```\n\n#### Muted\n\n```js\nsession.on('muted', () =\u003e {\n  // on muted changed\n  var muted = session.muted;\n  // ...\n});\n```\n\n### Devices\n\nGet current extension's all devices:\n\n```js\nvar devices = rcCallControl.devices;\n```\n\nRefresh devices:\n\n```js\nrcCallControl.refreshDevices().then(() =\u003e {\n  var devices = rcCallControl.devices;\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fringcentral%2Fringcentral-call-control-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fringcentral%2Fringcentral-call-control-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fringcentral%2Fringcentral-call-control-js/lists"}