02-12-2024 07:16 PM
Issue to solve: Zoom API constantly changes the SIP number each time the unit disconnects and reconnects to the API. In order for the speed dial to work the unit MUST dial in using the assigned SIP address so it's recognized as a CRC license unit for any zoom meeting the CE joins.
--------------macro-------
02-21-2024 12:40 PM
HERE IS MY FULL WORKING SCRIPT
Create a speed dial on the home screen for a contact in the CE address book.
Issue - Zoom API constantly changes the uri for the Zoom contact it places in the "Favorites" directory. We wanted to create a speed dial on the home screen for calling zoom with the uri set by the Zoom API. Why? Because if you dial zoom using the uri in the Favorites contact, then zoom recognizes you are calling in from a CRC licensed account and now it does not matter if the host has a zoom crc license or not. A speed dial on the home screen is wanted so special instructions are not need for users to join a zoom meeting with CRC support and a normal speed dial would not work as the uri changes frequently.
Solution: Create a macro that searches the phonebook for a "SearchString" matching part of the contact name, find the contact, extract the uri and then dials the uri.
I hope someone finds this useful as I search high and low and banged my head against the wall until I finally got it to work properly. Enjoy!
----begin code----
const xapi = require('xapi');
function callZoom(contact) {
console.log("Zoom contact found:", contact); // Log the Zoom contact details
// Extract the the contact details
const sipUri = contact.Contact[0].ContactMethod[0].Number;
if (sipUri && sipUri[1]) {
const phoneNumber = sipUri[1];
console.log("Zoom phone number:", sipUri ); // Log the extracted phone number
// Use the extracted phone number to initiate a dial command
xapi.command('dial', { Number: phoneNumber, Protocol: 'Sip'});
} else {
console.log("No Zoom phone number found.");
// Handle the case where the Zoom phone number is not found or does not match the expected pattern
}
}
// Only run when the home-screen panel-icon called Zoom-Call is clicked
xapi.event.on('UserInterface Extensions Panel Clicked', (event) => {
if (event.PanelId === 'Zoom-Call') {
//Run a search against the Phone book - SearchString is most important here
xapi.command('Phonebook Search',
{PhonebookType: "Local", SearchString: "Zoom", SearchFilter: "People", ContactType: "Contact"}).then(callZoom);
}});
------END OF CODE---------------
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide