AnsweredAssumed Answered

Using the clish for setting the Local Directory on LifeSize Icons

Question asked by helpdesk@hivos.org on Jul 20, 2015
Latest reply on Jul 23, 2015 by srankin

Hi,

 

Our first post in this community will be a question..

 

For easy use we want to automate the setting of all the Local Directory entries on our LifeSize Icon 400 en 600 systems. To do so we write the next the script:

 

reset_local_directory

#!/bin/bash

#

echo "

Take care that resty and jq are installed:

- https://github.com/micha/resty

- http://stedolan.github.io/jq/

"

 

if [ $# -ne 2 ]; then

        echo -e `basename $0`" IPADDRESS ADMIN_PASS\n"

        exit

fi

 

. resty

 

resty "https://$1/rest/" -u admin:"$2" -k || {

        echo "Error connecting to icon rest interface"

        exit 1

}

 

RESULT=$(PUT /new) || {

        echo "Error getting new session"

        exit 1

}

 

# Parse out the session id

session=$(echo "${RESULT}" | jq -e -r .session 2> /dev/null ) || {

        echo "Error retrieving session number."

  exit 1

}

 

#Removing all entries in the local directory

echo "Remving all entires in the local directory of the LifeSize system on ip address "$IPADDRESS

RESULT=$(PUT /request/"${session}" '{ "call": "Local_Directory_clearAllEntries" }') || {

        echo "Error removing all entries in the local directory"

        exit 1

}

 

echo "

 

Now login into the shell of this LifeSize Icon system using:

 

# ssh admin@$1

 

Using password: $2

 

After successful login change into the 'clish' command to enter the “legacy command line interface shell”:

 

rbsh> clish

$

 

Now we can add the initial items to the local directory executing the following commands, using copy and past:

 

set local entry '{ \"firstname\":\"**\", \"lastname\":\"Mediaroom\", \"number\":\"h323:xxx.xxx.xxx.xxx\", \"system\":\"** mediaroom\", \"protocol\":\"h323\", \"type\":\"video\" }'

set local entry '{ \"firstname\":\"**\", \"lastname\":\"Big meetingroom\", \"number\":\"h323:xxx.xxx.xxx.xxx\", \"system\":\"** big meetingroom\", \"protocol\":\"h323\", \"type\":\"video\" }'

set local entry '{ \"firstname\":\"Jack\", \"lastname\":\"One\", \"number\":\"h323:xxx.xxx.xxx.xxx\", \"system\":\"** room Jack\", \"protocol\":\"h323\", \"type\":\"video\" }'

set local entry '{ \"firstname\":\"Bruce\", \"lastname\":\"Two\", \"number\":\"h323:xxx.xxx.xxx.xxx\", \"system\":\"** room Bruce\", \"protocol\":\"h323\", \"type\":\"video\" }'

set local entry '{ \"firstname\":\"RO A\", \"lastname\":\"Boardroom\", \"number\":\"h323:xxx.xxx.xxx.xxx\", \"system\":\"RO A boardroom\", \"protocol\":\"h323\", \"type\":\"video\" }'

set local entry '{ \"firstname\":\"RO B\", \"lastname\":\"Boardroom\", \"number\":\"h323:xxx.xxx.xxx.xxx:\", \"system\":\"RO B boardroom\", \"protocol\":\"h323\", \"type\":\"video\" }'

set local entry '{ \"firstname\":\"LO C", \"lastname\":\"Boardroom\", \"number\":\"h323:xxx.xxx.xxx.xxx\", \"system\":\"LO C boardroom\", \"protocol\":\"h323\", \"type\":\"video\" }'

set local entry '{ \"firstname\":\"RO D\", \"lastname\":\"Boardroom\", \"number\":\"h323:xxx.xxx.xxx.xxx\", \"system\":\"RO D boardroom\", \"protocol\":\"h323\", \"type\":\"video\" }'

set local entry '{ \"firstname\":\"RO E", \"lastname\":\"Boardroom\", \"number\":\"h323:xxx.xxx.xxx.xxx\", \"system\":\"RO E boardroom\", \"protocol\":\"h323\", \"type\":\"video\" }'

set local entry '{ \"firstname\":\"RO F", \"lastname\":\"Boardroom\", \"number\":\"h323:xxx.xxx.xxx.xxx\", \"system\":\"RO F boardroom\", \"protocol\":\"h323\", \"type\":\"video\" }'

"

 

But this script doesn't deliver the expected result. Because the call "Local_Directory_clearAllEntries" deletes all previous items from the local directory because although the "set local entry" calls do not add the new entries, although they did before the "Local_Directory_clearAllEntries" call..

 

Questions:

 

1. what do you think of this method?

2. does anybody have an idea what is causing this problem?

 

Regards

 

Ferry Bodijn

Hivos, The Netherlands

Outcomes