It all started when I remembered the service offered by the Romanian landline/PSTN provider Romtelecom back in the 80s and 90s.
You used to call the number 058, later 958 and get a lady saying: “At the next signal, the time will be exactly <time>”
OK, so I though, how can I implement this in my VoIP setup.
So, here goes:
Requirements:
- An already existing PBX where we will create the extension 958 that we can call
- A Linux machine running Asterisk
Here are the configs, supposing that you already have the Linux machine up and running. In this setup I used Ubuntu 26.04 on ARM:
Install Asterisk
sudo apt update
sudo apt install -y asterisk asterisk-modules asterisk-config
Enable and start Asterisk
sudo systemctl enable –now asterisk
sudo systemctl status asterisk
and verify Asterisk CLI is running: sudo asterisk -rvvvvv
Connected to Asterisk 22.5.2~dfsg+~cs6.15.60671435-1 currently running on asterisk-time (pid = 3022)
Connect to your PBX extension
sudo nano /etc/asterisk/pjsip.conf
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
[transport-udp] type=transport protocol=udp bind=0.0.0.0:5060 [yeastar-auth] type=auth auth_type=userpass username=958 password=YOUR_EXTENSION_958_PASSWORD [yeastar-aor] type=aor contact=sip:PBXIP:5060 [yeastar-endpoint] type=endpoint transport=transport-udp context=from-yeastar disallow=all allow=alaw allow=ulaw aors=yeastar-aor outbound_auth=yeastar-auth from_user=958 from_domain=PBXIP direct_media=no rtp_symmetric=yes force_rport=yes rewrite_contact=yes [yeastar-identify] type=identify endpoint=yeastar-endpoint match=PBXIP [yeastar-reg] type=registration transport=transport-udp outbound_auth=yeastar-auth server_uri=sip:PBXIP:5060 client_uri=sip:958@PBXIP contact_user=958 retry_interval=30 expiration=300 forbidden_retry_interval=30 auth_rejection_permanent=no |
RELOAD ASTERISK
sudo asterisk -rx “pjsip reload”
sudo asterisk -rx “pjsip send register yeastar-reg”
sudo asterisk -rx “pjsip show registrations”
The registration should look like:
<Registration/ServerURI…………………………> <Auth………………..> <Status…….>
==========================================================================================
yeastar-reg/sip:PBXIP:5060 yeastar-auth Registered (exp. 558s)
Objects found: 1
EDIT THE EXTENSIONS (basically the “person” who will speak the time”)
sudo nano /etc/asterisk/extensions.conf
[from-yeastar]
exten => 958,1,Answer()
same => n,Wait(1)
same => n(loop),Playback(at-tone-time-exactly)
same => n,Wait(1)
same => n,PlayTones(1000/250)
same => n,Wait(1)
same => n,StopPlayTones()
same => n,SayUnixTime(,Europe/Bucharest,H)
same => n,Wait(0.3)
same => n,SayUnixTime(,Europe/Bucharest,M)
same => n,Playback(minutes)
same => n,SayUnixTime(,Europe/Bucharest,S)
same => n,Playback(seconds)
same => n,Wait(3)
same => n,Goto(loop)
exten => s,1,Goto(958,1)
then reload the dialplan:
sudo asterisk -rx “dialplan reload”
There you go! Now just dial 958 from any phone on the PBX and enjoy the old times 🙂
