I got a task to build a Public Announcement system with select able address, single or multi destination. Here I'm using asterisk void server using few banana-pi board that i got from rejected defect board on my last project, but still functional.
For voip client i use twinkle software that had capabilities to run on command line, and for the voip phone i use linphone app that had capabilities to make conference call that can run both on pc or smartphone.
Installing Asterisk
Since i use banana-pi board running debian, install the package by tipe in:
sudo apt install asterisk asterisk-dahdi
The asterisk-dahdi is collection of library to access various telephony machines that we may need. Next we need to cofigure astersik to do simple task as we need.
Make backup of original configuration to repalce with our own
sudo mv /etc/asterisk/sip.conf /etc/asterisk/sip.conf.bak
sudo mv /etc/asterisk/extensions.conf /etc/asterisk/extensions.conf.bak
Next we create new sip.conf file that enlist our devices destination number
sudo vi /etc/asterisk/sip.conf
[general]
context=default
[1001]
type=friend
context=from-internal
host=dynamic
secret=1234
disallow=all
allow=ulaw
[1002]
type=friend
context=from-internal
host=dynamic
secret=1234
disallow=all
allow=ulaw
[1003]
type=friend
context=from-internal
host=dynamic
secret=1234
disallow=all
allow=ulaw
[1004]
type=friend
context=from-internal
host=dynamic
secret=1234
disallow=all
allow=ulaw
We can add more number as we need. Next we need, the entry secret is the password that will be asked on logging in. Next we create rule over our extension numbe so they may reach each others
sudo vi /etc/asterisk/extensions.conf
[from-internal]
exten=>1001,1,Dial(SIP/1001,20)
exten=>1002,1,Dial(SIP/1002,20)
exten=>1003,1,Dial(SIP/1003,20)
exten=>1004,1,Dial(SIP/1004,20)
exten=>1005,1,Dial(SIP/1005,20)
exten=>1006,1,Dial(SIP/1006,20)
exten=>1007,1,Dial(SIP/1007,20)
exten=>1008,1,Dial(SIP/1008,20)
exten=>1009,1,Dial(SIP/1009,20) \
restart the asterisk server, in debian 10 or later the service were controlled by systemctl, so we restart by type in
sudo systemctl restart asterisk.services
Linphone
Get linphone from their official website and install it
open it and hit preferences add account, fill the sip address and sip server address with format. Fill in the username as we put in the sip.conf with one that inside "[xxx]" branches. fill in sip server with the ip address of the server
sip:username@sipserver
sip:sipserver
select transport UDP and make sure option Register is selected, hit confirm and if the VoIP server is up, it will pop up a window asking for password. Upon successfully register you will notice the icon on the top left with no warning sign, otherwise if fail to register it will show the warning sign.
Now you ready to make a call.
Twinkle
For the two banan-pi board, we use twinkle which we will run in via command line. To install it, just type in:
sudo apt install twinkle
Normally at desktop linux, if we run the twinkle it will generate the twinkle configuration, since we run it via command line, we can copy one from desktop linux to our board. The file we need is located at home directory.
cp ~/.twinkle.cfg <somewhere>
On our headless board create directory twinkle an copy it
mkdir ~/.twinkle
cp <somewhere>/twinkle.cfg ~/.twinkle/twinkle.cfg
now edit the file to meet our registration to VoIP server
vi ~/.twnikle/twinkle.cfg
# USER
user_name=1003
user_domain=10.1.1.73
user_display=igunos
user_organization=
auth_realm=
auth_name=1003
auth_pass=1234
auth_aka_op=00000000000000000000000000000000
auth_aka_amf=0000
# SIP SERVER
outbound_proxy=10.1.1.73
all_requests_to_proxy=no
non_resolvable_to_proxy=no
registrar=
register_at_startup=yes
registration_time=3600
reg_add_qvalue=no
reg_qvalue=1
Edit entry with bolded font to meet our registration entry at server sip.conf. To make our board auto answer we can add file twinkle.svc
vi ~/.twinkle/twinkle.svc
auto_answer=yes
To run the twinkle in command line mode type in
twinkle -c
Try on to call from linephone to twinkle, go and make conference call to address grouped destination client.
Last one, is to make the twinkle run as common user during boot time. Here we will use the rc.local or if not available in your system you can make one follow this something like this link.
Edit rc.local and add these lines:
sudo vi /etc/rc.local
sudo -H -u <username> bash -c "twinkle -c" &
That's it, I have a public announcement system prototype, i hope my future customer will accept it, wish me luck guys
No comments:
Post a Comment