question

Desh Weragoda avatar image
Desh Weragoda asked Tyler Liu answered

webPhone invitation session is terminated after Establishing state

I am working on angular project and want to intergrate Ringcentral.

I read this Readme file and implmented that.

Following is my code:

	var sdk = new RingCentral.SDK({
      clientId: environment.rc_clientId,
      clientSecret: environment.rc_clientSecret,
      appName: environment.rc_appName,
      // appVersion: appVersion,
      server: RingCentral.SDK.server.sandbox, // or .production
    });

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

    console.log('media elements', remoteVideoElement, localVideoElement)

    const platform = sdk.platform()
    console.log("platform", platform)
    platform.login({
      jwt: environment.rc_jwt
    }).then((rep) => rep.json()).then(loginResponse => {

      return platform
        .post('/restapi/v1.0/client-info/sip-provision', {
          sipInfo: [{ transport: 'WSS' }],
        }).then(resp => resp.json()).then(sipProvision => {
          console.log(loginResponse, sipProvision)
          return new RingCentral.WebPhone(sipProvision, {
            // optional
            clientId: environment.rc_clientId,
            appName: environment.rc_appName,
            uuid: loginResponse.endpoint_id,
            logLevel: 1, // error 0, warn 1, log: 2, debug: 3
            audioHelper: {
              enabled: true,
              incoming: 'path-to-audio/incoming.ogg', 
              outgoing: 'path-to-audio/outgoing.ogg',
            },
            media: {
              remote: remoteVideoElement,
              local: localVideoElement,
            },
            //to enable QoS Analytics Feature
            enableQos: true,
          });
        }).then((webPhone) => {
          console.log(webPhone);
          this.session = webPhone.userAgent.invite('+19703725396');
          console.log(this.session)
          this.session.stateChange.addListener(state => {
            console.log("session state", state)
          })
          webPhone.userAgent.on('invite', (session) => {
            session.accept().then(result=>{
              console.log('userAgent invitation accepted.', result)
            })
          })
        }).catch((webPhoneError: any) => {
          console.log(webPhoneError)
        })
    }).catch((errors: any) => {
      console.error(errors)
    })
	

This code didnt make call and the session of inviation of webPhone is terminated after Establising state.

What is this reason and how to fix. Please give me any tips.

Thank you.

ringoutsip
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Tyler Liu avatar image
Tyler Liu answered

Could you please reproduce the issue here https://ringcentral.github.io/ringcentral-web-phone/?

If yes, please kindly generate an HAR file. https://support.zendesk.com/hc/en-us/articles/4408828867098-Generating-a-HAR-file-for-troubleshooting

Once you've done, that, please create a ticket here and provide us with the HAR file.

https://developers.ringcentral.com/support/create-case

Our support team will get back to you as soon as possible.

In the mean time, you may also try to use app.ringcentral.com to make the same call. If you cannot, then it is probably because your account cannot make calls or the call is an international one.




1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys