Skip to content

Instantly share code, notes, and snippets.

@chrismatthieu
Created July 28, 2011 21:47
Show Gist options
  • Save chrismatthieu/1112662 to your computer and use it in GitHub Desktop.
Save chrismatthieu/1112662 to your computer and use it in GitHub Desktop.
Burning Man Phono Demo
<html>
<head>
<script src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script src="http://s.phono.com/releases/0.2/jquery.phono.js"></script>
</head>
<body>
<input id="call" type="button" disabled="true" value="Loading..." />
<div id="pickupbutton" style="display:none"><input id="pickup" type="button" value="pickup" /></div>
<div id="hangupbutton" style="display:none"><input id="hangup" type="button" value="hangup" /></div>
<span id="status"></span>
<script>
$(document).ready(function(){
var phono = $.phono({
apiKey: "6e442b984dfa26cd102423b7bc5aaebd",
onReady: function() {
$("#call").attr("disabled", false).val("Call");
alert("My SIP address is sip:" + this.sessionId);
},
phone: {
onIncomingCall: function(event) {
var call = event.call;
// alert("Incoming call");
$("#pickupbutton").show();
$("#pickupbutton").click(function() {
call.answer();
$("#pickupbutton").hide();
$("#hangupbutton").show();
});
$("#hangupbutton").click(function() {
call.hangup();
$("#pickupbutton").show();
$("#hangupbutton").hide();
});
}
}
});
$("#call").click(function() {
$("#call").attr("disabled", true).val("Busy");
// sip:9996138068@sip-noproxy.voxeo.net
// app:9996138068
phono.phone.dial("sip:9996138068@sip-noproxy.voxeo.net", {
headers: [{
name:"x-numbertodial",
value:"14802191300"
}],
onRing: function() {
$("#status").html("Ringing");
},
onAnswer: function() {
$("#status").html("Answered");
},
onHangup: function() {
$("#call").attr("disabled", false).val("Call");
$("#status").html("Hangup");
}
});
});
})
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment