소스 검색

created a basic webrtc app (#28)

* WebRTC app

See Install.rst for more info

* Update Install.rst

* Create placeholder.css

* Create placeholder.js

* Update Install.rst

* Update webrtc.php

* Update Install.rst

* Update code

* Update webrtc.php

* Update webrtc.php

* Update webrtc.php

* Update Install.rst

* Delete placeholder.css

* Delete placeholder.js

* image add

* Update Install.rst

* Update webrtc.php

* update

* auto login with the user's information.

* updated code

* Update high.js
Len 9 년 전
부모
커밋
e30f5ea6ea
12개의 변경된 파일1033개의 추가작업 그리고 0개의 파일을 삭제
  1. 42 0
      webrtc/Install.rst
  2. 62 0
      webrtc/app_config.php
  3. 198 0
      webrtc/app_languages.php
  4. 10 0
      webrtc/app_menu.php
  5. 13 0
      webrtc/css/bootstrap.min.css
  6. BIN
      webrtc/css/webrtc_fusionpbx.jpg
  7. 256 0
      webrtc/high.js
  8. 23 0
      webrtc/js/jquery.json-2.4.min.js
  9. 1 0
      webrtc/js/jquery.min.js
  10. 229 0
      webrtc/js/verto-min.js
  11. 50 0
      webrtc/root.php
  12. 149 0
      webrtc/webrtc.php

+ 42 - 0
webrtc/Install.rst

@@ -0,0 +1,42 @@
+*********
+WebRTC
+*********
+
+WebRTC app for FusionPBX is made by editing an existing FusionPBX app code and adding the code from the "Master FreeSWITCH code example".  Also, keep in mind that you will need ssl certs working on the server.
+
+.. image:: https://github.com/Len-PGH/fusionpbx-apps/blob/master/webrtc/css/webrtc_fusionpbx.jpg
+        :scale: 50%
+
+**Note**
+~~~~~~~~~
+ 
+There are two "sets" of code in this app. One being an existing app from FusionPBX and the code example from "Master FreeSWITCH" book.
+
+Prerequisites
+^^^^^^^^^^^^^^
+
+* Working install of FusionPBX
+* Working set of SSL certs (Not self signed) on said install of FusionPBX
+* Working mod_verto setup.
+* Patience
+
+
+Install Steps
+^^^^^^^^^^^^^^
+
+On your server
+
+::
+
+  cd /usr/src
+  git clone https://github.com/fusionpbx/fusionpbx-apps
+  Move the directory 'webrtc' into your main FusionPBX directory
+  mv fusionpbx-apps/webrtc /var/www/fusionpbx/app
+  chown -R www-data:www-data /var/www/fusionpbx/app/webrtc
+
+::
+
+ Log into the FusionPBX webpage
+ Advanced -> Upgrade
+ Menu Defaults and Permission Defaults.
+ Log out and back in.

+ 62 - 0
webrtc/app_config.php

@@ -0,0 +1,62 @@
+<?php
+	//application details
+		$apps[$x]['name'] = 'WebRTC';
+		$apps[$x]['uuid'] = 'd8b0a50b-abf3-49db-b396-b1af8a700c88';
+		$apps[$x]['category'] = 'WebRTC';
+		$apps[$x]['subcategory'] = 'Launch vPhone';
+		$apps[$x]['version'] = '1.0';
+		$apps[$x]['license'] = 'Mozilla Public License 1.1';
+		$apps[$x]['url'] = 'http://www.fusionpbx.com';
+		$apps[$x]['description']['en-us'] = '';
+
+	//permission details
+		$y = 0;
+		$apps[$x]['permissions'][$y]['name'] = 'webrtc';
+		$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
+		//$apps[$x]['permissions'][$y]['groups'][] = 'user';
+		//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
+		$y++;
+
+	//schema details
+		$y = 0; //table array index
+		$z = 0; //field array index
+		$apps[$x]['db'][$y]['table'] = 'v_webrtc';
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'webrtc_uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'webrtc_name';
+		$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the name.';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'webrtc_type';
+		$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Select the type.';
+		$z++;
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'webrtc_description';
+		$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the description';
+		$z++;
+
+		$y = 1; //table array index
+		$z = 0; //field array index
+		$apps[$x]['db'][$y]['table'] = 'v_webrtc';
+		$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
+		$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
+		$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
+		$z++;
+?>

+ 198 - 0
webrtc/app_languages.php

@@ -0,0 +1,198 @@
+<?php
+$text['label-update-complete']['en-us'] = "Update Complete";
+$text['label-update-complete']['es-cl'] = "Actualización Completa";
+$text['label-update-complete']['pt-pt'] = "Actualização Efectuada";
+$text['label-update-complete']['fr-fr'] = "Mise à jour effectuée";
+$text['label-update-complete']['nl-nl'] = "";
+$text['label-update-complete']['pt-br'] = "Atualização efetuada";
+$text['label-update-complete']['pl'] = "Zaktualizowano poprawnie";
+$text['label-update-complete']['sv-se'] = "Uppdatering Klar";
+$text['label-update-complete']['uk'] = "Оновлено";
+$text['label-update-complete']['ro'] = "Actualizare completă";
+$text['label-update-complete']['de-at'] = "Aktualisierung abgeschlossen";
+$text['label-update-complete']['ar-eg'] = "اكتمال التحديث";
+$text['label-update-complete']['he'] = "העדכון הושלם";
+
+$text['label-true']['en-us'] = "True";
+$text['label-true']['es-cl'] = "Verdadero";
+$text['label-true']['pt-pt'] = "Sim";
+$text['label-true']['fr-fr'] = "Oui";
+$text['label-true']['nl-nl'] = "";
+$text['label-true']['pt-br'] = "Sim";
+$text['label-true']['pl'] = "Tak";
+$text['label-true']['sv-se'] = "Sann";
+$text['label-true']['uk'] = "Так";
+$text['label-true']['ro'] = "";
+$text['label-true']['de-at'] = "Ein";
+$text['label-true']['ar-eg'] = "صحيح";
+$text['label-true']['he'] = "חיובי";
+
+$text['label-reject']['en-us'] = "Reject";
+$text['label-reject']['es-cl'] = "Rechazar";
+$text['label-reject']['pt-pt'] = "Rejeitar";
+$text['label-reject']['fr-fr'] = "Rejeter";
+$text['label-reject']['nl-nl'] = "";
+$text['label-reject']['pt-br'] = "Rejeitar";
+$text['label-reject']['pl'] = "Odrzuć ";
+$text['label-reject']['sv-se'] = "Neka";
+$text['label-reject']['uk'] = "Відхилити";
+$text['label-reject']['ro'] = "";
+$text['label-reject']['de-at'] = "Zurückweisen";
+$text['label-reject']['ar-eg'] = "رفض";
+$text['label-reject']['he'] = "לדחות";
+
+$text['label-false']['en-us'] = "False";
+$text['label-false']['es-cl'] = "falso";
+$text['label-false']['pt-pt'] = "Não";
+$text['label-false']['fr-fr'] = "Non";
+$text['label-false']['nl-nl'] = "";
+$text['label-false']['pt-br'] = "Não";
+$text['label-false']['pl'] = "Nie";
+$text['label-false']['sv-se'] = "Falsk";
+$text['label-false']['uk'] = "Ні";
+$text['label-false']['ro'] = "";
+$text['label-false']['de-at'] = "Aus";
+$text['label-false']['ar-eg'] = "";
+$text['label-false']['he'] = "";
+
+$text['label-enabled']['en-us'] = "Enabled";
+$text['label-enabled']['es-cl'] = "Activo";
+$text['label-enabled']['pt-pt'] = "Activado";
+$text['label-enabled']['fr-fr'] = "Actif";
+$text['label-enabled']['nl-nl'] = "";
+$text['label-enabled']['pt-br'] = "Habilitado";
+$text['label-enabled']['pl'] = "Włączony";
+$text['label-enabled']['sv-se'] = "Aktiverad";
+$text['label-enabled']['uk'] = "Включено";
+$text['label-enabled']['ro'] = "";
+$text['label-enabled']['de-at'] = "Aktiv";
+$text['label-enabled']['ar-eg'] = "مفعل";
+$text['label-enabled']['he'] = "";
+
+$text['label-delete-complete']['en-us'] = "Delete Complete";
+$text['label-delete-complete']['es-cl'] = "Eliminar Completo";
+$text['label-delete-complete']['pt-pt'] = "Remoção Efectuada";
+$text['label-delete-complete']['fr-fr'] = "Supprimé";
+$text['label-delete-complete']['nl-nl'] = "";
+$text['label-delete-complete']['pt-br'] = "Remoção efetuada";
+$text['label-delete-complete']['pl'] = "Usunięto poprawnie";
+$text['label-delete-complete']['sv-se'] = "Borttagning Klar";
+$text['label-delete-complete']['uk'] = "Видалено";
+$text['label-delete-complete']['ro'] = "Ștergere completă";
+$text['label-delete-complete']['de-at'] = "Erfolgreich gelöscht";
+$text['label-delete-complete']['ar-eg'] = "اكتمال المسح";
+$text['label-delete-complete']['he'] = "המחיקה הושלמה";
+
+$text['label-action']['en-us'] = "Action";
+$text['label-action']['es-cl'] = "Acción";
+$text['label-action']['pt-pt'] = "Acção";
+$text['label-action']['fr-fr'] = "Action";
+$text['label-action']['nl-nl'] = "";
+$text['label-action']['pt-br'] = "Ação";
+$text['label-action']['pl'] = "Operacja";
+$text['label-action']['sv-se'] = "Åtgärd";
+$text['label-action']['uk'] = "Дія";
+$text['label-action']['ro'] = "Acțiune";
+$text['label-action']['de-at'] = "Aktion";
+$text['label-action']['ar-eg'] = "";
+$text['label-action']['he'] = "פעולה";
+
+$text['confirm-delete']['en-us'] = "Do you really want to delete this?";
+$text['confirm-delete']['es-cl'] = "¿Realmente desea eliminar el número?";
+$text['confirm-delete']['pt-pt'] = "Deseja realmente remover isto?";
+$text['confirm-delete']['fr-fr'] = "Voulez-vous vraiment supprimer cela?";
+$text['confirm-delete']['nl-nl'] = "";
+$text['confirm-delete']['pt-br'] = "Deseja realmente remover isto?";
+$text['confirm-delete']['pl'] = "Czy na pewno chcesz to usunąć?";
+$text['confirm-delete']['sv-se'] = "Vill du verkligen ta bort detta?";
+$text['confirm-delete']['uk'] = "Ви дійсно бажаєте це видалити?";
+$text['confirm-delete']['ro'] = "";
+$text['confirm-delete']['de-at'] = "Wollen Sie das wirklich löschen?";
+$text['confirm-delete']['ar-eg'] = "";
+$text['confirm-delete']['he'] = "?בטוח שאתה רוצה למחוק";
+
+$text['button-view']['en-us'] = "View";
+$text['button-view']['es-cl'] = "Ver";
+$text['button-view']['pt-pt'] = "Vista";
+$text['button-view']['fr-fr'] = "Voir";
+$text['button-view']['nl-nl'] = "";
+$text['button-view']['pt-br'] = "Visualizar";
+$text['button-view']['pl'] = "Widok";
+$text['button-view']['sv-se'] = "Visa";
+$text['button-view']['uk'] = "Перегляд";
+$text['button-view']['ro'] = "Vizualizare";
+$text['button-view']['de-at'] = "Ansicht";
+$text['button-view']['ar-eg'] = "عرض";
+$text['button-view']['he'] = "הצג";
+
+$text['button-save']['en-us'] = "Save";
+$text['button-save']['es-cl'] = "Guardar";
+$text['button-save']['pt-pt'] = "Guardar";
+$text['button-save']['fr-fr'] = "Sauvegarder";
+$text['button-save']['nl-nl'] = "";
+$text['button-save']['pt-br'] = "Salvar";
+$text['button-save']['pl'] = "Zachowaj";
+$text['button-save']['sv-se'] = "Spara";
+$text['button-save']['uk'] = "Зберегти";
+$text['button-save']['ro'] = "Salvează";
+$text['button-save']['de-at'] = "Speichern";
+$text['button-save']['ar-eg'] = "حفظ";
+$text['button-save']['he'] = "שמור";
+
+$text['button-edit']['en-us'] = "Edit";
+$text['button-edit']['es-cl'] = "Editar";
+$text['button-edit']['pt-pt'] = "Editar";
+$text['button-edit']['fr-fr'] = "Editer";
+$text['button-edit']['nl-nl'] = "";
+$text['button-edit']['pt-br'] = "Editar";
+$text['button-edit']['pl'] = "Edytuj";
+$text['button-edit']['sv-se'] = "Editera";
+$text['button-edit']['uk'] = "Редагувати";
+$text['button-edit']['ro'] = "Editează";
+$text['button-edit']['de-at'] = "Bearbeiten";
+$text['button-edit']['ar-eg'] = "تعديل";
+$text['button-edit']['he'] = "ערוך";
+
+$text['button-delete']['en-us'] = "Delete";
+$text['button-delete']['es-cl'] = "Eliminar";
+$text['button-delete']['pt-pt'] = "Remover";
+$text['button-delete']['fr-fr'] = "Supprimer";
+$text['button-delete']['nl-nl'] = "";
+$text['button-delete']['pt-br'] = "Remover";
+$text['button-delete']['pl'] = "Usuń";
+$text['button-delete']['sv-se'] = "Ta Bort";
+$text['button-delete']['uk'] = "Видалити";
+$text['button-delete']['ro'] = "";
+$text['button-delete']['de-at'] = "Löschen";
+$text['button-delete']['ar-eg'] = "مسح";
+$text['button-delete']['he'] = "מחק";
+
+$text['button-back']['en-us'] = "Back";
+$text['button-back']['es-cl'] = "Volver";
+$text['button-back']['pt-pt'] = "Voltar";
+$text['button-back']['fr-fr'] = "Retour";
+$text['button-back']['nl-nl'] = "";
+$text['button-back']['pt-br'] = "Voltar";
+$text['button-back']['pl'] = "Wróć";
+$text['button-back']['sv-se'] = "Tillbaka";
+$text['button-back']['uk'] = "Назад";
+$text['button-back']['ro'] = "Înapoi";
+$text['button-back']['de-at'] = "Zurück";
+$text['button-back']['ar-eg'] = "رجوع";
+$text['button-back']['he'] = "חזרה";
+
+$text['button-add']['en-us'] = "Add";
+$text['button-add']['pt-pt'] = "Adicionar";
+$text['button-add']['fr-fr'] = "Ajouter";
+$text['button-add']['nl-nl'] = "";
+$text['button-add']['pt-br'] = "Adicionar";
+$text['button-add']['pl'] = "Dodaj";
+$text['button-add']['sv-se'] = "Lägg Till";
+$text['button-add']['uk'] = "Додати";
+$text['button-add']['ro'] = "Adaugă";
+$text['button-add']['de-at'] = "Hinzufügen";
+$text['button-add']['ar-eg'] = "اضافة";
+$text['button-add']['he'] = "";
+
+?>
+

+ 10 - 0
webrtc/app_menu.php

@@ -0,0 +1,10 @@
+<?php
+
+	$apps[$x]['menu'][0]['title']['en-us'] = 'WebRTC';
+	$apps[$x]['menu'][0]['uuid'] = '0044c532-07ca-477f-aa2d-920ee58e100b';
+	$apps[$x]['menu'][0]['parent_uuid'] = 'fd29e39c-c936-f5fc-8e2b-611681b266b5';
+	$apps[$x]['menu'][0]['category'] = 'internal';
+	$apps[$x]['menu'][0]['path'] = '/app/webrtc/webrtc.php';
+	$apps[$x]['menu'][0]['groups'][] = 'superadmin';
+
+?>

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 13 - 0
webrtc/css/bootstrap.min.css


BIN
webrtc/css/webrtc_fusionpbx.jpg


+ 256 - 0
webrtc/high.js

@@ -0,0 +1,256 @@
+'use strict';
+var cur_call = null;
+var verto;
+var chatting_with = false;
+
+var callbacks = {
+ onMessage: function(verto, dialog, msg, data) {
+  console.error("msg ", msg);
+  console.error("data ", data);
+  switch (msg) {
+   case $.verto.enum.message.pvtEvent:
+    if (data.pvtData) {
+     console.error("data.pvtData ", data.pvtData);
+     switch (data.pvtData.action) {
+      case "conference-liveArray-join":
+       chatting_with = data.pvtData.chatID;
+       $("#content").hide();
+       $("#ask").hide();
+       $("#br").hide();
+       $("#backbtn").hide();
+       $("#ext").hide();
+       $("#extbtn").hide();
+       $("#callbtn").hide();
+       $("#cidname").hide();
+       $("#hupbtn").show();
+       $("#chatwin").show();
+       $("#chatmsg").show();
+       $("#chatsend").show();
+       $("#webcam").show();
+       $("#video1").show();
+       break;
+      case "conference-liveArray-part":
+       $("#content").show();
+       $("#ask").show();
+       $("#ext").show();
+       $("#extbtn").show();
+       $("#cidname").hide();
+       $("#callbtn").hide();
+       $("#hupbtn").hide();
+       $("#chatwin").hide();
+       $("#chatmsg").hide();
+       $("#chatsend").hide();
+       $("#backbtn").hide();
+       $("#webcam").hide();
+       $("#video1").hide();
+       cur_call = null;
+       break;
+     }
+    }
+    break;
+   case $.verto.enum.message.info:
+    var body = data.body;
+    var from = data.from_msg_name || data.from;
+
+    if (body.slice(-1) !== "\n") {
+     body += "\n";
+    }
+    $('#chatwin')
+     .append(from + ': ')
+     .append(body)
+     $('#chatwin').animate({"scrollTop": $('#chatwin')[0].scrollHeight}, "fast");
+    break;
+   default:
+    break;
+  }
+ },
+ onEvent: function(v, e) {
+  console.error("GOT EVENT", e);
+ },
+ onDialogState: function(d) {
+  if (!cur_call) {
+   cur_call = d;
+  }
+  switch (d.state) {
+   case $.verto.enum.state.hangup:
+    $("#content").show();
+    $("#ask").show();
+    $("#ext").show();
+    $("#extbtn").show();
+    $("#cidname").hide();
+    $("#callbtn").hide();
+    $("#hupbtn").hide();
+    $("#chatwin").hide();
+    $("#chatmsg").hide();
+    $("#chatsend").hide();
+    $("#backbtn").hide();
+    $("#webcam").hide();
+    $("#video1").hide();
+    cur_call = null;
+    console.error("HANGUP");
+    break;
+
+   case $.verto.enum.state.destroy:
+    $("#content").show();
+    $("#ask").show();
+    $("#ext").show();
+    $("#extbtn").show();
+    $("#cidname").hide();
+    $("#callbtn").hide();
+    $("#hupbtn").hide();
+    $("#chatwin").hide();
+    $("#chatmsg").hide();
+    $("#chatsend").hide();
+    $("#backbtn").hide();
+    $("#webcam").hide();
+    $("#video1").hide();
+    cur_call = null;
+    console.error("DESTROY");
+    break;
+   case $.verto.enum.state.active:
+    $("#content").hide();
+    $("#ask").hide();
+    $("#br").hide();
+    $("#backbtn").hide();
+    $("#ext").hide();
+    $("#extbtn").hide();
+    $("#callbtn").hide();
+    $("#cidname").hide();
+    $("#hupbtn").show();
+    $("#chatwin").show();
+    $("#chatmsg").show();
+    $("#chatsend").show();
+    $("#webcam").show();
+    $("#video1").show();
+    console.error("ACTIVE");
+    break;
+   default:
+    break;
+  }
+ },
+};
+
+function docall() {
+ if (cur_call) {
+  return;
+ }
+ cur_call = verto.newCall({
+  destination_number: $("#ext").val(),
+  caller_id_name: $("#cidname").val(),
+  caller_id_number: $("#cidnumber").val(),
+  useVideo: true,
+  useStereo: false,
+  useCamera: $("#usecamera").find(":selected").val(),
+  useMic: $("#usemic").find(":selected").val()
+ });
+}
+
+$("#callbtn").click(function() {
+ if($("#cidname").val() ){
+  docall();
+ }
+});
+
+$("#hupbtn").click(function() {
+ verto.hangup();
+ cur_call = null;
+});
+
+$("#extbtn").click(function() {
+ if($("#ext").val()){
+  $("#ext").hide();
+  $("#extbtn").hide();
+  $("#cidname").show();
+  $("#callbtn").show();
+  $("#backbtn").show();
+  $("#cidname").focus();
+  $("#br").show();
+ }
+});
+
+$("#backbtn").click(function() {
+ $("#ext").show();
+ $("#extbtn").show();
+ $("#cidname").hide();
+ $("#callbtn").hide();
+ $("#hupbtn").hide();
+ $("#chatwin").hide();
+ $("#chatmsg").hide();
+ $("#chatsend").hide();
+ $("#backbtn").hide();
+ cur_call = null;
+
+});
+
+function setupChat() {
+ $("#chatwin").html("");
+
+ $("#chatsend").click(function() {
+  if (!cur_call && chatting_with) {
+   return;
+  }
+  cur_call.message({to: chatting_with,
+   body: $("#chatmsg").val(),
+   from_msg_name: cur_call.params.caller_id_name,
+   from_msg_number: cur_call.params.caller_id_number
+  });
+  $("#chatmsg").val("");
+ });
+
+ $("#chatmsg").keyup(function (event) {
+  if (event.keyCode == 13 && !event.shiftKey) {
+   $( "#chatsend" ).trigger( "click" );
+  }
+ });
+}
+
+function init() {
+ cur_call = null;
+
+ verto = new $.verto({
+  login: $("#login").val() + "@" + $("#hostName").val(),
+  passwd: $("#passwd").val(),
+  socketUrl: $("#wsURL").val(),
+  tag: "webcam",
+  iceServers: true
+ },callbacks);
+
+ $("#ext").keyup(function (event) {
+  if (event.keyCode == 13 && !event.shiftKey) {
+   $( "#extbtn" ).trigger( "click" );
+  }
+ });
+
+ $("#cidname").keyup(function (event) {
+  if (event.keyCode == 13 && !event.shiftKey) {
+   $( "#callbtn" ).trigger( "click" );
+  }
+ });
+
+ $(document).keypress(function(event) {
+  var key = String.fromCharCode(event.keyCode || event.charCode);
+  var i = parseInt(key);
+
+  if (key === "#" || key === "*" || key === "0" || (i > 0 && i <= 9)) {
+   cur_call.dtmf(key);
+  }
+ });
+
+ setupChat();
+}
+
+$(window).load(function() {
+ cur_call = null;
+ $("#conference").show();
+ $("#backbtn").hide();
+ $("#cidname").hide();
+ $("#callbtn").hide();
+ $("#hupbtn").hide();
+ $("#chatwin").hide();
+ $("#chatmsg").hide();
+ $("#chatsend").hide();
+ $("#webcam").hide();
+ $("#video1").hide();
+ init();
+});
+

+ 23 - 0
webrtc/js/jquery.json-2.4.min.js

@@ -0,0 +1,23 @@
+/*! jQuery JSON plugin 2.4.0 | code.google.com/p/jquery-json */
+(function($){'use strict';var escape=/["\\\x00-\x1f\x7f-\x9f]/g,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},hasOwn=Object.prototype.hasOwnProperty;$.toJSON=typeof JSON==='object'&&JSON.stringify?JSON.stringify:function(o){if(o===null){return'null';}
+var pairs,k,name,val,type=$.type(o);if(type==='undefined'){return undefined;}
+if(type==='number'||type==='boolean'){return String(o);}
+if(type==='string'){return $.quoteString(o);}
+if(typeof o.toJSON==='function'){return $.toJSON(o.toJSON());}
+if(type==='date'){var month=o.getUTCMonth()+1,day=o.getUTCDate(),year=o.getUTCFullYear(),hours=o.getUTCHours(),minutes=o.getUTCMinutes(),seconds=o.getUTCSeconds(),milli=o.getUTCMilliseconds();if(month<10){month='0'+month;}
+if(day<10){day='0'+day;}
+if(hours<10){hours='0'+hours;}
+if(minutes<10){minutes='0'+minutes;}
+if(seconds<10){seconds='0'+seconds;}
+if(milli<100){milli='0'+milli;}
+if(milli<10){milli='0'+milli;}
+return'"'+year+'-'+month+'-'+day+'T'+
+hours+':'+minutes+':'+seconds+'.'+milli+'Z"';}
+pairs=[];if($.isArray(o)){for(k=0;k<o.length;k++){pairs.push($.toJSON(o[k])||'null');}
+return'['+pairs.join(',')+']';}
+if(typeof o==='object'){for(k in o){if(hasOwn.call(o,k)){type=typeof k;if(type==='number'){name='"'+k+'"';}else if(type==='string'){name=$.quoteString(k);}else{continue;}
+type=typeof o[k];if(type!=='function'&&type!=='undefined'){val=$.toJSON(o[k]);pairs.push(name+':'+val);}}}
+return'{'+pairs.join(',')+'}';}};$.evalJSON=typeof JSON==='object'&&JSON.parse?JSON.parse:function(str){return eval('('+str+')');};$.secureEvalJSON=typeof JSON==='object'&&JSON.parse?JSON.parse:function(str){var filtered=str.replace(/\\["\\\/bfnrtu]/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,'');if(/^[\],:{}\s]*$/.test(filtered)){return eval('('+str+')');}
+throw new SyntaxError('Error parsing JSON, source is not valid.');};$.quoteString=function(str){if(str.match(escape)){return'"'+str.replace(escape,function(a){var c=meta[a];if(typeof c==='string'){return c;}
+c=a.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16);})+'"';}
+return'"'+str+'"';};}(jQuery));

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 0
webrtc/js/jquery.min.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 229 - 0
webrtc/js/verto-min.js


+ 50 - 0
webrtc/root.php

@@ -0,0 +1,50 @@
+<?php
+/*
+	FusionPBX
+	Version: MPL 1.1
+
+	The contents of this file are subject to the Mozilla Public License Version
+	1.1 (the "License"); you may not use this file except in compliance with
+	the License. You may obtain a copy of the License at
+	http://www.mozilla.org/MPL/
+
+	Software distributed under the License is distributed on an "AS IS" basis,
+	WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+	for the specific language governing rights and limitations under the
+	License.
+
+	The Original Code is FusionPBX
+
+	The Initial Developer of the Original Code is
+	Mark J Crane <[email protected]>
+	Portions created by the Initial Developer are Copyright (C) 2008-2014
+	the Initial Developer. All Rights Reserved.
+
+	Contributor(s):
+	Mark J Crane <[email protected]>
+*/
+
+// make sure the PATH_SEPARATOR is defined
+	if (!defined("PATH_SEPARATOR")) {
+		if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); }
+	}
+
+// make sure the document_root is set
+	$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
+	$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
+	$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
+	//echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."<br />\n";
+	//echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."<br />\n";
+	//echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."<br />\n";
+
+// if the project directory exists then add it to the include path otherwise add the document root to the include path
+	if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){
+		if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); }
+		set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' );
+	}
+	else {
+		if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); }
+		set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
+	}
+
+?>

