Skip to content

Instantly share code, notes, and snippets.

@mheadd
Created October 10, 2011 17:12
Show Gist options
  • Select an option

  • Save mheadd/1275816 to your computer and use it in GitHub Desktop.

Select an option

Save mheadd/1275816 to your computer and use it in GitHub Desktop.
Simple phono web page.
<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..." />
<span id="status"></span>
<script>
$(document).ready(function(){
var phono = $.phono({
apiKey: "your-api-key-here", // Get your API key at http://phono.com
onReady: function() {
console.log("Phono Session ID: " + this.sessionId);
$("#call").attr("disabled", false).val("Call");
},
phone: {
onIncomingCall: function(event) {
var call = event.call;
alert("Incoming call");
}
}
});
$("#call").click(function() {
$("#call").attr("disabled", true).val("Busy");
phono.phone.dial("14075551212", {
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