Last active
September 22, 2015 13:16
-
-
Save twilioforkwc/e9e098eba18231595f59 to your computer and use it in GitHub Desktop.
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
<script type="text/javascript"> | |
Twilio.Device.setup("<?php echo $token; ?>"); | |
Twilio.Device.ready(function (device) { | |
$("#log").text("架電待機"); | |
}); | |
Twilio.Device.error(function (error) { | |
$("#log").text("Error: " + error.message); | |
}); | |
Twilio.Device.connect(function (conn) { | |
$("#log").text("架電成功"); | |
}); | |
Twilio.Device.disconnect(function (conn) { | |
$("#log").text("架電終了"); | |
}); | |
Twilio.Device.incoming(function (conn) { | |
if (confirm('Accept incoming call from ' + conn.parameters.From + '?')){ | |
connection=conn; | |
conn.accept(); | |
} | |
}); | |
function clientCall() { | |
// get the phone number to connect the call to | |
params = {"PhoneNumber": $("#client_to_number").val()}; | |
Twilio.Device.connect(params); | |
} | |
function hangup() { | |
Twilio.Device.disconnectAll(); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment