Browse Month

May 2014

Video Conferencing Endpoint Not Saving CDR in TMS

There was this one Tandberg VC endpoint, that we call SGP, on our network that would not save any call detail records into our TelePresence Management Suite.

VCreachableLAN

This particular endpoint was set up with a public IP address facing the public internet, so we thought maybe there were some firewall rules blocking the CDR being sent to TMS. Before asking the network engineers to look at the firewall and network rules, I tried playing with every single setting on the endpoint that I could think of. Nothing that I changed would get the CDR to save.

One day, while I was looking at the settings for a different device in TMS, I noticed a tab called Connection. In that area, there was a “System Connectivity” dropdown menu with “Reachable on LAN” chosen. Then I thought to myself, what if I change it to “Reachable on Public Internet” for the SGP VC endpoint? Because SGP was facing the public internet after all…

VCconnectivity

Solution: I went to SGP’s Connection page in TMS, changed the connectivity to “Reachable on Public Internet”, pressed Save, and made a test video call to the endpoint. Lo and behold, the CDR was sent to TMS!

VCcallLogs

Now we can finally start gathering CDR for this VC endpoint after years of deployment, and we can give proper usage reports to our managers.

Bash Script Not Writing to File

I was making a bash script, cron_its_servicenow.sh, that uses cURL and regex to grab 6 chart images (that are encoded in base64) from 6 ServiceNow published reports, and then writing them to a file, page_its.php. Here’s the code:

#!/bin/bash

file=/var/www/dashboard/it/page_its.php

urls=(
	"https://*.service-now.com/sys_report_display.do?sysparm_report_id=*1*"
	"https://*.service-now.com/sys_report_display.do?sysparm_report_id=*2*"
	"https://*.service-now.com/sys_report_display.do?sysparm_report_id=*3*"
	"https://*.service-now.com/sys_report_display.do?sysparm_report_id=*4*"
	"https://*.service-now.com/sys_report_display.do?sysparm_report_id=*5*"
	"https://*.service-now.com/sys_report_display.do?sysparm_report_id=*6*"
)

for (( i = 0 ; i < ${#urls[@]} ; i++ )) do
	result[$i]=`curl -s ${urls[$i]} | sed -rn 's/.*<img usemap="#" class="chart" src="(.+)"><\/img>.*/\1/p'`
done

echo '<div class="row shadow">' > $file
echo '<h3>IT Services</h3>' >> $file
echo '<div class="col-md-4"><img src="'${result[0]}'" class="img-responsive" /></div>' >> $file
echo '<div class="col-md-4"><img src="'${result[1]}'" class="img-responsive" /></div>' >> $file
echo '<div class="col-md-4"><img src="'${result[2]}'" class="img-responsive" /></div>' >> $file
echo '</div>' >> $file
echo '<div class="row shadow">' >> $file
echo '<div class="col-md-4"><img src="'${result[3]}'" class="img-responsive" /></div>' >> $file
echo '<div class="col-md-4"><img src="'${result[4]}'" class="img-responsive" /></div>' >> $file
echo '<div class="col-md-4"><img src="'${result[5]}'" class="img-responsive" /></div>' >> $file
echo '</div>' >> $file

It was working fine when I was running it in SSH like this:

root@server ~# /var/www/dashboard/it/cron_its_servicenow.sh

No errors, and the page_its.php file was getting the data written to it.

But then I logged into the web control panel and set up the Scheduled Cron Job, all these errors popped up when I ran the cron job:

Execute Cron Job
Output from command /var/www/dashboard/it/cron_its_servicenow.sh ..

/var/www/dashboard/it/cron_its_servicenow.sh: line 18: /var/www/dashboard/it/page_its.php: Permission denied
/var/www/dashboard/it/cron_its_servicenow.sh: line 19: /var/www/dashboard/it/page_its.php: Permission denied
/var/www/dashboard/it/cron_its_servicenow.sh: line 20: /var/www/dashboard/it/page_its.php: Permission denied
/var/www/dashboard/it/cron_its_servicenow.sh: line 21: /var/www/dashboard/it/page_its.php: Permission denied
/var/www/dashboard/it/cron_its_servicenow.sh: line 22: /var/www/dashboard/it/page_its.php: Permission denied
/var/www/dashboard/it/cron_its_servicenow.sh: line 23: /var/www/dashboard/it/page_its.php: Permission denied
/var/www/dashboard/it/cron_its_servicenow.sh: line 24: /var/www/dashboard/it/page_its.php: Permission denied
/var/www/dashboard/it/cron_its_servicenow.sh: line 25: /var/www/dashboard/it/page_its.php: Permission denied
/var/www/dashboard/it/cron_its_servicenow.sh: line 26: /var/www/dashboard/it/page_its.php: Permission denied
/var/www/dashboard/it/cron_its_servicenow.sh: line 27: /var/www/dashboard/it/page_its.php: Permission denied
/var/www/dashboard/it/cron_its_servicenow.sh: line 28: /var/www/dashboard/it/page_its.php: Permission denied

What??

I couldn’t find out what was wrong. I was trying things like changing echo to cat, adding tee, using sudo, etc. It turns out that it was such a simple mistake… I forgot to set the file permissions of page_its.php to be writable.

Solution: I did chmod 666 page_its.php, and all is working well now.

Execute Cron Job
Output from command /var/www/dashboard/it/cron_its_servicenow.sh ..

No output generated

Excellent!