Skip to content

Instantly share code, notes, and snippets.

@taf2
Created June 20, 2024 13:04
Show Gist options
  • Save taf2/d1e2e8ff8356f4bce0fb6e2d561e6ade to your computer and use it in GitHub Desktop.
Save taf2/d1e2e8ff8356f4bce0fb6e2d561e6ade to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Home Page</title>
<script src="https://<%= ctm_host %>/ctm-phone-embed-1.0.js"></script>
</head>
<body>
<h1>Your Application</h1>
<p>Embedding the CTM Phone</p>
<ctm-phone-embed access="/api/ctm_access" popout="/device"></ctm-phone-embed>
<script>
document.addEventListener('DOMContentLoaded', function() {
const ctmPhone = document.querySelector('ctm-phone-embed');
// you can do this or rely on the access attribute
// ctmPhone.accessToken = '<%= ctm_access %>';
ctmPhone.addEventListener('ctm:ready', function(e) {
console.log('CTM Phone is ready', e);
// TODO: get screenpop information from the custom fields
//
// for auto answer make sure we have an event for call start/connected
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment