cancel
Showing results for 
Search instead for 
Did you mean: 
cancel

Event Undefined

Hello All,

 

just starting out working with Macros but can't seem to get the button event correct.

 

Here's the XML:

<Extensions>
  <Version>1.5</Version>
  <Panel>
    <PanelId>CallMeetingPanelID</PanelId>
    <Type>Home</Type>
    <Icon>Language</Icon>
    <Order>1</Order>
    <Color>#07C1E4</Color>
    <Name>Call Meeting</Name>
  </Panel>
</Extensions>

Here's the macro:

const xapi = require('xapi');

const CallBtn_ID = 'CallMeetingPanelID';
const MeetingNumber_ID = 'meetingnumber';
const MeetingPassword_ID = 'meetingpassword';

const urlsuffix = '@199.48.152.152'
var meetingnumber = '';
var meetingpassword = '';
var fulldialstring = '';

function ShowEnterMeetingNumber()
{
  xapi.command('UserInterface Message TextInput Display',{
      FeedbackId:MeetingNumber_ID,
      Title:'Enter the Meeting ID',
      Text:'',
      SubmitText:'Next'
    });
}

function ShowEnterMeetingPassword()
{
  xapi.command('UserInterface Message TextInput Display',{
      FeedbackId:MeetingPassword_ID,
      Title:'Enter Metting Password',
      Text:'',
      SubmitText:'Call'
    });
}


function fnTextEntryHandler(event)
{
  console.log('@ fnTextEntryHandler');
  console.log('-- event.Text = ' + event.Text);
  
  switch(event.FeedbackId)
  {
    case MeetingNumber_ID:
      meetingnumber = event.Text;
      ShowEnterMeetingPassword;
      break;
    case MeetingPassword_ID:
      meetingpassword = event.Text;
      fulldialstring = meetingnumber + '.' + meetingpassword + urlsuffix;
      xapi.command('Dial',{Number: fulldialstring});
      break;
  }
}

function fnCallMeeting(event)
{
  console.log('@ fnCallMeeting');
  console.log('-- event          = '+ event);
  console.log('-- event.PanelID  = ' + event.PanelID);
  console.log('-- event.WidgetID = ' + event.WidgetID);
  console.log('-- event.Type     = ' + event.Type);
  console.log('-- event.Text     = ' + event.Text);
  if (event.PanelID === CallBtn_ID)
  {
    ShowEnterMeetingNumber(); 
  }
}


/* Event Listeners to Function Mapping *********************************************/
xapi.event.on('UserInterface Extensions Panel Clicked',fnCallMeeting);
xapi.event.on('UserInterface Message TextInput Response', fnTextEntryHandler);

Here's the Log output:

11:53:59	Untitled1		Loading...
11:53:59	[system]		Starting macros...
11:53:59	[system]		Macros ready.
11:54:28	Untitled1		'@ fnCallMeeting'
11:54:28	Untitled1		'-- event          = [object Object]'
11:54:28	Untitled1		'-- event.PanelID  = undefined'
11:54:28	Untitled1		'-- event.WidgetID = undefined'
11:54:28	Untitled1		'-- event.Type     = undefined'
11:54:28	Untitled1		'-- event.Text     = undefined'

Here's the SSH output:

*e UserInterface Extensions Panel Clicked PanelId: "CallMeetingPanelID"
** end

 

Why is the event undefined???

0 REPLIES 0
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: