Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added mute and hangup for organizer

  • Loading branch information...
commit 96540a83b480b4fe7395ffa25512183e5b3021a6 1 parent a3d9b01
Chris Matthieu authored
BIN  .DS_Store
View
Binary file not shown
BIN  app/assets/images/headphones.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  app/assets/images/mic.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  app/assets/images/microphone.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 app/assets/stylesheets/application.css
View
@@ -600,3 +600,23 @@ div#pimped.bubble div.rounded {
div#pimped.bubble cite.rounded {
background: transparent url(/assets/tip-pimped.gif) no-repeat 15px 0;
}
+
+#attendees {
+ width: 450px;
+ border: 0px solid white;
+ padding: 0px;
+ padding-bottom: 0;
+ margin-bottom: 20px;
+ background-color: #fff;
+ text-align: left;
+ height: auto !important;
+ font-size: 0.9em;
+ line-height: 14px;
+
+}
+
+input.telephone_button
+{
+ font-size:10px;
+ height:20px;
+}
5 app/views/layouts/application.html.erb
View
@@ -66,7 +66,10 @@
<% end %>
<%= link_to @current_user.username.capitalize, "/" + @current_user.username %> |
<%= link_to 'Logout', '/logout' %><br/>
- <%#button_to_function "Launch Dialpad", "popitup('/telephone')" %>
+ <%= button_to_function "Dialpad", "popitup('/telephone')", :class => "telephone_button" %>
+ <a href="https://twitter.com/share" class="twitter-share-button" data-count="none"
+ data-text="Join me now on a social twelephone call!">Tweet</a>
+
<% else %>
<a href="/auth/twitter"><%= image_tag "twitter_login.png" %></a>
<% end %>
15 app/views/users/show.html.erb
View
@@ -33,19 +33,19 @@
buttonTextReady: "CLICK TO CALL",
username: "<%=@username%>",
myusername: "<%=@current_user.username%>",
- slideOpen:false,
+ myphoto: "<%=@current_user.photo%>",
+ slideOpen:true,
dialPad: false
})
)
</script>
</center>
+
<center>
- <div><br/>
- <a href="https://twitter.com/share" class="twitter-share-button" data-count="none"
- data-text="Join me now on a social twelephone call!">Tweet</a>
+ <div id="attendees">
</div>
- </center>
+ </center>
<% else %>
@@ -85,4 +85,7 @@
<!-- Invite <%=params[:user]%> -->
</div>
<% end %>
-<% end %>
+<% end %>
+
+<audio id="audio_new_pm" src="/audio/new_pm.mp3" preload="auto"></audio>
+<audio id="audio_msg" src="/audio/sound.mp3" preload="auto"></audio>
BIN  public/.DS_Store
View
Binary file not shown
BIN  public/audio/new_pm.mp3
View
Binary file not shown
BIN  public/audio/new_pm.wav
View
Binary file not shown
BIN  public/audio/sound.mp3
View
Binary file not shown
BIN  public/audio/sound.wav
View
Binary file not shown
90 public/javascripts/callme.js
View
@@ -2,7 +2,11 @@
$.fn.callme = function( options ) {
- var thisPhone = this, dispatcher = $({}), callMeOptions = {}, phono, call;
+ // test = app:9996101245
+ // prod = app:9996162282
+
+ var thisPhone = this, dispatcher = $({}), callMeOptions = {}, phono, call, mysession;
+ var attendees = {"data" : []}
var settings = {
apikey : "",
dialpad: true,
@@ -62,6 +66,7 @@
(this.checked)? call.mute(true): call.mute(false);
}
});
+
dispatcher.bind({
// phono is ready, bind events to the call button
@@ -83,6 +88,7 @@
apiKey: settings.apikey,
onReady: function(){
dispatcher.trigger("phonoReady");
+ mysession = this.sessionId;
$.ajax({ url: '/api/update_phonoaddress', data: { 'mysession': this.sessionId}, type: 'get' })
},
phone: {
@@ -93,12 +99,68 @@
messaging: {
onMessage: function(event) {
var message = event.message;
- alert("Message from: " + message.from + "\n" + message.body);
+ // message is formatted as username:photourl:jid:status (joined, dropped, etc.)
+
+ var body = message.body
+ var split = body.split('~');
+ var datausername = split[0];
+ var dataphotourl = split[1];
+ var datajid = split[2];
+ var datastatus = split[3];
+
+ // alert("Message from: " + message.from + "\n" + datausername + "-" + dataphotourl + "-" + datajid + "-" + datastatus );
+ // alert("Message from: " + message.from + "\n" + message.body );
+
+ if(datastatus == 'joined'){
+ // attendees.data.push({"username" : datausername,"photo" : dataphotourl, "jid" : datajid})
+
+ // Add Avatar of new attendee to organizer's page
+ $("#attendees").append('<div id="' + datausername + '"><img src="' + dataphotourl + '" width="50" height="50"align="left" ></div>');
+
+ // Add Mute link/checkbox next to avatar
+ $("#" + datausername).append('<div id="' + datausername + 'mute"><input class="phono-user-mute-' + datausername + '" type="checkbox"> mute</div>');
+
+ $('.phono-user-mute-' + datausername).bind('click', function() {
+ phono.messaging.send( datajid, datausername + '~photo~' + datajid + '~mute');
+ });
+
+ // Add Hangup link/checkbox next to avatar
+ $("#" + datausername).append('<div id="' + datausername + 'hangup"><input class="phono-user-hangup-' + datausername + '" type="checkbox"> hangup</div><br/>');
+
+ $('.phono-user-hangup-' + datausername).bind('click', function() {
+ phono.messaging.send( datajid, datausername + '~photo~' + datajid + '~hangup');
+ });
+
+
+ // Play sound when new attendee joins conference
+ try { $("#audio_new_pm")[0].play(); } catch(e) {}
+ // try { $("#audio_msg")[0].play(); } catch(e) {}
+ }
+ if(datastatus == 'left'){
+ // // attendees.data.pop({"username" : datausername,"photo" : dataphotourl, "jid" : datajid})
+ $("#" + datausername).remove();
+ try { $("#audio_msg")[0].play(); } catch(e) {}
+ }
+ if(datastatus == 'mute'){
+ call.mute(true);
+ }
+ if(datastatus == 'unmute'){
+ call.mute(false);
+ }
+ if(datastatus == 'hangup'){
+ call.hangup();
+ }
+
}
}
});
});
+
+ // function muteAttendee( username, jid ){
+ // // phono.messaging.send( jid, username + '~photo~' + jid + '~mute');
+ // alert('test');
+ // };
function buildPhone( settings ){
var phoneHldr = $( "<div/>")
@@ -129,7 +191,7 @@
"font-size":"75%",
"text-align":"center"
})
- .html("<input class='phono-mic-toggle' type='checkbox'/> Wearing a headset?")
+ .html("<input class='phono-mic-toggle' type='checkbox'/><img src='/assets/headphones.png' width='32'> Wearing a headset?")
.appendTo(phoneContent);
if(settings.slideopen)
@@ -144,7 +206,7 @@
"font-size":"75%",
"text-align":"center"
})
- .html("<input class='phono-mute-toggle' type='checkbox'/> Mute?")
+ .html("<input class='phono-mute-toggle' type='checkbox'/><img src='/assets/microphone.png' width='32'> Mute?")
.appendTo(phoneContent);
if(settings.slideopen)
@@ -238,15 +300,28 @@
{
name:"x-myusername",
value: settings.myusername
+ },
+ {
+ name:"x-myphoto",
+ value: settings.myphoto
+ },
+ {
+ name:"x-myjid",
+ value: mysession
}],
onAnswer: function(event) {
phoneBtn.text("CLICK TO HANGUP");
},
onHangup: function() {
hangUpCall(settings, phone);
+ $("#attendees").empty();
+ try { $("#audio_msg")[0].play(); } catch(e) {}
+
},
onDisconnect: function() {
hangUpCall(settings, phone);
+ $("#attendees").empty();
+ try { $("#audio_msg")[0].play(); } catch(e) {}
}
});
}
@@ -268,4 +343,9 @@
};
-})( jQuery );
+})( jQuery );
+
+// function muteAttendee( username, jid ){
+// $.phono.messaging.send( jid, username + '~photo~' + jid + '~mute');
+// // alert('test');
+// };
31 tropo.rb
View
@@ -4,17 +4,24 @@
@username = $currentCall.getHeader("x-username")
@myusername = $currentCall.getHeader("x-myusername")
+@myphoto = $currentCall.getHeader("x-myphoto")
+@myjid = $currentCall.getHeader("x-myjid")
log "user=" + @username
log "myuser=" + @myusername
+log "myphoto=" + @myphoto
+log "myjid=" + @myjid
-@getorg = RestClient.get 'http://twelephone.com/api/address/' + @username + '.json'
+apiurl = "http://web1.tunnlr.com:11053"
+# apiurl = "http://twelephone.com"
+
+@getorg = RestClient.get apiurl + '/api/address/' + @username + '.json'
@getorgdata = JSON.parse(@getorg)
if @getorgdata["sip"]
log "jabber=" + @getorgdata["sip"]
end
-message @myusername + ' joined twelephone call', {
+message @myusername + '~' + @myphoto + '~' + @myjid + "~joined", {
:to => @getorgdata["sip"],
:network => "JABBER"}
@@ -28,15 +35,11 @@
say "now tweet this link for others to join you. twelephone dot com slash " + @username
conference @confid , {
- :terminator => "#",
- :playTones => true,
- :onChoice => lambda { |event|
- say("Disconnecting")
- },
- :onHangup => lambda { |event|
- message @myusername + ' left twelephone call', {
- :to => @getorgdata["sip"],
- :network => "JABBER"}
-
- }}
-say "We hope you had fun, call back soon!"
+ :playTones => true
+ }
+
+if !$currentCall.isActive
+ message @myusername + '~' + @myphoto + '~' + @myjid + "~left", {
+ :to => @getorgdata["sip"],
+ :network => "JABBER"}
+end
Please sign in to comment.
Something went wrong with that request. Please try again.