cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
365
Views
0
Helpful
1
Replies

Zoom CRC Help with Speed Dial Macro

dboggs
Level 1
Level 1

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-------

const xapi = require('xapi');

function callZoom(contact){
  console.log(contact);
}

xapi.event.on('UserInterface Extensions Panel Clicked', (event) => {
if (event.PanelId === 'Zoom-Call') {

xapi.command('Phonebook Search',
  {PhonebookType"Local"SearchString"Zoom"SearchFilter"People"ContactType"Contact"}).then(callZoom);
}

});
--------end of macro----
results in console
 
21:08:57Zoom-Call{"Contact":[{"ContactId":"localContactId-1","ContactMethod":[{"CallRate":"1920","CallType":"Video","ContactMethodId":"1","Device":"Video","Number":"0..10000320000112..02.11abcdef@vip2.zoomcrc.com","Protocol":"SIP","id":"1"}],"Name":"Join Zoom Meeting","Tag":"Favorite","id":"1"}],"ResultInfo":{"Limit":"50","Offset":"0","TotalRows":"1"},"status":"OK"}
 
What's the next step in code to get the unit to 'Dial' the number found in the contact?
Thoughts?  Ideas?
1 Reply 1

dboggs
Level 1
Level 1

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---------------