Today I figured out how to add things to /etc/asterisk/extensions.conf on a Yeastar MyPBX SoHo. This also works on their standard, pro and U100 models. The problem – if you just modify anything in /etc/asterisk/*.conf it will just be overwritten the first time you do anything in the web GUI or if the system reboots.
In the directory /persistent/custom-cfg, you can create files with $filename_custom.conf – so in this example, I wanted to add some things to extensions.conf. So, I created /persistent/custom-cfg/extensions_custom.conf. In that file, I added my contexts, saved the file, then went and made a meaningless change in the GUI. Yippee! I see my changes reflected now in /etc/asterisk/extensions.conf.
Problem #2 – I wanted to make the system make some routine calls twice a day. This requires one of either:
- Someone making those calls manually
- A scheduled script running (cron)
- A remote scheduled script logging in via SSH somehow and invoking those commands
The reason #3 above might have been necessary is because I noticed this MyPBX SoHo doesn’t have crond running. (The Linux scheduler)
I didn’t find very much information — actually, I didn’t find ANY information — while searching online for how to enable this. So, I started digging through /etc/rc.local — this file is executed upon bootup any time the system starts. Unfortunately, you cannot modify /etc/rc.local. Fortunately, I found that part of /etc/rc.local will execute anything you put in to the file /persistent/add.sh — yippee! So, I created that script, and in it, I put:
echo ‘0 8 * * Mon-Fri /persistent/calltest.sh’ >/var/spool/cron/crontabs/root
echo ‘0 17 * * Mon-Fri /persistent/calltest.sh’ >>/var/spool/cron/crontabs/root
The contents of calltest.sh are outside the scope of this document. IMPORTANT – the last line in add.sh starts the cron daemon.
I don’t know why Yeastar doesn’t enable cron on these servers, but whatever. This will get it going. I’m happy, and so is my customer.