How to use a custom ring tone on a Dahua VTH

bronatio

n3wb
Joined
Sep 25, 2020
Messages
5
Reaction score
14
Location
Switzerland
Hi, I just wanted to share how I changed the ring tone on my Dahua VTH.

----------

Edit:
After having posted this guide here I realized that ipcamtalk.com does not display images properly unless you are logged in.

----------


My setup
VTH
Model: Dahua DHI-VTH1550CH
Firmware: V4.000.0000.0.R
VTO
Model: Dahua VTO2000A
Firmware: V3.120.0000.0.R
Switch
Dahua DHI-VTNS1060A



INTRO
Apparently Dahua no longer allows users to load custom ring tones onto their VTHs, but they come preloaded with only two? What is up with that? I found the user manual of some older VTH:

In chapter 5.2.1 they describe how custom ring tones can be loaded via Micro SD card. But this does not work for me. As I understand it, it is no longer supported, but maybe my device just has an issue, I don't know.
But it comes with two! (in my opinion awful) ring tones. Unbelievable.

Anyway, enough complaining. I eventually found this thread:
ip-phone-forum.de/threads/vto-vth-konfiguration-%C3%A4ndern-mit-der-dahua-json-debug-console-v2.306023/

In this thread user riogrande75 explains roughly how he managed to change his ring tone using this python script from GitHub:
github.com/mcw0/Tools - (Current commit: 8c232d5)

A huge thanks to riogrande75, kuzco-ip and everybody else who contributed in the forum, as well as to the creators of the script (bashis and Dale Harders)! I would never have managed to do it alone.
But because the other thread does not give very precise instructions and because it is in German, I decided to write this How-To-Guide.
I wrote it in a way that even people who never used Linux before can follow it, so sorry if I go into to much detail at times.





Preparations

1. Your VTH must have a working Micro SD slot

Note: Some VTH can have a physical slot for a Micro SD card, but it is not wired up. So, before you do all the work, make sure yours is!​

  1. Take a Micro SD card to a computer and format it to FAT32.
  2. Insert it into your VTH. You should see the SD card icon in the top right corner.

31.jpg

2. Micro SD card with MP3-File
Choose your ring tone (there are plenty to download for free on the internet). Now take the Micro SD card to a computer and copy the file to its root directory (so do not put it in a subfolder).​
Remember the name you give the file! It will be important later. I named mine "dingdong.mp3", but you can obviously name it whatever you want.​
I do not know if file types other than MP3 work and what the file size limits are. But in a manual for older versions (when it was still possible to load custom ring tones via micro sd card) I found this:​

18.jpg
You are welcome to test other file formats and sizes, but to be sure, stay within these guidelines.​


3. You must have a Linux machine
This can be ...​

  • A PC with a Linux OS
  • A Linux Virtual Machine
  • WSL (Windows Subsystem for Linux)
WSL is very quick to set up and is what I am using in this tutorial. Here is a guide:​


4. Have information on your Dahua products ready
  • VTH
    • IP-Address
    • Username
    • Password
  • VTO
    • IP-Address
    • Username
    • Password
    • MiddleNumber

The MiddleNumber of your VTO can be found on your VTH. Long press on "Setting" on your VTH, enter the password (default is "888888") and go to the "VTO Config"-Tab.​
33.jpg
I had to spread the guide over multiple posts, because it was to large :)
 
Last edited:

bronatio

n3wb
Joined
Sep 25, 2020
Messages
5
Reaction score
14
Location
Switzerland
HOW-TO-GUIDE
Now that you are all set up, let us begin. Like I said, this is step by step, so you should be able to follow it, even if you have never worked on Linux before.



1. Start by upgrading existing packages, so everything is up to date. Run these two commands.

01.jpg
02.jpg

When / If you get prompted, type the letter "y" and then hit "Enter".

03.jpg



2. Install Python 3 and Pip 3.

If you are not sure if something is already installed, you can run the command anyway, it will not install it again.

04.jpg
05.jpg



3. Install Git.

06.jpg



4. Clone the git repository (this downloads the script from GitHub).

07.jpg



5. Move into the folder "Tools" that was just created.

08.jpg



6. Install python modules that are required by the script.

09.jpg
10.jpg
11.jpg



7. To test the script, try to connect to your VTH.

12.jpg

Replace the following values in the command:

-> "10.13.13.211" with the IP-Address of you VTH
-> "admin" with the username of your VTH ("admin" is the default)
-> "888888" with the password of your VTH ("888888" is the default)

----------

You should now see the following output:

13.jpg

You are now successfully connected to your VTH. If you type "help" and then hit "Enter" it will show you a list of commands that can be executed.
You do not need those now. Instead, end the connection by typing "quit" and hitting "Enter".

14.jpg
 

Attachments

Last edited:

bronatio

n3wb
Joined
Sep 25, 2020
Messages
5
Reaction score
14
Location
Switzerland
8. Edit the script.

