Created
April 4, 2011 15:30
-
-
Save chrismatthieu/901834 to your computer and use it in GitHub Desktop.
phono 0.2 template
This file contains 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
<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"); | |
phono.phone.dial("4803194368", { | |
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