Guest User

Untitled

a guest
Jan 4th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. <script src="https://rawgit.com/onsip/SIP.js/0.8.0/dist/sip-0.8.0.js"></script>
  2.  
  3. <!--script src="sip-0.12.0.js"></script-->
  4.  
  5. <video id="remoteVideo"></video>
  6. <video id="localVideo" muted="muted"></video>
  7.  
  8. <script>
  9.  
  10. var options = {
  11. media: {
  12. constraints: {
  13. audio: true,
  14. video: true
  15. }
  16. }
  17. };
  18.  
  19. var userAgent = new SIP.UA({
  20. uri: 'brian@192.168.0.100',
  21. wsServers: ['wss://192.168.0.100:7443'],
  22. authorizationUser: 'brian',
  23. password: '1234',
  24. hackViaTcp: false,
  25. hackIpInContact: false,
  26. hackWssInTransport: false,
  27. hackAllowUnregisteredOptionTags: false,
  28. registrarServer: 'sip:192.168.0.100',
  29. register: true,
  30. });
  31.  
  32. userAgent.on("connected", function() {
  33.  
  34. console.log("Connected $$$$$$$$$$$$$$$$$$$$$$$$");
  35.  
  36. var options = {
  37. 'extraHeaders': [ 'X-Foo: foo', 'X-Bar: bar' ]
  38. };
  39.  
  40. userAgent.register(options);
  41.  
  42. });
  43.  
  44. userAgent.on("registered", function() {
  45.  
  46. console.warn("Register $$$$");
  47.  
  48.  
  49. // session = userAgent.invite('sip:1002@192.168.0.100', options);
  50.  
  51. });
  52.  
  53. userAgent.on('invite', function (session) {
  54.  
  55. console.warn("invite $$$$");
  56.  
  57. session.accept({
  58. media: {
  59. render: {
  60. remote: {
  61. video: document.getElementById('remoteVideo')
  62. },
  63. local: {
  64. video: document.getElementById('localVideo')
  65. }
  66. }
  67. }
  68. });
  69. });
  70. </script>
Add Comment
Please, Sign In to add comment