ADDON: Play recording right inside the "User Stats" page

Any and all non-support discussions

Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N

ADDON: Play recording right inside the "User Stats" page

Postby nrc » Tue Dec 31, 2013 2:19 pm

No need to download the file and then play the audio recording

now you can play the file direct from the page, with the ability to move the slider to any position, play, pause, and volume control on screen.

This is all based on HTML5, so you will HAVE to have new browser

Go here to test if your browser has the <AUDIO> function built in: http://html5test.com/ (on the right hand side under AUDIO, make sure the "audio element" shows YES)

here is the code changes:

vicidial/user_stats.php

FIND
Code: Select all
$MAIN.="<td align=right><font size=2> $location &nbsp; </td>\n";


REPLACE WITH
Code: Select all

      $daten = date("Y-m-d H:i:s");
      $currentDate = strtotime($daten);
      $futureDate = $currentDate-(60*6);
      $row4date = strtotime($row[4]);
      if ($row4date < $futureDate){
      ?>
      <script type="text/javascript">
      function init(url, w, h, lid)
      {
             // Fixes dual-screen position                         Most browsers      Firefox
         var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left;
         var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top;

         width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
         height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;

         var left = ((width / 2) - (w / 2)) + dualScreenLeft;
         var top = ((height / 2) - (h / 2)) + dualScreenTop;
   
         popupWin = window.open('','popupWin','height='+h+',width='+w+',left='+left+',top='+top+',resizable=no,scrollbars=no,toolbar=no,menubar=no,location=no,directories=no,status=no');
         var p1="Leadid: "+lid+"<br><audio controls><source src="+url+" type=audio/ogg>Your browser does not support the audio element.</audio>";
         popupWin.document.writeln(p1);
         popupWin.document.close();
      }
      </script>
      <?php
      $MAIN.="<td><font color=\"blue\"><a onclick=\"init('$row[11]','340','75','$row[12]');\"><small>Listen to [$row[12]]</small></a></font></td>";
      $MAIN.="<td align=center><a href=$row[11]><small>Download File</small></a></td>\n";
      } else {
      $MAIN.="<td>Saving to server </td>";
      $MAIN.="<td>- check back</td>";
      }


My vicidial is setup to transfer the recording from the main server to our offsite server every 5mins, so i placed if statement, that says if the call was started less then 6 mins ago, show "Saving to server, check back", otherwise it will show a link to click, which popsup a window for you to hear the call right away.

Let me know what you think, here are a few screen shots:

Image

Image
VERSION: 2.6-399a | BUILD: 130425-0700 | 1.4.44-vici 1975 | Preload ISO 4.0
nrc
 
Posts: 80
Joined: Wed Feb 13, 2013 3:51 pm

Re: ADDON: Play recording right inside the "User Stats" page

Postby Vince-0 » Thu Jan 02, 2014 2:32 am

Nice work!
Vince-0
 
Posts: 272
Joined: Fri Mar 02, 2012 4:27 pm
Location: South Africa

Re: ADDON: Play recording right inside the "User Stats" page

Postby nrc » Thu Jan 02, 2014 2:34 pm

Thanks Vince
VERSION: 2.6-399a | BUILD: 130425-0700 | 1.4.44-vici 1975 | Preload ISO 4.0
nrc
 
Posts: 80
Joined: Wed Feb 13, 2013 3:51 pm

Re: ADDON: Play recording right inside the "User Stats" page

Postby williamconley » Sat Jan 04, 2014 12:13 am

You really should post this to the Issue Tracker as a Diff against the latest SVN. Very good work. 8-) (And post a link back here for Matt to peruse without searching.)
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20258
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Re: ADDON: Play recording right inside the "User Stats" page

Postby dspaan » Thu Jan 09, 2014 1:22 pm

Thanks for sharing :-)
Regards, Dennis

Vicibox 9.0.1
Version: 2.14b0.5
SVN Version: 3199
DB Schema Version: 1588
Build: 200310-1801
dspaan
 
Posts: 1377
Joined: Fri Aug 21, 2009 1:40 pm
Location: The Netherlands

Re: ADDON: Play recording right inside the "User Stats" page

Postby Trying » Fri Jan 10, 2014 6:51 am

Awesome! Please put it in the issue tracker. Thanks for sharing.
Vicibox Redux 3.1.14 64 bit
Asterisk: 1.4.39.2-vici | VERSION: 2.8-433a | BUILD: 140411-1434
Sangoma A102D/E1
Servers: 1 x Database; 1 x Web; 6 x Telephony; 2 x Archive
Outbound and blended ratio 3:1 with full voice recording
No additional software
Trying
 
Posts: 865
Joined: Sun Sep 09, 2007 8:41 am
Location: South Africa

Re: ADDON: Play recording right inside the "User Stats" page

Postby Flashhunter » Sat Jan 18, 2014 9:41 am

thanks for sharing! :)
Asterisk/VICIDial Consultant | VOIP Provider | Dedicated Hosting|
Flashhunter
 
Posts: 12
Joined: Sat Aug 30, 2008 12:26 pm

Re: ADDON: Play recording right inside the "User Stats" page

Postby rrb555 » Mon Jan 20, 2014 1:50 pm

Someone should post this on Vicidial Issue Tracker so the Vicidial team can add this feature soon,