Now that the script works and you have successfully connected to your VTH, you need to edit the script.
First you need to find out where exactly in the code you need to meddle. Because the script may be updated in the future, the exact line in the code may change, so you need to find the exact line number.

The easiest way to do this is to open the python script from GitHub in a browser:
github.com/mcw0/Tools/blob/master/Dahua-JSON-Debug-Console-v2.py

Then hit "CTRL" + "F" to search for this string:

cmd[1] == 'set'

It should return only one result (currently on line 1334) and looks like this:

15.jpg

Once you have found this section of the code, head back to the terminal and run this command to edit the script:

16.jpg

The option "-c" is important, it will show you the line numbers in the file. The file is roughly 2’000 lines long, so you will want this ;)

Scroll down to the line number you found before (for me it is line 1334). With "page down" you can scroll more quickly.
Once you have found it, replace everything in between the curly brackets {} after “table” so it looks like this:

17.jpg

Change the following values:

34.jpg

Make sure you do not have any typos, and do not forget the wrapping ...

"Vto00": { ... },

... and changing the name to "VTOInfo":

"name":"VTOInfo",

Once you are done hit "CTRL" + "O", then "Enter" to save the file and then "CTRL" + "X" to exit.


9. Load the configuration onto the VTH.

Connect to the VTH with the same command from before:

12.jpg

Once you are connected, run:

19.jpg

The configuration has now been loaded onto the VTH. Finally, quit the connection with:

14.jpg


That is it! Your VTH will now play the ring tone on the Micro SD card, when this VTO is calling. The change is persistent, so it will still work after a reboot.
To change the ring tone you can actually just turn off the VTH replace the audio file on the Micro SD card (just make sure it has the same name) and then restart the VTH.
 
Last edited:

bronatio

n3wb
Joined
Sep 25, 2020
Messages
5
Reaction score
14
Location
Switzerland
Changing the Volume
To change the volume of the ring tone, go into the settings of your VTH and adjust the volume of "VTO0".

35.jpg



But Be Careful!
If you change the ring tone of "VTO0" (i.e. to ‘phone_ring2.pcm’) it will override the configuration, and your ring tone is gone!
At that point you would have to repeat step 9.


36.png



Happy Hacking :)
 

keisim

n3wb
Joined
Nov 30, 2020
Messages
2
Reaction score
1
Location
Poland
bronatio , kudos for a great job!

I just updated my devices to the SIP v4.3 firmware. These are versions branded by the Polish company BCS, namely: BCS-PAN1202S (VTO2000A) and BCS-MON7000W (VTH1510 or VTH1550CS).

After the update, I decided to fight the terrible ringtones with which I have been struggling for several years - the whole family already hated them :)

I found your post, specifically the part about loading MP3 to SD card. The SD card in my monitor is built-in, but after opening the housing it turned out that there is a normal slot and normal SD card secured with glue.

SD.jpg

After a few tries, it turned out that the monitor can load ringtones, placed in the 'Ring' sub-directory on the SD card! :) Do not exceed 100kB, such files are not displayed in the ringtone selection menu.

I just enjoy my ears with a beautiful Christmas bell :)
 

ray74

n3wb
Joined
Nov 21, 2019
Messages
5
Reaction score
2
Location
Spain
This is nice! Just in time for a Christmas sound :p

Is it possible to change the VTO ringing sound with this script? I hate the speech sound and have it disabled since the first day.

Edit: one more question, can I pull the sd card from the VTH after this or it has to be inserted to play the custom sound?
 

keisim

n3wb
Joined
Nov 30, 2020
Messages
2
Reaction score
1
Location
Poland
Regarding the script bronatio would have to answer. I used the built-in VTH functionality to play MP3 ringtones from an SD card.

As for the VTO, I know that in the latest firmwares it is possible to enable/disable the 'voice prompt sound' and enable/disable 'ringback sound', but I haven't checked it yet and I don't know if and how ringback sound can be changed.

I don't think the ringtone files are cached in VTH RAM, and that they can be played when you remove the SD card, but you can check ;)
 

bronatio

n3wb
Joined
Sep 25, 2020
Messages
5
Reaction score
14
Location
Switzerland
This is nice! Just in time for a Christmas sound :p

Is it possible to change the VTO ringing sound with this script? I hate the speech sound and have it disabled since the first day.

Edit: one more question, can I pull the sd card from the VTH after this or it has to be inserted to play the custom sound?
Sorry I am a little late...

As keisim already said, the SD card cannot be removed.

As far as the VTO ringtone goes, I do not know myself, but according to riogrande75 it is not possible anymore:
[Info] - VTO/VTH Konfiguration ändern mit der "Dahua-JSON-Debug-Console-v2"
 

Lukasz202

n3wb
Joined
Jan 3, 2021
Messages
1
Reaction score
0
Location
Poland
Hi @bronatio , thanks for your guide! Great job!

