The ExotelCRMWebSDK allows you to leverage Exotel's platform for making IP calls, with this easy to integrate feature.
Refer to sample project here or read on.
- You can install the package using npm:
npm install git+https://github.com/exotel/exotel-ip-calling-crm-websdk
- Simply import the ExotelCRMWebSDK in your code like this:
import ExotelCRMWebSDK from "exotel-ip-calling-crm-websdk";
If you are not using a package manager like NPM, you can directly include the bundled JavaScript file that can be generated by webpack.
-
First, you should clone this repository.
-
You can install the required packages using following npm command:
npm install
-
Locate the 'webpack.config.js' file in the project directory, you can find this file in the root directory of the project.
-
Run the following command to build the webpack from root directory:
npx webpack
-
Build command should create a folder called 'target' in the same directory.
target/
├── beep.wav ├── dtmf.wav ├── ringbacktone.wav ├── ringtone.wav ├── crmBundle.js └── crmBundle.js.LICENSE.txt
-
Simply copy & paste this 'target' folder into the project that requires CRMWebSDK.
-
You can now utilize the 'crmBundle.js' file by including it as a script in your project..
<script src="./target/crmBundle.js"></script>
You can configure crmWebSDK object like this:
const crmWebSDK = new ExotelCRMWebSDK(accessToken, userId, true);
constructor
accessToken : This can be generated using the Create Authentication Token API
userId : You can get the userId using the Application user management APIs
autoConnectVOIP : If true, it will auto-connect device when the ExotelWebPhoneSDK
is returned on initialization. (If you have passed false, then you must call DoRegister
on ExotelWebPhoneSDK
)
Initialize
Initializes the CRMWebSDK, sets up the phone object, and registers callbacks for various events.
Parameters:
sofPhoneListenerCallback
(function): Callback for incoming calls.
softPhoneRegisterEventCallBack
(function, optional): Callback for soft phone register events. Default is null.
softPhoneSessionCallback
(function, optional): Callback for soft phone session events. Default is null.
Returns:
Promise<ExotelWebPhoneSDK | void>: A promise that resolves to an instance of ExotelWebPhoneSDK if successful, or void if unsuccessful.
Use the Initialize
method on the ExotelCRMWebSDK
object which returns Promise that resolves to ExotelWebPhoneSDK
object.
ExotelCRMWebSDK
does all the work to get necessary details required for the ExotelWebPhoneSDK
const crmWebPhone = await crmWebSDK.Initialize(HandleCallEvents, RegisterationEvent);
You must pass call events handler, registeration event handler (optional) and session callback handler (optional) to the Initialize
method
-
RegisterDevice: Registers the device with the call server.
-
UnRegisterDevice: Un-registers the device from the call server.
-
AcceptCall: Accept call
-
HangupCall: Disconnect call
-
MakeCall: (async) Method that places a call
Number: A number to dial
dialCallback: It is called after the call request is made to the server (An actual call may start after this with a slight day).
CustomField: String; Any application-specific value like order id that will be passed back as a parameter in status callback.
-
ToggleHold: Toggle state hold/un-hold state of a call. This state needs to be maintained by the client
-
ToggleMute Toggle state mute/un-mute state of a call. This state needs to be maintained by the client
This project is licensed under the Apache-2.0 License. See the LICENSE file for details.