This is quite handy
One server that I am managing | Single Server | ViciBox Redux 6.0 | VERSION: 2.12-549a | BUILD: 160404-0940 | revision 2508| No other hardware
For help you can send me a direct email info@support.com.ph
rrb555
 
Posts: 585
Joined: Tue Feb 08, 2011 4:24 pm
Location: Quezon City, Philippines

Re: ADDON: Play recording right inside the "User Stats" page

Postby nrc » Tue Jan 21, 2014 2:43 pm

I'll get it added..

thanks guys.
VERSION: 2.6-399a | BUILD: 130425-0700 | 1.4.44-vici 1975 | Preload ISO 4.0
nrc
 
Posts: 80
Joined: Wed Feb 13, 2013 3:51 pm

Re: ADDON: Play recording right inside the "User Stats" page

Postby nrc » Tue Jan 21, 2014 2:48 pm

VERSION: 2.6-399a | BUILD: 130425-0700 | 1.4.44-vici 1975 | Preload ISO 4.0
nrc
 
Posts: 80
Joined: Wed Feb 13, 2013 3:51 pm

Re: ADDON: Play recording right inside the "User Stats" page

Postby Rudolfmdlt » Fri Jan 31, 2014 3:44 am

This is EXACTLY what I was looking for. Thank you!

Rudolf
Rudolfmdlt
 
Posts: 92
Joined: Thu Jul 25, 2013 2:07 am

Re: ADDON: Play recording right inside the "User Stats" page

Postby nrc » Mon Feb 03, 2014 10:10 am

You bet Rudolf!
VERSION: 2.6-399a | BUILD: 130425-0700 | 1.4.44-vici 1975 | Preload ISO 4.0
nrc
 
Posts: 80
Joined: Wed Feb 13, 2013 3:51 pm

Re: ADDON: Play recording right inside the "User Stats" page

Postby dspaan » Fri Mar 07, 2014 9:10 am

Hi,

I tried your code but i got this error:

Warning: Cannot modify header information - headers already sent by (output started at /srv/www/htdocs/vicidial/user_stats.php:1266) in /srv/www/htdocs/vicidial/user_stats.php on line 1478


Any idea how i can fix it?
Regards, Dennis

Vicibox 9.0.1
Version: 2.14b0.5
SVN Version: 3199
DB Schema Version: 1588
Build: 200310-1801
dspaan
 
Posts: 1377
Joined: Fri Aug 21, 2009 1:40 pm
Location: The Netherlands

Re: ADDON: Play recording right inside the "User Stats" page

Postby nrc » Wed Mar 19, 2014 10:56 am

Seems like a closing tag is missing somewhere....
VERSION: 2.6-399a | BUILD: 130425-0700 | 1.4.44-vici 1975 | Preload ISO 4.0
nrc
 
Posts: 80
Joined: Wed Feb 13, 2013 3:51 pm

Re: ADDON: Play recording right inside the "User Stats" page

Postby dspaan » Sat Mar 22, 2014 12:16 pm

I looked again but i can't see anything missing. See here the original file on the left and modified on the right.

Image
Regards, Dennis

Vicibox 9.0.1
Version: 2.14b0.5
SVN Version: 3199
DB Schema Version: 1588
Build: 200310-1801
dspaan
 
Posts: 1377
Joined: Fri Aug 21, 2009 1:40 pm
Location: The Netherlands

Re: ADDON: Play recording right inside the "User Stats" page

Postby williamconley » Sat May 03, 2014 3:35 pm

it looks like:

Code: Select all
?>
<script ...

began output. if a header was attempted at this point, it was too late as HTML was already being transmitted, header cannot come after html.
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20258
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Re: ADDON: Play recording right inside the "User Stats" page

Postby dspaan » Mon May 05, 2014 12:34 pm

So how are other people using the same piece of code and it's working for them?
Regards, Dennis

Vicibox 9.0.1
Version: 2.14b0.5
SVN Version: 3199
DB Schema Version: 1588
Build: 200310-1801
dspaan
 
Posts: 1377
Joined: Fri Aug 21, 2009 1:40 pm
Location: The Netherlands

Re: ADDON: Play recording right inside the "User Stats" page

Postby williamconley » Wed Jun 11, 2014 10:39 pm

likely they had slightly different code OR the "if" statement above that caused that code to be skipped.
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20258
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Re: ADDON: Play recording right inside the "User Stats" page

Postby rrb555 » Thu Jun 12, 2014 7:34 pm

i just tried this, all seems to be working just fine but when I'm about to check to listen - the listen to[12345] is not even clickable. is that normal? i wasn't able to play the recordings not sure why.
One server that I am managing | Single Server | ViciBox Redux 6.0 | VERSION: 2.12-549a | BUILD: 160404-0940 | revision 2508| No other hardware
For help you can send me a direct email info@support.com.ph
rrb555
 
Posts: 585
Joined: Tue Feb 08, 2011 4:24 pm
Location: Quezon City, Philippines

Re: ADDON: Play recording right inside the "User Stats" page

Postby dspaan » Fri Jun 13, 2014 7:13 am

Hey could you paste your entire user_stats.php here so i can compare it with mine? I still haven't got this to work yet.
Regards, Dennis

Vicibox 9.0.1
Version: 2.14b0.5
SVN Version: 3199
DB Schema Version: 1588
Build: 200310-1801
dspaan
 
Posts: 1377
Joined: Fri Aug 21, 2009 1:40 pm
Location: The Netherlands


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 54 guests