voicemail_msgs_play.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <?php
  2. /*
  3. FusionPBX
  4. Version: MPL 1.1
  5. The contents of this file are subject to the Mozilla Public License Version
  6. 1.1 (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.mozilla.org/MPL/
  9. Software distributed under the License is distributed on an "AS IS" basis,
  10. WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  11. for the specific language governing rights and limitations under the
  12. License.
  13. The Original Code is FusionPBX
  14. The Initial Developer of the Original Code is
  15. Mark J Crane <[email protected]>
  16. Portions created by the Initial Developer are Copyright (C) 2008-2012
  17. the Initial Developer. All Rights Reserved.
  18. Contributor(s):
  19. Mark J Crane <[email protected]>
  20. */
  21. include "root.php";
  22. require_once "resources/require.php";
  23. require_once "resources/check_auth.php";
  24. if (permission_exists('voicemail_view')) {
  25. //access granted
  26. }
  27. else {
  28. echo "access denied";
  29. exit;
  30. }
  31. //add multi-lingual support
  32. $language = new text;
  33. $text = $language->get();
  34. //get the http get values
  35. $uuid = $_GET['uuid'];
  36. $file_ext = $_GET['ext'];
  37. $type = $_GET['type']; //vm
  38. $desc = $_GET['desc'];
  39. $id = $_GET['id'];
  40. //get the domain from the domains array
  41. $domain_name = $_SESSION['domains'][$domain_uuid]['domain_name'];
  42. //create the event socket connection
  43. $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
  44. if (!$fp) {
  45. $msg = "<div align='center'>".$text['confirm-socket']."<br /></div>";
  46. }
  47. //show the error message or show the content
  48. if (strlen($msg) > 0) {
  49. require_once "resources/header.php";
  50. echo "<div align='center'>\n";
  51. echo " <table width='40%'>\n";
  52. echo " <tr>\n";
  53. echo " <th align='left'>".$text['label-message']."</th>\n";
  54. echo " </tr>\n";
  55. echo " <tr>\n";
  56. echo " <td class='row_style1'><strong>$msg</strong></td>\n";
  57. echo " </tr>\n";
  58. echo " </table>\n";
  59. echo "</div>\n";
  60. require_once "resources/footer.php";
  61. return;
  62. }
  63. ?>
  64. <html>
  65. <head>
  66. </head>
  67. <body link="#0000CC" vlink="#0000CC" alink="#0000CC">
  68. <table width="100%" border="0" cellpadding="0" cellspacing="0">
  69. <tr>
  70. <td align='center'>
  71. <b>voicemail: <?php echo$desc?></b>
  72. </td>
  73. </tr>
  74. <tr>
  75. <td align='center'>
  76. <?php
  77. //mark voicemail as read
  78. $cmd = "api vm_read " .$id."@".$domain_name." read ".$uuid;
  79. $response = trim(event_socket_request($fp, $cmd));
  80. if (strcmp($response,"+OK")==0) {
  81. $msg = "Complete";
  82. }
  83. else {
  84. $msg = "Failed";
  85. }
  86. //embed html tag to play the wav file
  87. if ($file_ext == "wav") {
  88. echo "<embed src=\"voicemail_msgs.php?a=download&type=".$type."&uuid=".$uuid."\" autostart=true width=200 height=40 name=\"sound".$uuid."\" enablejavascript=\"true\">\n";
  89. }
  90. //object html tag to add flash player that can play the mp3 file
  91. if ($file_ext == "mp3") {
  92. echo "<object type=\"application/x-shockwave-flash\" width=\"400\" height=\"17\" data=\"slim.swf?autoplay=true&song_title=".urlencode($uuid)."&song_url=".urlencode(PROJECT_PATH."/voicemail_msgs.php?a=download&type=".$type."&uuid=".$uuid)."\">\n";
  93. echo "<param name=\"movie\" value=\"slim.swf?autoplay=true&song_url=".urlencode(PROJECT_PATH."/voicemail_msgs.php?a=download&type=".$type."&uuid=".$uuid)."\" />\n";
  94. echo "<param name=\"quality\" value=\"high\"/>\n";
  95. echo "<param name=\"bgcolor\" value=\"#E6E6E6\"/>\n";
  96. echo "</object>\n";
  97. }
  98. ?>
  99. </td>
  100. </tr>
  101. </table>
  102. </body>
  103. </html>