Advertisement
Guest User

Untitled

a guest
Jun 26th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. var RingCentral = require('ringcentral')
  2. var WebPhone = require('ringcentral-web-phone')
  3. var appKey = '...';
  4. var appSecret = '...';
  5. var appName = '...';
  6. var appVersion = '...';
  7.  
  8. var sdk = new RingCentral({
  9. appKey: appKey,
  10. appSecret: appSecret,
  11. appName: appName,
  12. appVersion: appVersion,
  13. server: RingCentral.server.production // or .sandbox
  14. });
  15.  
  16. var platform = sdk.platform();
  17.  
  18. platform
  19. .login({
  20. username: '...',
  21. password: '...'
  22. })
  23. .then(function(loginResponse) {
  24.  
  25. return platform
  26. .post('/client-info/sip-provision', {
  27. sipInfo: [{transport: 'WSS'}]
  28. })
  29. .then(function(res) {
  30.  
  31. return new WebPhone(res.json(), { // optional
  32. appKey: appKey,
  33. appName: appName,
  34. appVersion: appVersion,
  35. uuid: loginResponse.json().endpoint_id,
  36. logLevel: 1, // error 0, warn 1, log: 2, debug: 3
  37. audioHelper: {
  38. enabled: true, // enables audio feedback when web phone is ringing or making a call
  39. incoming: 'path-to-audio/incoming.ogg', // path to audio file for incoming call
  40. outgoing: 'path-to-audio/outgoing.ogg' // path to aduotfile for outgoing call
  41. }
  42. });
  43.  
  44. });
  45.  
  46. })
  47. .then(function(webPhone){
  48.  
  49. // YOUR CODE HERE
  50.  
  51. })
  52. .catch(function(e){
  53. console.error(e.stack);
  54. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement