Teams Meeting Macro - with meeting ID input

Note: I couldn’t fit the Teams custom icon into the post so it instead uses one of the default icons.

This will add a Teams meeting button to your Cisco touch panel, pressing it will let you input the Conference ID for the meeting. It also has the option to define a prefix if you use that for Teams meetings in your deployment.


image

This macro is based on the Speed dial for Teams Meetings and the Join 3rd Party Meeting macros.

import xapi from 'xapi';

// Define the domain for the meeting service you are using.  Eg. @zoomcrc.com, @MSTeams.tenant, @yourbridge.com
const meetingDomain = '@your.video.domain';

/* if you use a prefix in routing rules or leave blank if not */
const PRE_FIX = '99';

const KEYBOARD_TYPES = {NUMERIC: 'Numeric'};

const MEETING_ID = 'meetingID';

/* This will be the Panel/Widget ID you are using in the UI Extension */
const CALL_PANELID = 'JoinTeamsPanel'; 

/* Use this one if you want to limit calls to numeric only. In this example, require number to be between 3 and 10 digits. */
const REGEXP_NUMERICDIALER =  /^([0-9]{8,35})$/; 

function getMeetingID(text, value = ''){

  xapi.Command.UserInterface.Message.TextInput.Display({
    InputType: KEYBOARD_TYPES.NUMERIC,
    Placeholder: `Conference ID`,
    Title: "Join Meeting", /* Create a custom title for your meeting Input Display here */
    Text: text,
    InputText: value,
    SubmitText: "Join",
    FeedbackId: MEETING_ID,
    })
  .catch((error) => console.error(error));
}


/* This is the listener for the in-room control panel button that will trigger the dial panel to appear */
xapi.Event.UserInterface.Extensions.Panel.Clicked.on((event) => {
    if(event.PanelId === CALL_PANELID){
         getMeetingID("Enter the Conference ID from your invite:" );
    }
});


/* Event listener for the dial pad being posted */
xapi.Event.UserInterface.Message.TextInput.Response.on((event) => {
    switch(event.FeedbackId){
        case MEETING_ID:
          /* Change this to whatever filter you want to check for validity */
          const regex = REGEXP_NUMERICDIALER; 
          const match = regex.exec(event.Text);

          if (match) {
			      const meetingID = match[1];
            const at = meetingDomain.startsWith('@') ? '' : '@';
            const Number =  PRE_FIX + meetingID + at + meetingDomain;
            console.log('Dial:', Number);
            xapi.Command.Dial({ Number });
          }
          else{
              getMeetingID("You typed in an invalid number. Please try again.", event.Text );
          }
          break;
    }
});
/* create a pretty Teams button */
xapi.Command.UserInterface.Extensions.Panel.Save({ PanelId: 'JoinTeamsPanel' }, `
<Extensions>
  <Version>1.8</Version>
  <Panel>
    <PanelId>JoinTeamsPanel</PanelId>
    <Type>Home</Type>
    <Name>Teams Meeting</Name>
    <ActivityType>Custom</ActivityType>
    <Icon>Camera</Icon>   
  </Panel>
</Extensions>
`);
1 Like