2
0

freeswitch-video.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <html>
  2. <head>
  3. <META http-equiv="Content-Type" content="text/html;charset=utf-8"></META>
  4. <TITLE>FreeSWITCH Video Flash Phone Demo</TITLE>
  5. <script type="text/javascript" src="swfobject.js"></script>
  6. <script type="text/javascript" src="jquery.min.js"></script>
  7. <script type="text/javascript" charset="utf-8">
  8. var flashvars = {
  9. rtmp_url: 'rtmp://' + document.location.hostname + '/phone',
  10. local_loopback: 2, // x pos if local video
  11. buffer_time: 0,
  12. width: 640,
  13. height: 480,
  14. display_width: 640,
  15. display_height: 480
  16. };
  17. var params = {
  18. allowScriptAccess: 'always',
  19. wmode: 'window'
  20. };
  21. var current_uuid = "uuid";
  22. var flash;
  23. function log(msg) {
  24. if ('console' in window) console.log(msg);
  25. }
  26. function login() {
  27. flash.login($('#user').val(), '1234');
  28. }
  29. function register() {
  30. flash.register($('#user').val(), 'Test');
  31. }
  32. function unregister() {
  33. flash.register($('#user').val(), 'Test');
  34. }
  35. function makeCall() {
  36. flash.makeCall($('#dest').val(), '', {wantVideo: "true", incomingBandwidth: "1mb"});
  37. }
  38. function hangup() {
  39. flash.hangup(current_uuid);
  40. }
  41. function answer() {
  42. flash.answer(current_uuid);
  43. }
  44. function settings() {
  45. flash.showPrivacy();
  46. }
  47. function send_dtmf(digit) {
  48. flash.sendDTMF(digit, 2000);
  49. }
  50. function onDisplayUpdate(uuid, name, number){
  51. log("DisplayUpdate -- uuid: " + uuid + " name: " + name + " number: " + number);
  52. }
  53. function onCallState(uuid, state){
  54. log("CallState -- uuid: " + uuid + " state: " + state);
  55. $('#status').html(state);
  56. }
  57. function onIncomingCall(uuid, name, number, account, evt){
  58. log("IncomingCall -- uuid: " + uuid + " name: " + name + " number: " + number + " account: " + account);
  59. log(evt);
  60. if (current_uuid == "uuid") {
  61. var want_video = "";
  62. current_uuid = uuid;
  63. if (typeof(evt) === "object" && evt.want_video == "true") {
  64. want_video = " (Video)";
  65. }
  66. $('#incoming_call').html("Incoming call " + uuid + " from '" + name + "' <" + number + ">" + want_video);
  67. } else {
  68. $("#flash")[0].hangup(uuid);
  69. }
  70. }
  71. function onDisconnected(){
  72. log("socket disconnected");
  73. $('#status').html('Disconnected');
  74. $('#reconnect').show();
  75. }
  76. function onMakeCall(uuid, number, account){
  77. log("MakeCall -- uuid: " + uuid + " account: " + account + " number: " + number);
  78. current_uuid = uuid;
  79. }
  80. function onHangup(uuid, cause){
  81. log("Hangup -- uuid: " + uuid + " cause: " + cause);
  82. current_uuid = "uuid";
  83. $('#status').html("Hangup " + cause);
  84. }
  85. function onDebug(message){
  86. log("debug -- " + message);
  87. }
  88. function onAttach(uuid){
  89. log("Attach -- " + uuid);
  90. }
  91. function onConnected(session_id){
  92. log("Connected -- sessionid: " + session_id);
  93. $('#session_id').html(session_id);
  94. $('#status').html('Connected');
  95. $('#reconnect').hide();
  96. }
  97. function onLogin(status, user, domain){
  98. log("Login -- status: " + status + " user: " + user + " domain: " + domain);
  99. }
  100. function onLogout(user, domain){
  101. log("Logout -- user: " + user + " domain: " + domain);
  102. }
  103. function onInit(){console.log('initing...');}
  104. </script>
  105. </head>
  106. <body>
  107. <div id="dialpad" style="float:left;width:300px">
  108. <table border="1" cellspacing="5" cellpadding="5" width="200">
  109. <tr>
  110. <th colspan = 3>Flash Phone</th>
  111. </tr><tr>
  112. <td colspan = 3>
  113. <input type="text" name="x" value="9196" id="dest" size = "10">
  114. </td>
  115. </tr><tr>
  116. <td><input type="button" name="k7" value="7" id="k7" onclick="send_dtmf('7')"></td>
  117. <td><input type="button" name="k7" value="8" id="k7" onclick="send_dtmf('8')"></td>
  118. <td><input type="button" name="k7" value="9" id="k7" onclick="send_dtmf('9')"></td>
  119. </tr><tr>
  120. <td><input type="button" name="k7" value="4" id="k7" onclick="send_dtmf('4')"></td>
  121. <td><input type="button" name="k7" value="5" id="k7" onclick="send_dtmf('5')"></td>
  122. <td><input type="button" name="k7" value="6" id="k7" onclick="send_dtmf('6')"></td>
  123. </tr><tr>
  124. <td><input type="button" name="k7" value="1" id="k7" onclick="send_dtmf('1')"></td>
  125. <td><input type="button" name="k7" value="2" id="k7" onclick="send_dtmf('2')"></td>
  126. <td><input type="button" name="k7" value="3" id="k7" onclick="send_dtmf('3')"></td>
  127. </tr><tr>
  128. <td><input type="button" name="k7" value="*" id="k7" onclick="send_dtmf('*')"></td>
  129. <td><input type="button" name="k7" value="0" id="k7" onclick="send_dtmf('0')"></td>
  130. <td><input type="button" name="k7" value="#" id="k7" onclick="send_dtmf('#')"></td>
  131. </tr><tr>
  132. <td colspan="3">
  133. <span id="status">Ready</span>
  134. <span id="reconnect" style="display:none">
  135. <a href='#' onclick="flash.connect();return false;">Reconnect</a>
  136. </span>
  137. </td>
  138. </tr>
  139. </table>
  140. </div>
  141. <div>
  142. SessionID: <span id = "session_id"></span><br>
  143. Incoming: <span id = "incoming_call"></span>
  144. <br>
  145. <input type="text" name="user" value="1019@192.168.7.4" id="user">
  146. <input type="button" name="Call" value="Login" onclick = "login()" id="Login">
  147. <input type="button" name="Register" value="Register" onclick = "register()" id="Register">
  148. <input type="button" name="Register" value="UnRegister" onclick = "unregister()" id="UnRegister">
  149. <br>
  150. <input type="button" name="Call" value="Call" onclick = "makeCall()" id="Call">
  151. <input type="button" name="Call" value="Hangup" onclick = "hangup()" id="Hangup">
  152. <input type="button" name="some_name" value="Answer" id="some_name" onclick="answer()">
  153. <input type="button" name="some_name" value="Settings" id="some_name" onclick="settings()">
  154. </div>
  155. <div style="border:0px solid blue;float:left;padding:0px">
  156. <div id="flash">
  157. <h1>Alternative content</h1>
  158. <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
  159. </div>
  160. </div>
  161. <br style="clear:both">
  162. <script type="text/javascript" charset="utf-8">
  163. $(document).ready(function() {
  164. swfobject.embedSWF("freeswitch-h264.swf", "flash", "640", "480", "11.2.202.229", "expressInstall.swf", flashvars, params, []);
  165. flash = $('#flash')[0];
  166. $('#user').val("1000@" + window.location.hostname);
  167. });
  168. </script>
  169. </body>
  170. </html>