In general if you dial demo code like *24*#3471606938#, the phone will take # key as send and only send the characters before # to PBX which makes the calling failed, one solution is on the phone to change key as send setting from # to others.
The other solution is in pbx - outbound route, modify dialpattern to any indentified number for example 0000, set strip to same length as dialpattern, add *24*3471606938# to prepend field, thus you can type 0000 on the phone to alternatively dial the code.
There is a known case in outbound route - Prepend field in Yeastar s-series pbx whose length is limited to 15, therefore if not possible to dial the string more than 15 characters manually on the phone, have to try custom change by ssh in pbx.
Here are the steps.
1, Set up outbound route and do not set the code in Prepend field in outbound route, we will configure the code in script by ssh.
2, Copy similar context in screenshot below from /etc/asterisk/extensions.conf to /ysdisk/support/customcfg/extensions_custom.conf
3, Add the code to proper place in extensions_custom.conf like screenshot below.
4, support@IPPBX:~$ astconfig
5, support@IPPBX:~$ asterisk -rx 'dialplan reload'
6, Test calls.