+ 149 - 0
webrtc/webrtc.php

@@ -0,0 +1,149 @@
+<?php
+/*
+	FusionPBX
+	Version: MPL 1.1
+
+	The contents of this file are subject to the Mozilla Public License Version
+	1.1 (the "License"); you may not use this file except in compliance with
+	the License. You may obtain a copy of the License at
+	http://www.mozilla.org/MPL/
+
+	Software distributed under the License is distributed on an "AS IS" basis,
+	WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+	for the specific language governing rights and limitations under the
+	License.
+
+	The Original Code is FusionPBX
+
+	The Initial Developer of the Original Code is
+	Mark J Crane <[email protected]>
+	Portions created by the Initial Developer are Copyright (C) 2008-2012
+	the Initial Developer. All Rights Reserved.
+
+	Contributor(s):
+	Mark J Crane <[email protected]>
+	Giovanni Maruzzelli <[email protected]>
+	Len Graham <[email protected]>
+*/
+
+//includes
+	require_once "root.php";
+	require_once "resources/require.php";
+
+//check permissions
+	require_once "resources/check_auth.php";
+	if (permission_exists('webrtc')) {
+		//access granted
+	}
+	else {
+		echo "access denied";
+		exit;
+	}
+
+//add multi-lingual support
+	$language = new text;
+	$text = $language->get();
+
+//get variables used to control the order
+	$order_by = $_GET["order_by"];
+	$order = $_GET["order"];
+
+//additional includes
+	require_once "resources/header.php";
+	require_once "resources/paging.php";
+
+	echo "  <meta charset=\"utf-8\">\n"; 
+	echo "  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n"; 
+	echo "  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n"; 
+	echo "  <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->\n"; 
+	echo "  <meta name=\"description\" content=\"A WebRTC client for Verto FreeSWITCH module\">\n"; 
+	echo "  <meta name=\"author\" content=\"Giovanni Maruzzelli\">\n"; 
+	echo "  <link rel=\"icon\" href=\"favicon.ico\">\n"; 
+	echo "  <!-- Bootstrap core CSS -->\n"; 
+	echo "  <link href=\"css/bootstrap.min.css\" rel=\"stylesheet\">\n"; 
+	echo "  <!-- Custom styles for this template -->\n"; 
+	//echo "  <link href=\"high.css\" rel=\"stylesheet\">\n"; 
+
+//prepare to page the results
+	$sql = "select count(*) as num_rows from v_webrtc ";
+	if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
+	$prep_statement = $db->prepare($sql);
+	if ($prep_statement) {
+		$prep_statement->execute();
+		$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
+		if ($row['num_rows'] > 0) {
+				$num_rows = $row['num_rows'];
+		}
+		else {
+				$num_rows = '0';
+		}
+	}
+
+//prepare to page the results
+	$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
+	$param = "";
+	$page = $_GET['page'];
+	if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
+	list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
+	$offset = $rows_per_page * $page;
+
+//get the user ID
+	$sql = "SELECT extension,v_extensions.password,effective_caller_id_name FROM ";
+	$sql .= "v_extension_users, v_extensions, v_users ";
+	$sql .= "WHERE v_users.user_uuid = v_extension_users.user_uuid ";
+	$sql .= "AND v_extensions.extension_uuid = v_extension_users.extension_uuid ";
+	$sql .= "AND v_users.user_uuid = '" . $_SESSION['user_uuid'] . "' ";
+	$sql .= "AND v_extensions.domain_uuid = '" . $_SESSION["domain_uuid"] . "' LIMIT 1";
+	
+	$prep_statement = $db->prepare($sql);
+	if ($prep_statement) {
+		$prep_statement->execute();
+		$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
+		$user_extension = $row['extension'];
+		$user_password = $row['password'];
+		$effective_caller_id_name = $row['effective_caller_id_name'];
+	}
+
+echo "  <div id=\"conference\">\n"; 
+echo "   <input type=\"hidden\" id=\"hostName\" value=\"" . $_SESSION['domain_name'] . "\"/>\n"; 
+echo "   <input type=\"hidden\" id=\"wsURL\" value=\"wss://" . $_SESSION['domain_name'] . ":8082\"/>\n"; 
+echo "   <input type=\"hidden\" id=\"login\" value=\"" . $user_extension . "\"/>\n"; 
+echo "   <input type=\"hidden\" id=\"passwd\" value=\"" . $user_password . "\"/>\n"; 
+echo "   <input type=\"hidden\" id=\"cidnumber\" value=\"" . $effective_caller_id_name . "\"/>\n"; 
+echo "   <div class=\"form-signin\">\n"; 
+echo "    <h2 class=\"form-signin-heading\">" . $_SESSION['theme']['webrtc_title']['text'] . "</h2>\n"; 
+echo "    <div id=\"content\" class=\"form-signin-content\">\n"; 
+echo "     <input type=number id=\"ext\" min=3000 max=3999 step=1 class=\"form-control\"\n"; 
+echo "	placeholder=\"Conference Number ? (eg: 3000)\" required autofocus>\n"; 
+echo "     <button class=\"btn btn-lg btn-primary btn-success\" data-inline=\"true\"\n"; 
+echo "	id=\"extbtn\">Choose Room</button>\n"; 
+echo "     <input type=\"text\" id=\"cidname\" class=\"form-control\"\n"; 
+echo "	placeholder=\"insert here your NAME (eg: Squidward)\" required autofocus>\n"; 
+echo "     <button class=\"btn btn-lg btn-primary btn-success\" data-inline=\"true\"\n"; 
+echo "	id=\"callbtn\">Call Conference</button>\n"; 
+echo "     <button class=\"btn btn-lg btn-primary btn-danger\" data-inline=\"true\"\n"; 
+echo "	id=\"backbtn\">Back</button>\n"; 
+echo "    </div>\n"; 
+echo "    <div id=\"video1\" align=\"center\" class=\"embed-responsive embed-responsive-4by3\">\n"; 
+echo "     <video id=\"webcam\" autoplay=\"autoplay\" class=\"embed-responsive-item\"> </video>\n"; 
+echo "    </div>\n"; 
+echo "    <button class=\"btn btn-lg btn-primary btn-danger\" data-inline=\"true\"\n"; 
+echo "	id=\"hupbtn\">Hangup</button>\n"; 
+echo "    <br id=\"br\"/>\n"; 
+echo "    <textarea id=\"chatwin\" class=\"form-control\" rows=\"5\" readonly></textarea>\n"; 
+echo "    <br id=\"br\"/>\n"; 
+echo "    <textarea id=\"chatmsg\" class=\"form-control\" rows=\"1\"\n"; 
+echo "	placeholder=\"type here your chat msg\" autofocus></textarea>\n"; 
+echo "    <button class=\"btn btn-primary btn-success\" data-inline=\"true\"\n"; 
+echo "	id=\"chatsend\">Send Msg</button>\n"; 
+echo "   </div>\n"; 
+echo "  </div>\n"; 
+echo "  <script type=\"text/javascript\" src=\"js/jquery.min.js\"></script>\n"; 
+echo "  <script type=\"text/javascript\" src=\"js/jquery.json-2.4.min.js\"></script>\n"; 
+echo "  <script type=\"text/javascript\" src=\"js/verto-min.js\"></script>\n"; 
+echo "  <script type=\"text/javascript\" src=\"high.js\"></script>\n"; 
+echo " </body> </html>\n"; 
+echo "\n";
+//include the footer
+	require_once "resources/footer.php";
+?>

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.