2
0

index.html 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892
  1. <!DOCTYPE html>
  2. <!--
  3. /*
  4. * The FreeSWITCH Portal Project
  5. * Copyright (C) 2013-2013, Seven Du <dujinfang@gmail.com>
  6. *
  7. * Version: MPL 1.1
  8. *
  9. * The contents of this file are subject to the Mozilla Public License Version
  10. * 1.1 (the "License"); you may not use this file except in compliance with
  11. * the License. You may obtain a copy of the License at
  12. * http://www.mozilla.org/MPL/
  13. *
  14. * Software distributed under the License is distributed on an "AS IS" basis,
  15. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  16. * for the specific language governing rights and limitations under the
  17. * License.
  18. *
  19. * The Original Code is The FreeSWITCH Portal Project Software/Application
  20. *
  21. * The Initial Developer of the Original Code is
  22. * Seven Du <dujinfang@gmail.com>
  23. * Portions created by the Initial Developer are Copyright (C)
  24. * the Initial Developer. All Rights Reserved.
  25. *
  26. * Contributor(s):
  27. *
  28. * Seven Du <dujinfang@gmail.com>
  29. *
  30. *
  31. * index.html -- The FreeSWITCH Portal Project
  32. *
  33. */
  34. -->
  35. <html lang="en">
  36. <head>
  37. <meta charset="utf-8">
  38. <title>FreeSWITCH Portal</title>
  39. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  40. <meta name="description" content="">
  41. <meta name="author" content="">
  42. <!-- Le styles -->
  43. <link href="assets/bootstrap-3.1.1/css/bootstrap.min.css" rel="stylesheet">
  44. <link href="assets/bs_for_ember/css/bs-growl-notifications.min.css" rel="stylesheet">
  45. <style>
  46. body {
  47. padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
  48. }
  49. #container {
  50. min-height: 500px;
  51. }
  52. #footer {
  53. text-align: center;
  54. }
  55. </style>
  56. <link href="assets/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
  57. <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
  58. <!--[if lt IE 9]>
  59. <script src="assets/js/html5shiv.js"></script>
  60. <![endif]-->
  61. <!-- Fav and touch icons -->
  62. <link rel="apple-touch-icon-precomposed" sizes="144x144" href="assets/ico/apple-touch-icon-144-precomposed.png">
  63. <link rel="apple-touch-icon-precomposed" sizes="114x114" href="assets/ico/apple-touch-icon-114-precomposed.png">
  64. <link rel="apple-touch-icon-precomposed" sizes="72x72" href="assets/ico/apple-touch-icon-72-precomposed.png">
  65. <link rel="apple-touch-icon-precomposed" href="assets/ico/apple-touch-icon-57-precomposed.png">
  66. <link rel="shortcut icon" href="assets/ico/favicon.png">
  67. </head>
  68. <body>
  69. <header class="navbar navbar-inverse navbar-fixed-top bs-docs-nav" role="banner">
  70. <div class="container">
  71. <div class="pull-right" id='ws-status' style="padding-top:5px"></div>
  72. <div class="navbar-header">
  73. <button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".bs-navbar-collapse">
  74. <span class="sr-only">Toggle navigation</span>
  75. <span class="icon-bar"></span>
  76. <span class="icon-bar"></span>
  77. <span class="icon-bar"></span>
  78. </button>
  79. <a class="navbar-brand" href="#">FreeSWITCH Portal</a>
  80. </div>
  81. <nav class="collapse navbar-collapse bs-navbar-collapse" role="navigation">
  82. <ul class="nav navbar-nav">
  83. <li><a href="#">Home</a></li>
  84. <li><a id="menu-users" href="#users">Users</a></li>
  85. <li><a id="menu-calls" href="#calls">Calls</a></li>
  86. <li><a id="menu-channels" href="#channels">Channels</a></li>
  87. <li><a href="#show">Show</a></li>
  88. <li><a href="#sofiaStatus">Sofia</a></li>
  89. <li><a href="#about">About</a></li>
  90. </ul>
  91. </nav>
  92. </div>
  93. </header>
  94. <div class="container" id="container">
  95. <div id="main">
  96. <div id="calls" style="display:none"></div>
  97. <div id="channels" style="display:none"></div>
  98. </div>
  99. </div> <!-- /container -->
  100. <div class="container" id="footer">
  101. &copy; <a href="http://www.freeswitch.org">FreeSWITCH.org</a>
  102. Join us on <a href="http://www.cluecon.com">ClueCon</a>!
  103. </div>
  104. <script type="text/x-handlebars" data-template-name="index">
  105. <h1>Welcome to FreeSWITCH !</h1>
  106. ---- The World's First Cross-Platform Scalable FREE Multi-Protocol Soft Switch
  107. <br>
  108. <br>
  109. <br>
  110. <br>
  111. <div id="serverStatus"></div>
  112. </script>
  113. <script type="text/x-handlebars" data-template-name="showRegistrations">
  114. <h1>Registrations</h1>
  115. <div>
  116. <table class="table">
  117. <tr>
  118. <th>Reg User</th>
  119. <th>Realm</th>
  120. <th>Expires</th>
  121. <th>Network IP</th>
  122. <th>Network Port</th>
  123. <th>Network Proto</th>
  124. <th>Hostname</th>
  125. <th>Metadata</th>
  126. <th>Token / Url</th>
  127. </tr>
  128. {{#each App.registrationsController.content}}
  129. <tr>
  130. <td>{{ reg_user }}</td>
  131. <td>{{ realm }}</td>
  132. <td>{{ expires }}</td>
  133. <td>{{ network_ip }}</td>
  134. <td>{{ network_port }}</td>
  135. <td>{{ network_proto }}</td>
  136. <td>{{ hostname }}</td>
  137. <td>{{ metadata }}</td>
  138. <td>{{ token }}<br>{{ url }}</td>
  139. </tr>
  140. {{/each}}
  141. </table>
  142. </div>
  143. </script>
  144. <script type="text/x-handlebars" data-template-name="showModules">
  145. <h1>Modules</h1>
  146. <div>
  147. <table class="table">
  148. <tr>
  149. <th>Type</th>
  150. <th>Name</th>
  151. <th>iKey</th>
  152. <th>Fileame</th>
  153. </tr>
  154. {{#each App.showModulesController.content}}
  155. <tr>
  156. <td>{{ type }}</td>
  157. <td>{{ name }}</td>
  158. <td>{{ ikey }}</td>
  159. <td>{{ filename }}</td>
  160. </tr>
  161. {{/each}}
  162. </table>
  163. </div>
  164. </script>
  165. <script type="text/x-handlebars" data-template-name="showApplications">
  166. <h1>Applications</h1>
  167. <div>
  168. <table class="table">
  169. <tr>
  170. <th>Name</th>
  171. <th>Description</th>
  172. <th>Syntax</th>
  173. <th>iKey</th>
  174. </tr>
  175. {{#each App.applicationsController.content}}
  176. <tr>
  177. <td>{{ name }}</td>
  178. <td>{{ description }}</td>
  179. <td>{{ syntax }}</td>
  180. <td>{{ ikey }}</td>
  181. </tr>
  182. {{/each}}
  183. </table>
  184. </div>
  185. </script>
  186. <script type="text/x-handlebars" data-template-name="showEndpoints">
  187. <h1>Endpoints</h1>
  188. <div>
  189. <table class="table">
  190. <tr>
  191. <th>Type</th>
  192. <th>Name</th>
  193. <th>iKey</th>
  194. </tr>
  195. {{#each App.showEndpointsController.content}}
  196. <tr>
  197. <td>{{ type }}</td>
  198. <td>{{ name }}</td>
  199. <td>{{ ikey }}</td>
  200. </tr>
  201. {{/each}}
  202. </table>
  203. </div>
  204. </script>
  205. <script type="text/x-handlebars" data-template-name="showCodecs">
  206. <h1>Codecs</h1>
  207. <div>
  208. <table class="table">
  209. <tr>
  210. <th>Type</th>
  211. <th>Name</th>
  212. <th>iKey</th>
  213. </tr>
  214. {{#each App.showCodecsController.content}}
  215. <tr>
  216. <td>{{ type }}</td>
  217. <td>{{ name }}</td>
  218. <td>{{ ikey }}</td>
  219. </tr>
  220. {{/each}}
  221. </table>
  222. </div>
  223. </script>
  224. <script type="text/x-handlebars" data-template-name="showFiles">
  225. <h1>Files</h1>
  226. <div>
  227. <table class="table">
  228. <tr>
  229. <th>Type</th>
  230. <th>Name</th>
  231. <th>iKey</th>
  232. </tr>
  233. {{#each App.showFilesController.content}}
  234. <tr>
  235. <td>{{ type }}</td>
  236. <td>{{ name }}</td>
  237. <td>{{ ikey }}</td>
  238. </tr>
  239. {{/each}}
  240. </table>
  241. </div>
  242. </script>
  243. <script type="text/x-handlebars" data-template-name="showAPIs">
  244. <h1>APIs</h1>
  245. <div>
  246. <table class="table">
  247. <tr>
  248. <th>Name /<br>Description</th>
  249. <th>Syntax</th>
  250. <th>iKey</th>
  251. </tr>
  252. {{#each App.showAPIsController.content}}
  253. <tr>
  254. <td>
  255. <strong>{{ name }}</strong><br>
  256. {{ description }}
  257. </td>
  258. <td><pre>{{ syntax }}</pre></td>
  259. <td>{{ ikey }}</td>
  260. </tr>
  261. {{/each}}
  262. </table>
  263. </div>
  264. </script>
  265. <script type="text/x-handlebars" data-template-name="showAliases">
  266. <h1>Aliases</h1>
  267. <div>
  268. <table class="table">
  269. <tr>
  270. <th>Sticky</th>
  271. <th>Alias</th>
  272. <th>Command</th>
  273. <th>Hostname</th>
  274. </tr>
  275. {{#each App.showAliasesController.content}}
  276. <tr>
  277. <td>{{ sticky }}</td>
  278. <td>{{ alias }}</td>
  279. <td>{{ command }}</td>
  280. <td>{{ hostname }}</td>
  281. </tr>
  282. {{/each}}
  283. </table>
  284. </div>
  285. </script>
  286. <script type="text/x-handlebars" data-template-name="showCompletes">
  287. <h1>Complete</h1>
  288. <div>
  289. <table class="table">
  290. <tr>
  291. <th>Sticky</th>
  292. <th>A1</th>
  293. <th>A2</th>
  294. <th>A3</th>
  295. <th>A4</th>
  296. <th>A5</th>
  297. <th>A6</th>
  298. <th>A7</th>
  299. <th>A8</th>
  300. <th>A9</th>
  301. <th>A10</th>
  302. <th>Hostname</th>
  303. </tr>
  304. {{#each App.showCompletesController.content}}
  305. <tr>
  306. <td>{{ sticky }}</td>
  307. <td>{{ a1 }}</td>
  308. <td>{{ a2 }}</td>
  309. <td>{{ a3 }}</td>
  310. <td>{{ a4 }}</td>
  311. <td>{{ a5 }}</td>
  312. <td>{{ a6 }}</td>
  313. <td>{{ a7 }}</td>
  314. <td>{{ a8 }}</td>
  315. <td>{{ a9 }}</td>
  316. <td>{{ a10 }}</td>
  317. <td>{{ hostname }}</td>
  318. </tr>
  319. {{/each}}
  320. </table>
  321. </div>
  322. </script>
  323. <script type="text/x-handlebars" data-template-name="showManagements">
  324. <h1>Say</h1>
  325. <div>
  326. <table class="table">
  327. <tr>
  328. <th>Type</th>
  329. <th>Name</th>
  330. <th>iKey</th>
  331. </tr>
  332. {{#each App.showManagementsController.content}}
  333. <tr>
  334. <td>{{ type }}</td>
  335. <td>{{ name }}</td>
  336. <td>{{ ikey }}</td>
  337. </tr>
  338. {{/each}}
  339. </table>
  340. </div>
  341. </script>
  342. <script type="text/x-handlebars" data-template-name="showNatMaps">
  343. <h1>Nat Maps</h1>
  344. <div>
  345. <table class="table">
  346. <tr>
  347. <th>Port</th>
  348. <th>Protocol</th>
  349. <th>Protocol Number</th>
  350. <th>Sticky</th>
  351. </tr>
  352. {{#each App.showNatMapsController.content}}
  353. <tr>
  354. <td>{{ port }}</td>
  355. <td>{{ proto }}</td>
  356. <td>{{ proto_num }}</td>
  357. <td>{{ sticky }}</td>
  358. </tr>
  359. {{/each}}
  360. </table>
  361. </div>
  362. </script>
  363. <script type="text/x-handlebars" data-template-name="showSays">
  364. <h1>Say</h1>
  365. <div>
  366. <table class="table">
  367. <tr>
  368. <th>Type</th>
  369. <th>Name</th>
  370. <th>iKey</th>
  371. </tr>
  372. {{#each App.showSaysController.content}}
  373. <tr>
  374. <td>{{ type }}</td>
  375. <td>{{ name }}</td>
  376. <td>{{ ikey }}</td>
  377. </tr>
  378. {{/each}}
  379. </table>
  380. </div>
  381. </script>
  382. <script type="text/x-handlebars" data-template-name="showChats">
  383. <h1>Chat</h1>
  384. <div>
  385. <table class="table">
  386. <tr>
  387. <th>Type</th>
  388. <th>Name</th>
  389. <th>iKey</th>
  390. </tr>
  391. {{#each App.showChatsController.content}}
  392. <tr>
  393. <td>{{ type }}</td>
  394. <td>{{ name }}</td>
  395. <td>{{ ikey }}</td>
  396. </tr>
  397. {{/each}}
  398. </table>
  399. </div>
  400. </script>
  401. <script type="text/x-handlebars" data-template-name="showInterfaces">
  402. <h1>Interfaces</h1>
  403. <div>
  404. <table class="table">
  405. <tr>
  406. <th>Type</th>
  407. <th>Name</th>
  408. <th>iKey</th>
  409. </tr>
  410. {{#each App.showInterfacesController.content}}
  411. <tr>
  412. <td>{{ type }}</td>
  413. <td>{{ name }}</td>
  414. <td>{{ ikey }}</td>
  415. </tr>
  416. {{/each}}
  417. </table>
  418. </div>
  419. </script>
  420. <script type="text/x-handlebars" data-template-name="showInterfaceTypes">
  421. <h1>Interface Types</h1>
  422. <div>
  423. <table class="table">
  424. <tr>
  425. <th>Type</th>
  426. <th>Total</th>
  427. </tr>
  428. {{#each App.showInterfaceTypesController.content}}
  429. <tr>
  430. <td>{{ type }}</td>
  431. <td>{{ total }}</td>
  432. </tr>
  433. {{/each}}
  434. </table>
  435. </div>
  436. </script>
  437. <script type="text/x-handlebars" data-template-name="showTasks">
  438. <h1>Tasks</h1>
  439. <div>
  440. <table class="table">
  441. <tr>
  442. <th>ID</th>
  443. <th>Description</th>
  444. <th>Group</th>
  445. <th>SQL Manager</th>
  446. <th>Hostname</th>
  447. </tr>
  448. {{#each App.showTasksController.content}}
  449. <tr>
  450. <td>{{ task_id }}</td>
  451. <td>{{ task_desc }}</td>
  452. <td>{{ task_group }}</td>
  453. <td>{{ task_sql_manager }}</td>
  454. <td>{{ hostname }}</td>
  455. </tr>
  456. {{/each}}
  457. </table>
  458. </div>
  459. </script>
  460. <script type="text/x-handlebars" data-template-name="showLimits">
  461. <h1>Limits</h1>
  462. <div>
  463. <table class="table">
  464. <tr>
  465. <th>Type</th>
  466. <th>Name</th>
  467. <th>iKey</th>
  468. </tr>
  469. {{#each App.showLimitsController.content}}
  470. <tr>
  471. <td>{{ type }}</td>
  472. <td>{{ name }}</td>
  473. <td>{{ ikey }}</td>
  474. </tr>
  475. {{/each}}
  476. </table>
  477. </div>
  478. </script>
  479. <script type="text/x-handlebars" data-template-name="show">
  480. <h1>Show</h1>
  481. {{#linkTo "showRegistrations"}} Registrations {{/linkTo}} |
  482. {{#linkTo "showModules"}} Modules {{/linkTo}} |
  483. {{#linkTo "showApplications"}} Applications {{/linkTo}} |
  484. {{#linkTo "showEndpoints"}} Endpoints {{/linkTo}} |
  485. {{#linkTo "showCodecs"}} Codecs {{/linkTo}} |
  486. {{#linkTo "showFiles"}} Files {{/linkTo}} |
  487. {{#linkTo "showAPIs"}} APIs {{/linkTo}} |
  488. {{#linkTo "showAliases"}} Aliases {{/linkTo}} |
  489. {{#linkTo "showCompletes"}} Complete {{/linkTo}} |
  490. {{#linkTo "showChats"}} Chat {{/linkTo}} |
  491. {{#linkTo "showManagements"}} Management {{/linkTo}} |
  492. {{#linkTo "showNatMaps"}} Nat Map {{/linkTo}} |
  493. {{#linkTo "showSays"}} Say {{/linkTo}} |
  494. {{#linkTo "showInterfaces"}} Interfaces {{/linkTo}} |
  495. {{#linkTo "showInterfaceTypes"}} InterfaceTypes {{/linkTo}} |
  496. {{#linkTo "showTasks"}} Tasks {{/linkTo}} |
  497. {{#linkTo "showLimits"}} Limits {{/linkTo}}
  498. </script>
  499. <script type="text/x-handlebars" data-template-name="about">
  500. <h1>About FreeSWITCH Portal</h1>
  501. <p>
  502. The FreeSWITCH Portal Project is Created by <a href="http://www.dujinfang.com">Seven Du</a>.
  503. Available with MPL1.1 licence - Same as FreeSWITCH.
  504. </p>
  505. <p>The FreeSWITCH Portal Project is designed to show an intuitive view of the FreeSWITCH internals. It can be used by FreeSWITCH funs, administrators, developers etc. It does not aims to replace GUIs such as FusionPBX or blue.box. It would be very easy to use and super helpful for new FreeSWITCH users.
  506. <hr>
  507. <h2>Philosophy</h2>
  508. <p>To provide a GUI out of the box without depends on external resources like PHP or a webserver such as Apache or Nginx.
  509. <p>Mainly developed with static html and Javascripts, and perhaps some lua scripts can help do some more magic things later.
  510. <h2>Install</h2>
  511. <p>If you see this page it means you already installed. Remember it works Out of the Box!
  512. <h2>Todo</h2>
  513. <li>Modify users: A raw idea to add a new user would be something like below and reloadxml.
  514. <pre>sed -e 's/1000/new-user/g' 1000.xml > new-user.xml</pre>
  515. <li>Modify dialplan and/or other XMLs: possible to use some online XML editor and
  516. can save the XML with some lua or C code at the backend,
  517. although there are security concerns.
  518. <li>Store information in DB: I guess the Dbh handle in lua should can do something like this.
  519. <li>Web terminal: With terminal.js like things and websocket we can really build a web version of fs_cli
  520. <li>rtmp web client support to make and receive calls
  521. <li>WebRTC?
  522. <li>Logging, Event Debugging or SIP tracing: Yeah, more magic
  523. <li>i18n
  524. <h2>Security</h2>
  525. <p>The primary goal is to help new users learn and use FreeSWITCH.
  526. Please <strong>DON'T</strong> put this on your production server as
  527. I haven't think anything about security.
  528. <p>You can disable this by delete or move the portal directory out of /usr/local/freeswitch/htdocs . e.g.
  529. <pre>mv /usr/local/freeswitch/htdocs/portal /usr/local/freeswitch/</pre>
  530. And move back any time you want.
  531. <h2>Development</h2>
  532. <li>I started this project to learn how to use bootstrap and ember.js,
  533. the latter said it is a framework for <strong>creating ambitious web applications</strong>.
  534. <li>Contributions and patches are welcome.
  535. <br>
  536. <br>
  537. <br>
  538. <br>
  539. </script>
  540. <script type="text/x-handlebars" data-template-name="users" id="users/index">
  541. <div class="pull-right">
  542. {{#bs-button type="primary" clicked="newUser"}}Create User{{/bs-button}}
  543. </div>
  544. {{#bs-modal name="newUserForm" fade="true" footerButtonsBinding="newUserButtons" title="Create User (Experimental)"}}
  545. <p>
  546. User ID: <input name="user_id" id="user_id"></input><br>
  547. </p>
  548. {{/bs-modal}}
  549. <h1>Users</h1>
  550. <div>
  551. <table class="table">
  552. <tr>
  553. <th>ID</th>
  554. <th>Context</th>
  555. <th>Domain</th>
  556. <th>Group</th>
  557. <th>Contact</th>
  558. <th>Callgroup</th>
  559. <th>Caller ID Name</th>
  560. <th>Caller ID Number</th>
  561. </tr>
  562. {{#each App.usersController.content}}
  563. <tr>
  564. <td>{{ id }}</td>
  565. <td>{{ context }}</td>
  566. <td>{{ domain }}</td>
  567. <td>{{ group }}</td>
  568. <td>{{ contact }}</td>
  569. <td>{{ callgroup }}</td>
  570. <td>{{ cid_name }}</td>
  571. <td>{{ cid_number }}</td>
  572. </tr>
  573. {{/each}}
  574. </table>
  575. </div>
  576. </script>
  577. <script type="text/x-handlebars" data-template-name="sofiaStatus">
  578. <div class="pull-right">
  579. {{#bs-button type="primary" clicked="addGateway"}}Add Gateway{{/bs-button}}
  580. </div>
  581. {{#bs-modal name="newUserForm" fade="true" footerButtonsBinding="addGatewayButtons" title="Add Gateway"}}
  582. <form class="form-horizontal" role="form">
  583. <div class="form-group">
  584. <label class="col-sm-2 control-label" for="gateway_name">Name</label>
  585. <div class="col-sm-10">
  586. <input class="form-control" type="text" id="gateway_name" placeholder="gw1">
  587. </div>
  588. </div>
  589. <div class="form-group">
  590. <label class="col-sm-2 control-label" for="gateway_realm">Realm</label>
  591. <div class="col-sm-10">
  592. <input class="form-control" type="text" id="gateway_realm" placeholder="example.com">
  593. </div>
  594. </div>
  595. <div class="form-group">
  596. <label class="col-sm-2 control-label" for="gateway_username">Username</label>
  597. <div class="col-sm-10">
  598. <input class="form-control" type="text" id="gateway_username" placeholder="username">
  599. </div>
  600. </div>
  601. <div class="form-group">
  602. <label class="col-sm-2 control-label" for="gateway_password">Password</label>
  603. <div class="col-sm-10">
  604. <input class="form-control" type="text" id="gateway_password" placeholder="password">
  605. </div>
  606. </div>
  607. <div class="form-group">
  608. <label class="col-sm-2 control-label" for="gateway_register">Register?</label>
  609. <input type="checkbox" checked id="gateway_register"/>
  610. </div>
  611. </form>
  612. {{/bs-modal}}
  613. <h1>Sofia Status</h1>
  614. <div>
  615. <table class="table">
  616. <tr>
  617. <th>Type</th>
  618. <th>Name</th>
  619. <th>Data</th>
  620. <th>State</th>
  621. <th>Action</th>
  622. </tr>
  623. {{#each App.sofiaStatusController.content}}
  624. <tr>
  625. <td>{{ type }}</td>
  626. <td>{{ name }}</td>
  627. <td>{{ data }}</td>
  628. <td>{{ state }}</td>
  629. <td>{{ actions }}</td>
  630. </tr>
  631. {{/each}}
  632. </table>
  633. </div>
  634. </script>
  635. <script type="text/x-handlebars" data-template-name="calls">
  636. <div class="pull-right">
  637. <label><input type="checkbox" id="auto_update_calls" value="1" onclick="auto_update_calls();">Auto Update</label>
  638. </div>
  639. <h1>Calls</h1>
  640. <div>
  641. <table class="table">
  642. <tr>
  643. <th>Call UUID</th>
  644. <th>CID</th>
  645. <th>Dest</th>
  646. <th>Call State</th>
  647. <th>Direction / Created</th>
  648. </tr>
  649. {{#each App.callsController.content}}
  650. <tr>
  651. <td>{{uuid}} <br>{{ b_uuid }}</td>
  652. <td>{{ cid_num }}<br>{{ b_cid_num }}</td>
  653. <td>{{ dest }}<br>{{ b_dest }}</td>
  654. <td>{{ callstate }}<br>{{ b_callstate }}</td>
  655. <td>{{ direction }} / {{ b_direction }}<br>
  656. <a href='#' {{action "dump" uuid target="App.callsController"}}>{{created}}</a>
  657. <!--<a href='#' {{action "raw" uuid target="App.callsController"}}>Raw</a>-->
  658. </td>
  659. </tr>
  660. {{/each}}
  661. </table>
  662. </div>
  663. </script>
  664. <script type="text/x-handlebars" data-template-name="channels">
  665. <h1>Channels</h1>
  666. <div>
  667. <table class="table">
  668. <tr>
  669. <th>Call UUID</th>
  670. <th>CID</th>
  671. <th>Dest</th>
  672. <th>Call State</th>
  673. <th>Direction / Created</th>
  674. </tr>
  675. {{#each App.channelsController.content}}
  676. <tr>
  677. <td>{{uuid}}</td>
  678. <td>{{ cid_num }}</td>
  679. <td>{{ dest }}<br></td>
  680. <td>{{ callstate }}</td>
  681. <td>{{ direction }}<br>
  682. <a href='#' {{action "dump" uuid target="App.channelsController"}}>{{created}}</a>
  683. </td>
  684. </tr>
  685. {{/each}}
  686. </table>
  687. </div>
  688. </script>
  689. <!-- Le javascript
  690. ================================================== -->
  691. <!-- Placed at the end of the document so the pages load faster -->
  692. <script src="assets/js/ie-console.js"></script>
  693. <script src="assets/js/jquery.min.js"></script>
  694. <script src="assets/js/handlebars.min.js"></script>
  695. <script src="assets/js/ember.min.js"></script>
  696. <!-- <script src="assets/js/ember-data.min.js"></script> -->
  697. <script src="assets/bs_for_ember/js/bs-core.min.js"></script>
  698. <script src="assets/bs_for_ember/js/bs-alert.min.js"></script>
  699. <script src="assets/bs_for_ember/js/bs-badge.min.js"></script>
  700. <script src="assets/bs_for_ember/js/bs-basic.min.js"></script>
  701. <script src="assets/bs_for_ember/js/bs-button.min.js"></script>
  702. <script src="assets/bs_for_ember/js/bs-growl-notifications.min.js"></script>
  703. <script src="assets/bs_for_ember/js/bs-items-action-bar.min.js"></script>
  704. <script src="assets/bs_for_ember/js/bs-label.min.js"></script>
  705. <script src="assets/bs_for_ember/js/bs-list-group.min.js"></script>
  706. <script src="assets/bs_for_ember/js/bs-modal.min.js"></script>
  707. <script src="assets/bs_for_ember/js/bs-nav.min.js"></script>
  708. <script src="assets/bs_for_ember/js/bs-notifications.min.js"></script>
  709. <script src="assets/bs_for_ember/js/bs-progressbar.min.js"></script>
  710. <script src="assets/bs_for_ember/js/bs-wizard.min.js"></script>
  711. <script src="assets/js/fsportal.js"></script>
  712. <!--
  713. <script src="assets/js/bootstrap-transition.js"></script>
  714. <script src="assets/js/bootstrap-alert.js"></script>
  715. <script src="assets/js/bootstrap-modal.js"></script>
  716. <script src="assets/js/bootstrap-dropdown.js"></script>
  717. <script src="assets/js/bootstrap-scrollspy.js"></script>
  718. <script src="assets/js/bootstrap-tab.js"></script>
  719. <script src="assets/js/bootstrap-tooltip.js"></script>
  720. <script src="assets/js/bootstrap-popover.js"></script>
  721. <script src="assets/js/bootstrap-button.js"></script>
  722. <script src="assets/js/bootstrap-collapse.js"></script>
  723. <script src="assets/js/bootstrap-carousel.js"></script>
  724. <script src="assets/js/bootstrap-typeahead.js"></script>
  725. -->
  726. <script type="text/javascript">
  727. $(window).on('beforeunload', function() {
  728. if (socket) {
  729. socket.close();
  730. }
  731. });
  732. function auto_update_calls() {
  733. var x = $('#auto_update_calls')[0];
  734. if (typeof x != "undefined" && x.checked) {
  735. console.log("tick")
  736. App.callsController.load();
  737. setTimeout(auto_update_calls, 2000);
  738. }
  739. }
  740. // $("#menu-channels").click(function(e){
  741. // e.preventDefault();
  742. // App.channelsController.load();
  743. // $('#calls').hide();
  744. // $('#channels').show();
  745. // });
  746. // $("#menu-calls").click(function(e){
  747. // e.preventDefault();
  748. // App.callsController.load();
  749. // $('#channels').hide();
  750. // $('#calls').show();
  751. // });
  752. // var callsView = Ember.View.create({
  753. // templateName: 'calls',
  754. // name: "callsView"
  755. // });
  756. // // $('#container').html('');
  757. // callsView.appendTo('#calls');
  758. // var channelsView = Ember.View.create({
  759. // templateName: 'channels',
  760. // name: "channelsView"
  761. // });
  762. // channelsView.appendTo('#channels');
  763. function dump_call(uuid) {
  764. obj = App.callsController.content.findProperty("uuid", uuid);
  765. console.log(obj);
  766. }
  767. </script>
  768. <script type="text/javascript">
  769. var port = document.location.port;
  770. // var port = 8081; // for test
  771. var socket = new WebSocket("ws://" + document.location.hostname + ":" + port + "/socket", "websocket");
  772. try {
  773. socket.onopen = function() {
  774. $('#ws-status').html('Socket Connected').css("color", "green");
  775. // socket.send("event json all");
  776. socket.send("event json CHANNEL_CREATE");
  777. socket.send("event json CHANNEL_BRIDGE");
  778. socket.send("event json CHANNEL_HANGUP_COMPLETE");
  779. socket.send("event json CHANNEL_CALLSTATE");
  780. }
  781. socket.onmessage =function(msg) {
  782. // console.log(msg.data);
  783. var data = JSON.parse(msg.data);
  784. eventCallback(data);
  785. }
  786. socket.onclose = function(){
  787. $('#ws-status').html('Socket Disconnected!').css("color", "red");
  788. console.log("socket disconnected, fallback to event_sink");
  789. setInterval("App.channelsController.checkEvent()", 2000);
  790. //setInterval("App.channelsController.checkXMLEvent()", 2000);
  791. }
  792. } catch(exception) {
  793. alert('Error' + exception);
  794. }
  795. </script>
  796. </body>
  797. </html>