Multiple Trunks, Single Host with PJSIP

Hey All,

So I am in the process of upgrading my asterisk server and changing over to PJSIP…

Is it possible to have multiple trunks with different usernames to register to the one host. i.e. I have 3 seperate account with one VoIP host.

What am I missing - they all register, but won’t accept inbound calls.

Cheers

Registration only tells the other side how to reach you. You still need to set up the configuration to match and direct incoming calls. What is your current configuration and what is the output for call attempts? Have you created an endpoint and set up IP based matching? You can also try the line functionality[1].

[1] https://www.asterisk-blog.com/2016/01/27/the-pjsip-outbound-registration-line-option/

1 Like

I’ve probably added confusion I think. I have multiple accounts with he same provider.

Below is a variation to my pjsip.conf

;**********
;* Trunk A
;**********
[trunk_a]
type = registration
retry_interval = 20
max_retries = 10
contact_user = 111111
transport = transport-udp
outbound_auth = trunk_a
server_uri = sip:sip.myvoipprovider.com
client_uri = sip:111111@sip.myvoipprovider.com

[trunk_a]
type = auth
auth_type = userpass
username = 111111
password = password

[trunk_a]
type = identify
endpoint = trunk_a
match = 111.222.333.444

[trunk_a]
type = endpoint
transport = transpost-udp
context = trunk_a_inbound
disallow = all
allow = ulaw
outbound_auth = trunk_a
aors = trunk_a
from_user = 111111
direct_media = no

[trunk_a]
type = aor
contact = sip:111111@sip.myvoipprovider.com:5060

;**********
;* Trunk B
;**********
[trunk_b]
type = registration
retry_interval = 20
max_retries = 10
contact_user = 222222
;expiration = 60
transport = transport-udp
outbound_auth = trunk_b
server_uri = sip:sip.myvoipprovider.com
client_uri = sip:222222@sip.myvoipprovider.com

[trunk_b]
type = auth
auth_type = userpass
username = 222222
password = password

[trunk_b]
type = identify
endpoint = trunk_b
match = 111.222.333.444

[home]
type = endpoint
transport = transport-udp
accountcode = trunk_b
context = trunk_b_inbound
disallow = all
allow = ulaw
outbound_auth = trunk_b
aors = trunk_b
from_user = 222222
direct_media = no

[trunk_b]
type = aor
contact = sip:222222@sip.myvoipprovider.com:5060

You can’t have multiple identify sections for the same IP address, the only identifying part is the IP address so only one will be used. This is likely causing your calls to go to a context which is not configured to handle the other number. If you provide the console output this can be confirmed. You will either need to use 1 identify, 1 endpoint, and 1 context or try using the line functionality I linked to previously.

Thanks for your help.

Getting rid of the extra endpoints and identify sections, and then modifying my dial plan I have it working

Cheers

The above link is no longer functional. Use the following to get to the blog post: https://blogs.asterisk.org/2016/01/27/the-pjsip-outbound-registration-line-option/