My configuration is:
VTH
Model: Dahua VTH5221D-S2
Firmware: 4.400.0000000.7.R
VTO
Model: Dahua VTO3221E
Firmware: V4.400.0000000.3.R

This work very well but ringtone file must be *.pcm or .wav

Have anyone idea how can I change VTO backlight time? Now is very short and don't turn on until I press any key.
 

arpicur

n3wb
Joined
Mar 5, 2021
Messages
1
Reaction score
0
Location
Slovakia
Hi @bronatio , thanks for your guide! Great job!

My configuration is:
VTH
Model: Dahua VTH5221D-S2
Firmware: 4.400.0000000.7.R
VTO
Model: Dahua VTO3221E
Firmware: V4.400.0000000.3.R

This work very well but ringtone file must be *.pcm or .wav

Have anyone idea how can I change VTO backlight time? Now is very short and don't turn on until I press any key.
Hi,

cann you help me?

I have this configuration, but the ringtones cann not be changed :( Where can I make a mistake?

Thx

Arpi
1615410388916.png
 

kobebeef

Pulling my weight
Joined
Mar 13, 2016
Messages
207
Reaction score
229
I successfully replaced.
This method can be used without the 100kb limit.
I'm using mp3 files.

Code:
        if cmd[1] == 'set' or cmd[1] == 'show':
            query_args = {
      "method":"configManager.setConfig",
      "params": {
      "table": {
      "Vto00": {
      "Address": "192.168.1.100",
      "Enable": True,
      "LockNumber": 2,
      "MachineAddress": "Main VTO",
      "MiddleNumber": "8001",
      "Password": "12345678",
      "Port": 5060,
      "RingFile": "/mnt/sd/bbb.mp3",
      "RingVolume": 40,
      "Type": "Vto",
      "Username": "admin"
      },
      },
      "name":"VTOInfo",
      },
      "session":self.SessionID,
      "id":self.ID
            }

Firmware name VTHX6XXX-SX and VTH52X1D can customize mp3 ring.
But VTHX421H can’t change, it will become mute.


Hi,

cann you help me?

I have this configuration, but the ringtones cann not be changed :( Where can I make a mistake?

Thx
So VTH5221DW-S2 can't change MP3 ring.
 
Last edited:

ovitters

n3wb
Joined
May 1, 2023
Messages
1
Reaction score
1
Location
Hi,

Thanks to the various tips here I was able to change it as well on a friends display. I think it was a VTH2421FBW, though not exactly sure of the code, I didn't write that down.

Observations:
  • The original script files are deprecated, they point towards GitHub - mcw0/DahuaConsole: Dahua Console, access internal debug console and/or other researched functions in Dahua devices. Feel free to contribute in this project. and that's what I used.
  • The display I used didn't show "MiddleNumber" in the screen. However, by retrieving the current configuration you can still retrieve it
  • As mentioned, it didn't accept mp3 files. I'm wondering if the mp3 was in stereo or something
  • As mentioned, it didn't like anything in a subfolder
  • To convert an mp3 file to the right (16k 16bit mono) wav file, ffmpeg can be used. Example: ffmpeg -i FILE.mp3 -acodec pcm_s16le -ac 1 -ar 16000 FILE.wav
  • I had some difficulty removing the microsd card from the housing. Instead of pulling on the microsd card, push/slide the metal on top a bit down. That allows the metal to be able to be opened. Then you can take the microsd card

To get the current configuration with DahuaConsole. Around line 1247 (under function new_config) you'll see the following:

Python:
        elif cmd[1] == 'get':
            query_args = {
                "method": "configManager.getConfig",
                "params": {
                    "name": "Config_31337",
                },
                "object": object_id,
            }
replace the "Config_31337" with "VTOInfo" to that it'll show as:

Python:
             query_args = {
                 "method": "configManager.getConfig",
                 "params": {
                    "name": "VTOInfo",
                 },
                 "object": object_id,
             }
then run the command like (I used 127.0.0.1 because I had port forwarding setup):
Bash:
./dahua.py --rhost 127.0.0.1 --auth admin:888888
once logged in, type:
Code:
test-config get
That'll print out a bunch of json. In that json, replace every true with True and every false with False. Then paste that in the dahua.py around line 1222 similar to the original guide. Around where it shows if cmd[1] == 'set' or cmd[1] == 'show':


Additional tips: you can setup port forwarding with Putty on Windows. That's helpful if you're assisting someone who doesn't have Linux and you're working from a Windows machine. I forwarded port 37777.

I still want to try converting this to pcm and placing these on the microsd card in the Ring subfolder. But didn't have time to try that anymore. Plus I was happy to get it working.
 

giorjoe

n3wb
Joined
Jul 5, 2023
Messages
1
Reaction score
0
Location
Italia
Goodmorning all, One question i want only remove password from my vth. I don't want if i enable or disable pir sensor, write the password Always. Is possible? Thanks for attention
 
Top