News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
How to create WebPhone with javascript SDK
Tags: sdk
Jun 8, 2020 at 12:14am   •   3 replies  •  0 likes
Mike Charles

Hi Team, We are using Ringcentral javascript SDk to make and receive calls. We did the authorization with java SDK and saved required tokens and using the same tokens in javascript sdk using below code platform.auth().setData(tokens); But here I confused on how to get the WebPhone from the platform object. Could you please provide me the code to create a WebPhone after setting the tokens to platform.

3 Answers
answered on Jun 22, 2020 at 4:56am  

Thank you Phong Vu. your answer was very helpful for me. I had completed the integration and everything is working fine. But I didn't find any option to dismiss/reject the call in RingCentral Web phone SDK.

This is the way I am initiating the call.

var session = webphone.userAgent.invite(toNumber, {

fromNumber : fromNumber

});


And one more doubt is I am not able to record the calls. Do we need a paid account to enable Call Recondings or can we test with the sandbox account?


The last doubt is Do we need the RingCentral paid plan to apply for production? When I am trying to apply for production its showing the messege as below.
https://i.snipboard.io/TO3pqe.jpg

Please help me to solve these confusions.

Thanks,

Mike


 0
answered on Jun 10, 2020 at 7:38am  

This is the modified version of the example code on Github:

var appKey = '...';
var appSecret = '...';
var appName = '...';
var appVersion = '...';

var sdk = new RingCentral.SDK({
    appKey: appKey,
    appSecret: appSecret,
    appName: appName,
    appVersion: appVersion,
    server: RingCentral.SDK.server.production // or .sandbox
});

var remoteVideoElement =  document.getElementById('remoteVideo');
var localVideoElement  = document.getElementById('localVideo');

var platform = sdk.platform();
platform.auth().setData(tokens)
if (platform.loggedIn()){
    platform.post('/client-info/sip-provision', {
          sipInfo: [{transport: 'WSS'}]
    })
    .then(function(res) { // Doing nested then because we need loginResponse in a simple way
        return new RingCentral.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
              },
              media:{
                  remote: remoteVideoElement,
                  local: localVideoElement
              },
              //to enable QoS Analytics Feature
              enableQos:true
          });

    })
    .then(function(webPhone){

        // YOUR CODE HERE
        
    })
}



 0
answered on Jun 8, 2020 at 6:52am  

To implement a Web phone using Javascript, use the RingCentral Web phone SDK.


 0



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us