Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var RingCentral = require('ringcentral')
- var WebPhone = require('ringcentral-web-phone')
- var appKey = '...';
- var appSecret = '...';
- var appName = '...';
- var appVersion = '...';
- var sdk = new RingCentral({
- appKey: appKey,
- appSecret: appSecret,
- appName: appName,
- appVersion: appVersion,
- server: RingCentral.server.production // or .sandbox
- });
- var platform = sdk.platform();
- platform
- .login({
- username: '...',
- password: '...'
- })
- .then(function(loginResponse) {
- return platform
- .post('/client-info/sip-provision', {
- sipInfo: [{transport: 'WSS'}]
- })
- .then(function(res) {
- return new WebPhone(res.json(), { // optional
- appKey: appKey,
- appName: appName,
- appVersion: appVersion,
- uuid: loginResponse.json().endpoint_id,
- logLevel: 1, // error 0, warn 1, log: 2, debug: 3
- audioHelper: {
- enabled: true, // enables audio feedback when web phone is ringing or making a call
- incoming: 'path-to-audio/incoming.ogg', // path to audio file for incoming call
- outgoing: 'path-to-audio/outgoing.ogg' // path to aduotfile for outgoing call
- }
- });
- });
- })
- .then(function(webPhone){
- // YOUR CODE HERE
- })
- .catch(function(e){
- console.error(e.stack);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement