This repository was archived by the owner on Mar 4, 2021. It is now read-only.
  
  
  - 
                Notifications
    You must be signed in to change notification settings 
- Fork 343
Conference Call - List Calls, Join and Listen #346
          
     Open
      
      
            jpwalters
  wants to merge
  6
  commits into
  twilio:master
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
jpwalters:conference-call
  
      
      
   
  
    
  
  
  
 
  
      
    base: master
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
  
     Open
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            6 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      6385078
              
                Conference Call Applet: New Feature - Record Call Option
              
              
                jpwalters 6d81cb1
              
                Conference Call List and Optional Join/Listen
              
              
                jpwalters a305e72
              
                Conference Call List/Listen: Pull Request Changes
              
              
                jpwalters 9694a7e
              
                Conference Call List/Listen: Pull Request Changes
              
              
                jpwalters 2c16898
              
                Conference Call List/Listen: Pull Request Changes
              
              
                jpwalters 630abe7
              
                Conference Call: Join/Listen - Pull Request Changes.
              
              
                jpwalters File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| function joinConference(params) { | ||
| params = $.extend(params, { 'Digits': 1 }); | ||
| window.parent.Client.call(params) | ||
| } | ||
|  | ||
| $(document).ready(function(){ | ||
| jQuery(function($) { | ||
| $(function(){ | ||
|  | ||
| var | ||
| calls = {}, | ||
| select = $('#calls'), | ||
| updateCalls = function() { | ||
| $.getJSON(window.location + '/?json=1', function(data) { | ||
| $.each(data, function(conference_name, call) { | ||
| if(!calls[conference_name]) { | ||
| calls[conference_name] = call; | ||
|  | ||
| row = '<tr class="items-row" id="' + call.friendly_name + '">'; | ||
| row += '<td>' + call.date_created + '</td>'; | ||
| row += '<td>' + call.friendly_name + '</td>'; | ||
| row += '<td>' + call.status + '</td>'; | ||
| row += '<td><a href="#" class="join">Join</a></td>'; | ||
| row += '<td><a href="#" class="listen">Listen</a></td></tr>'; | ||
|  | ||
| select.append(row); | ||
| } | ||
| }); | ||
|  | ||
| $.each(calls, function(conference_name, call) { | ||
| if(!data[conference_name]) { | ||
| delete calls[conference_name]; | ||
| $('#' + conference_name).fadeOut(250, function() { | ||
| $(this).remove(); | ||
| }); | ||
| } | ||
| }); | ||
| }); | ||
| }; | ||
|  | ||
| updateCalls(); | ||
| setInterval(updateCalls, 5000); | ||
| }); | ||
|  | ||
| $('#calls').delegate('.join', 'click', function(e) { | ||
| e.preventDefault(); | ||
|  | ||
| joinConference({ | ||
| 'conference_name': $(this).closest('tr').attr('id'), | ||
| 'muted': 'false', | ||
| 'beep': 'true' | ||
| }); | ||
| }); | ||
|  | ||
| $('#calls').delegate('.listen', 'click', function(e) { | ||
| e.preventDefault(); | ||
|  | ||
| joinConference({ | ||
| 'conference_name': $(this).closest('tr').attr('id'), | ||
| 'muted': 'true', | ||
| 'beep': 'false' | ||
| }); | ||
| }); | ||
| }); | ||
| }); | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| <?php | ||
|  | ||
| if(isset($_GET['json'])): | ||
|  | ||
| $account = OpenVBX::getAccount(); | ||
| $conferences = $account->conferences->getIterator(0, 50, array('Status' => 'in-progress')); | ||
|  | ||
| $res = array(); | ||
|  | ||
| foreach($conferences as $call) { | ||
| $res[$call->friendly_name] = array( | ||
| 'date_created' => date("F j, Y, g:i a",strtotime($call->date_created)), | ||
| 'friendly_name' => $call->friendly_name, | ||
| 'status' => $call->status, | ||
| 'duration' => $call->duration | ||
| ); | ||
| } | ||
|  | ||
| header('Content-type: application/json'); | ||
| echo json_encode($res); | ||
| exit; | ||
|  | ||
| endif; | ||
|  | ||
| OpenVBX::addJS('pages/conferences.js'); | ||
|  | ||
| ?> | ||
| <div class="vbx-content-main"> | ||
| <div class="vbx-content-menu vbx-content-menu-top"> | ||
| <h2 class="vbx-content-heading">Conference Calls In Progress</h2> | ||
| </div><!-- .vbx-content-menu --> | ||
| <div class="vbx-content-container"> | ||
| <div class="vbx-content-section"> | ||
| <table class="vbx-items-grid" border="0"> | ||
| <thead> | ||
| <tr class="items-head"><th>Start Time</th><th>Conference Name</th><th>Status</th><th>Join</th><th>Listen</th></tr> | ||
| </thead> | ||
| <tbody id="calls"> | ||
| </tbody> | ||
| </table> | ||
| </div><!-- .vbx-content-section --> | ||
| </div><!-- .vbx-content-container --> | ||
| </div><!-- .vbx-content-main --> | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,6 +1,12 @@ | ||
| { | ||
| "name" : "Standard", | ||
| "author" : "Twilio <[email protected]>", | ||
| "description" : "Standard set of applets for OpenVBX", | ||
| "url" : "http://openvbx.org" | ||
| "name" : "Standard", | ||
| "author" : "Twilio <[email protected]>", | ||
| "description" : "Standard set of applets for OpenVBX", | ||
| "url" : "http://openvbx.org", | ||
| "links" : [{ | ||
| "menu" : "Conferences", | ||
| "url" : "conferences/manager", | ||
| "script" : "pages/conferences.php", | ||
| "label" : "Manager" | ||
| }] | ||
| } | 
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh, just noticed this, but
$(document).ready(function() {});,jQuery(function($) {});and$(function() {});all do the same thing... so we've got 3 levels of code all waiting for DOMReady. Fortunately jQuery is smart enough to automatically fire event listeners for DOMReady if they're registered after the DOM is ready.