Blogs
Take a look at the things that interest us.
Creating a basic Sip Account set up for Asterisk
In this post, I would like to show you a quick example of how to create a few sip accounts in Asterisk and make your first call within minutes.
Requirements
How to register a simple sip account in Asterisk
To register a sip account in Asterisk, we'll need to add a few parameters to our pjsip.conf file. First, let's move to our Asterisk directory and open the pjsip.conf file.
$ cd /etc/asterisk
$ vi /pjsip.conf
Now let's add the following parameters to the file and save it.
# pjsip.conf
[general]
allow_overlap = no
disable_tcp_switch => y
[aor-single-reg](!)
type=aor
max_contacts=1
remove_existing=yes
[auth-userpass](!)
type=auth
auth_type=userpass
password = 12345678
[endpoint-basic](!)
type = endpoint
context = extensions
disallow = all
allow = ulaw
rtp_symmetric = yes
force_rport = yes
rewrite_contact = yes
ice_support = yes
direct_media = no
;==========1000
[1000](aor-single-reg)
[1000](auth-userpass)
username = 1000
[1000](endpoint-basic)
auth = 1000
outbound_auth = 1000
aors = 1000
;==========1001
[1001](aor-single-reg)
[1001](auth-userpass)
username = 1001
[1001](endpoint-basic)
auth = 1001
outbound_auth = 1001
aors = 1001
;==========1002
[1002](aor-single-reg)
[1002](auth-userpass)
username = 1002
[1002](endpoint-basic)
auth = 1002
outbound_auth = 1002
aors = 1002
;==========1003
[1003](aor-single-reg)
[1003](auth-userpass)
username = 1003
[1003](endpoint-basic)
auth = 1003
outbound_auth = 1003
aors = 1003
;==========1004
[1004](aor-single-reg)
[1004](auth-userpass)
username = 1004
[1004](endpoint-basic)
auth = 1004
outbound_auth = 1003
aors = 1004
In this example, we have created 4 sip accounts: 1000 till 1004, they all use the password 12345678.
How to make a simple call with Asterisk
Now it's time to set up everything for our first call, we'll need to update two files in Asterisk. Let's open our pjsip.conf file again.
$ vi /pjsip.conf
Now let's add the following parameters to the top of the file and save it. Make sure to also update your global and local IP.
# pjsip.conf
[transport-udp]
type = transport
protocol = udp
bind = 0.0.0.0:5060
external_media_address = <my-global-ip>
external_signaling_address = <my-global-ip>
local_net = <my-local-ip>/255.255.0.0
Next is the extension.conf file.
$ vi extensions.conf
Let's add the following parameters to the bottom of the file and save it.
# extensions.conf
[extensions]
exten => _1XXX,1,Ringing
exten => _1XXX,n,Wait(2)
exten => _1XXX,n,Dial(PJSIP/${EXTEN},60,tT)
exten => _1XXX,n,Answer()
exten => _1XXX,n,Hangup
The last step is to restart our Asterisk with the following command.
$ systemctl restart asterisk
Your sip accounts are now ready for use and you're able to make your first calls. Now it's time to register two sip accounts and test it out.
There are no comments.