cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
Please note that Remote Expert Mobile announced end-of-life and support will end on February 28, 2022.
329
Views
0
Helpful
0
Replies
julien.laffitte
Beginner

"Bookings Put" xAPI Command in a macro

Hello,

In the CE 9.13 Application Programming Interface (API) Reference Guide the xapi commands list was updated with the "xCommand Bookings Put" command to push meetings to the endpoint:

2020-09-09_101842.png

using this JSON format, we are trying to implement this command in a macro so that the terminal is able to push himself a booking(s) list:

const xapi = require('xapi');

//when the jsxapi connection is ready...
xapi.on('ready', () => {
  console.log('connection successful');
  pushBookingsList(console.log);
});

// Push the bookings list
function pushBookingsList(cb) {
  
  // JSON Bookings Data to be sent
  var payload =  {
  Bookings: [
      {
        Id: "1",
        Number: "123456789@my.domain",
        Organizer: {
          Name: "Organizer Name"
        },
        Protocol: "SIP",
        Time: {
          Duration: 60,
          EndTimeBuffer: 50,
          StartTime: "2020-09-10T14:00Z"
        },
        Title: "Push OBTP through Macro"
      }
    ]
  };
  xapi.command(
      'Bookings Put',{}, JSON.stringify(payload))
      .then((response) => {
        if ((response.StatusCode == 200) || (response.StatusCode == 201)) {
          console.log("Booking(s) Pushed Successfully to endpoint.")
          if (cb) cb(null, response.StatusCode)
          return
        }
              
        console.log("Booking(s) Push failed with status code: " + response.StatusCode)
        if (cb) cb("Booking(s) Push with status code: " + response.StatusCode, response.StatusCode)
      })
      .catch((err) => {
        console.log("Booking(s) Push failed with err: " + err.message)
        if (cb) cb("Could not Push the Booking(s) list to the endpoint.")
      })
  
}

However it does not work, we are getting a "Device not entitled" error when sending the command.

This feature is poorly documented and the error does not appear in any Cisco official document: would you have some additional information about this command and what is wrong in our code?

 

As a side note, the "xCommand Bookings List" works great:

const xapi = require('xapi');

//when the jsxapi connection is ready...
xapi.on('ready', () => {
  console.log('connection successful');
  getBookingsList();
});

// Get the bookings list
function getBookingsList() {
   
  try {
    var result = xapi.command('Bookings List', { Days: 10, Limit: 100 })
    // JSON Formatted Bookings Data
    .then((bookingsList) => { console.log(bookingsList)});
  }
  catch(err) {
    console.error(`cannot get bookings list.`);
    throw new Error("BOOKINGS_LIST_ERROR");
  }
}

Thanks for your help!

0 REPLIES 0
Content for Community-Ad

This widget could not be displayed.