diff --git a/docs/samples/contact-center/app.js b/docs/samples/contact-center/app.js index b80188142c4..2000f2427d7 100644 --- a/docs/samples/contact-center/app.js +++ b/docs/samples/contact-center/app.js @@ -28,6 +28,7 @@ const agentLoginButton = document.querySelector('#loginAgent'); const dialNumber = document.querySelector('#dialNumber'); const registerStatus = document.querySelector('#ws-connection-status'); const logoutAgentElm = document.querySelector('#logoutAgent'); +const buddyAgentsDropdownElm = document.getElementById('buddyAgentsDropdown'); // Store and Grab `access-token` from sessionStorage if (sessionStorage.getItem('date') > new Date().getTime()) { @@ -183,6 +184,31 @@ function logoutAgent() { }); } +async function fetchBuddyAgents() { + try { + buddyAgentsDropdownElm.innerHTML = ''; // Clear previous options + const buddyAgentsResponse = await webex.cc.getBuddyAgents({mediaType: 'telephony'}); + + if (buddyAgentsResponse.data && buddyAgentsResponse.data.agentList.length === 0) { + console.log('The fetched buddy agents list was empty'); + buddyAgentsDropdownElm.innerHTML = `