cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
680
Views
0
Helpful
4
Replies

CE9.2.1 Macro Framework with Touch 10

mmhm
Level 1
Level 1

Anyone can tell me why my button action is not working for this macro code ? I have added a button with Id 'callCatering' and added this macro. But I keep pressing that button which I have created in UI Extensions configuration. But no call is coming. 

 

const xapi = require('xapi');

const number_to_dial = '8771';

function listenToGui() {
xapi.event.on('UserInterface Extensions Widget Action', (event) => {
//console.log('event', event.WidgetId);
if (event.WidgetId == 'callCatering'){
xapi.command('Dial', {'Number': number_to_dial});
}
});
}


listenToGui();

 

 

 

However, if I use this following macro code as soon as I am saving, I am getting the call. 

 

const xapi = require('xapi');

const number_to_dial = '8771';

xapi.command('Dial', {'Number': number_to_dial});

4 Replies 4

asri.zainal
Level 1
Level 1

Try adding event type like below:

 

if (event.WidgetId === 'callCatering' && event.Type === 'clicked'){
xapi.command('Dial', {'Number': number_to_dial});
}

I tried that. But click the button is not doing anything. 

davisjaron
Level 1
Level 1
Let's try this. 
 
Use this for your javascript file:
 
const xapi = require('xapi');

const number_to_dial = '8771';

xapi.event.on('UserInterface Extensions Page Action', (event) => {
if(event.Type == 'Opened' && event.PageId == 'callCateringPage'){
xapi.command("dial", {Number: number_to_dial});
}
});
 
Now use this for your XML file:
<Extensions>
<Version>1.5</Version>
<Panel>
<PanelId>callCateringPanel</PanelId>
<Type>Home</Type>
<Icon>Handset</Icon>
<Order>1</Order>
<Name>Call Catering</Name>
<Page>
<Name>Dialing</Name>
<Row>
<Name>Row</Name>
<Widget>
<WidgetId>callCateringWidget</WidgetId>
<Name>Number is being dialed</Name>
<Type>Text</Type>
<Options>size=4;align=center;fontSize=normal</Options>
</Widget>
</Row>
<PageId>callCateringPage</PageId>
<Options>hideRowNames=1</Options>
</Page>
</Panel>
</Extensions>

Wayne DeNardi
VIP Alumni
VIP Alumni

Have a look at the Speed Dials example on github.

Wayne

Please remember to mark helpful responses and to set your question as answered if appropriate.