Created
November 9, 2010 18:59
-
-
Save chrismatthieu/669594 to your computer and use it in GitHub Desktop.
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
| <html> | |
| <head> | |
| <script src="http://code.jquery.com/jquery-1.4.2.min.js"></script> | |
| <script src="http://s.phono.com/releases/0.1/jquery.phono.js"></script> | |
| </head> | |
| <body> | |
| <input id="call" type="button" disabled="true" value="Loading..." /> | |
| <div id="pickup2" style="display:none"><input id="pickup" type="button" value="pickup" /></div> | |
| <div id="hangupdiv" 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 Address address is sip:" + this.sessionId); | |
| }, | |
| phone: { | |
| onIncomingCall: function(event) { | |
| var call = event.call; | |
| // alert("Incoming call"); | |
| $("#pickup2").show(); | |
| $("#pickup2").click(function() { | |
| call.answer() | |
| $("#pickup2").hide(); | |
| $("#hangupdiv").show(); | |
| }); | |
| $("#hangup").click(function() { | |
| call.hangup() | |
| $("#pickup2").show(); | |
| $("#hangupdiv").hide(); | |
| }); | |
| } | |
| } | |
| }); | |
| $("#call").click(function() { | |
| $("#call").attr("disabled", true).val("Busy"); | |
| call = phono.phone.dial("1-518-882-8647", { | |
| onRing: function() { | |
| $("#status").html("Ringing"); | |
| $("#hangupdiv").show(); | |
| $("#hangup").click(function() { | |
| call.hangup() | |
| $("#call").attr("disabled", false).val("Call"); | |
| $("#hangupdiv").hide(); | |
| }); | |
| }, | |
| 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