DVR5300 cannot retrieve playback when communicating using Pelco API / SDK

NOTICE

POTENTIAL FOR DATA LOSS.
The steps detailed in the resolution of this article may result in a loss of critical data if not performed properly. Before beginning these steps, make sure all important data is backed up in the event of data loss. If you are unsure, please contact Product Support Services prior to attempting the procedure below.

NOTICE

COMPLEX PROCEDURE REQUIRED.
The resolution of this article has many complex steps that may result in unforeseen results if not performed correctly. If you are at all unfamiliar with the requirements, please contact Product Support Services for assistance.

Issue

The services on the DVR5300 can sometimes be called servicename-NVR instead of servicename-1 which will cause Pelco API calls to fail

Product Line

Pelco Video Management

Environment

DVR5300 v1.4+

SM5000 v1.4+

SM5200 v1.4+

Cause

The services on the DVR5300 can sometimes be called servicename-NVR instead of servicename-1 which will cause Pelco API calls to fail.

Resolution

 
#backup NVRDevice.xml as NVRDevice.xml.orig and then run sed on NVRDevice.xml file to modify it
sed -i.orig -r "s:(/control/VideoOutput-).{1,3}():\11\2:g" /usr/local/Pelco/NSD/Public/NVRDevice.xml
 
#change the permissions on the modified NVRDevice.xml file
chmod 777 /usr/local/Pelco/NSD/Public/NVRDevice.xml
 
#delete the Rtm* files
rm -f /usr/local/Pelco/NSD/Public/Rtm*
 
#backup Config.xml as Config.xml.orig and change isSynced tag from "1" to "0"
sed -i.orig -r "s:()1():\10\2:g" /usr/local/Pelco/NSD/Private/Config.xml
 
#backup Config.xml as Config.xml.orig and change isRegistered tag from "1" to "0"
sed -i.orig -r "s:()1():\10\2:g" /usr/local/Pelco/NSD/Private/Config.xml
 
#change the permissions on the modified Config.xml file
chmod 777 /usr/local/Pelco/NSD/Private/Config.xml
 
#restart the nsdd service
 
/etc/init.d/nsdd restart
 
#done*NOTEThis 
Step 1: Determine which DVR5300s have service identifiers ending in "-NVR" by running this command as a one-time script on the SM:
 
/usr/local/pgsql/bin/psql -U pelco -d DeviceManager -c "select * from deviceattribute where name = 'SYS_UpnpDevDescUrl' and devicedbid in (select rootdbid from service where upnpid ilike '%-NVR' group by rootdbid order by rootdbid) order by value;"
 
*NOTE: The IP addresses in the "value" column of the sample output below can help identify the DVRs that are affected by this issue.
 
 
Step 2: Run this command as a one-time script on the SM to modify every service that ends in "-NVR" and change it to end in "-1" instead:

/usr/local/pgsql/bin/psql -U pelco -d DeviceManager -c "update service set upnpid = replace(upnpid,'-NVR','-1');"

 

Step 3: Run this command as a one-time script on the SM to modify every serviceattribute that ends in "-NVR" and change it to end in "-1" instead:

/usr/local/pgsql/bin/psql -U pelco -d DeviceManager -c "update serviceattribute set value = replace(value,'-NVR','-1');"

 


Now that the SM changes are complete, the next thing to do is to modify the files on each DVR5300 identified in Step 1.

 

Step 4: SSH into the DVR5300

[username: "root", password: "pel2899100"]


Step 5: Modify the NVRDevice.xml file while saving a backup by running the following command:

sed -i.orig -r "s:-NVR:-1:g"  /usr/local/Pelco/NSD/Public/NVRDevice.xml


Step 6: Change the permissions on the modified NVRDevice.xml file by typing:

chmod 777 /usr/local/Pelco/NSD/Public/NVRDevice.xml
 

Step 7: Delete the Rtm* files by typing:

rm -f /usr/local/Pelco/NSD/Public/Rtm*

 

Step 8: Use Endura Utilities, run Device Actions-->Reset Both on this DVR5300

*NOTE: This will cause the DVR5300 to reboot
 

Step 9: Repeat Steps 4 thru 8 for each DVR5300 identified in Step 1