Blogs
Take a look at the things that interest us.
Outbound registration with Asterisk
In this post, I would like to show you how to register an outbound number with Asterisk.
What is a outbound registration
An outbound registration is a phone number registration from a third-party service through Asterisk. This phone number can be used to transfer calls to one or multiple Asterisk features.
How to register an outbound number in Asterisk
To register an outbound number 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.
Please make sure to update the following parameters with your own outbound registration number.
- {host} — The host domain
- {hostip} — The host ip
- {number} — Your outbound number
- {password} — The password to authenticate the number.
Let get started.
[outbound]
type=registration
transport=transport-udp
outbound_auth=outbound
server_uri=sip:{host}
client_uri=sip:{number}@{host}
retry_interval=60
[outbound]
type = auth
auth_type=userpass
username={number}
password={password}
[outbound]
type=endpoint
transport = transport-udp
context=outbound
outbound_auth=outbound
allow = !all,g722,ulaw
aors=outbound
[outbound]
type=identify
match={hostip}
endpoint=outbound
[outbound]
type=aor
contact=sip:{number}@{host}
The last step is to restart Asterisk to enable the new settings.
$ systemctl restart asterisk
Testing a outbound registration in Asterisk
Testing a newly added outbound registration in Asterisk can be done through the Asterisk CLI with the following command.
pjsip show registrations
# output
<Registration/ServerURI..............................> <Auth..........> <Status.......> <Last Reg..> <Intvl> <Next Start.....secs>
========================================================================================================================================
outbound/sip:this-is-my-host.com outbound Registered Thu 00:56:13 590 Thu 01:06:03 589
Your outbound number is now registered with Asterisk. The next step would be tweaking your Asterisk dial plan.
Hello, aska. Please I need your support. I need to connect two asterisk servers using pjsip. I connect it but Outbound is not working me! Please how to connect remote asterisk server using Pjsip? Thanks