Configure 2 providers in 1 pjsip account

Hello,
Im trying to configure the pjsip to accept call from 2 different providers but i have a bit kind of problem. The problem is in the transport file meaning that the one company requires something like it:

[transport-udp-nat]
type=transport
protocol=udp
bind=0.0.0.0
local_net=192.168.0.0/24
local_net=127.0.0.1/32
PBX IP: xxx.xxx.xxx.xxx

and the other company something like it:

[transport-udp-nat]
type=transport
protocol=udp
bind=0.0.0.0
local_net=192.168.0.0/24
local_net=10.8.0.0/24
local_net=127.0.0.1/8
external_media_address=xxx.xxx.xxx.xxx
external_signaling_address=xxx.xxx.xxx.xxx

If i use the external media signalling and address the 1st provider doesnt giving me any sound if i dont use it the second provider is not working at all.
I also try to create 2 classes like:

[transport-udp-nat-company-a]
[transport-udp-nat-company-b]

But in that case… there is nothing working. Any ideas how this can be achieved?
Thanks a lot.

I think the simplest solution to such invalid multi-homing configurations is to run two instances of Asterisk and have them forward calls between themselves.

Thats the solution which i was trying to avoid… isnt there any other way?

Configure them as local networks and make sure direct media is disabled.

What exactly do they require to be different? What is the SIP signaling for both? (pjsip set logger on)

1 Like

Sorry. I didn’t read it carefully. The service provider should not be telling you anything about your local net settings.

The problem that I assumed was that they were both providing non-routable addresses, but if they were doing that, there would be no need to redact the addresses.

The difference is that theo one provider is require to have external_media_address and external_signaling_address pointing to public ip and the other provider not. thats the only difference. but if i use it i will be able to have the one provider active and the other not and if i dont use it ill have the exact opposite.

The other provider should not care whether you have your public IP address in media and signaling, provided you correctly configure things (port forward them to Asterisk). You’ll need to provide what I asked for so we can see exactly what is going on.

The differences are the following

  1. for the one provider i have modem in office and there is no require login since the other is remote provider.
  2. The web provider requires external_media_address and external_signaling_address to be set to my public ip otherwise all the incoming calls ends in 32seconds

what do you mean:

What is the SIP signaling for both?

You could try configuring two transports with DIFFERENT ports and with the appropriate configuration and explicitly configuring them on each endpoint.

i try that just now but the system went totally down. here is what ive done:
Provider 1 all settings according to their manual

[transport-udp-nat-tw]
type=transport
protocol=udp
bind=0.0.0.0
local_net=192.168.0.0/24
local_net=127.0.0.1/32
external_media_address=public-ip
external_signaling_address=public-ip

[endpoint-basic](!)
type=endpoint
transport=transport-udp-nat-tw
context=from-phones
disallow=all
allow=ulaw
; NAT parameters:
rtp_symmetric = yes
rewrite_contact = yes
send_rpid = yes
direct_media = no

Provider 2 all settings according to their manual

[transport-udp-nat]
type=transport
protocol=udp
bind=0.0.0.0
local_net=192.168.0.0/24
local_net=127.0.0.1/32

[trunk-prime-endpoint-xxxxxxxx]
type = endpoint
from_user = xxxxxxxx
transport = transport-udp-nat
context = outer
disallow = all
allow = alaw
allow = ulaw
aors = trunk-prime-aor

You have to specify a separate port on one of them. You can’t have two using the same port. This is done using “bind=0.0.0.0:5062” for example.

hello,
I done many tests yesterday but the system dies once i add the second transport. any ideas?

Did you look on the console to see if it complained about anything? What was the specific configuration?

I was finally able to make it work. here is my config of transport:
provider A

[transport-udp-nat-tw]
type=transport
protocol=udp
bind=0.0.0.0:5062
local_net=192.168.0.0/24
local_net=10.8.0.0/24
local_net=127.0.0.1/8
external_media_address=xxx.xxx.xxx.xxx
external_signaling_address=xxx.xxx.xxx.xxx

Provider B

[transport-udp-nat]
type=transport
protocol=udp
bind=0.0.0.0:5060
local_net=192.168.0.0/24
local_net=127.0.0.1/32
PBX IP: xxx.xxx.xxx.xxx

The reason that the system wasnt working before was because i add wrong transport in one of the endpoints.
Thanks A lot for the help!!!

I’d recommend making the local_net’s match on the two transports if 192.168.0.0/24 and 10.8.0.0/24 are your local networks.

I don’t see any reason to have the local_net=127.0.0.1 line at all.

Also 127.0.0.1/8 is malformed. Depending on the implementation details it will either behave the same as 127.0.0.0/8 or it will not match at all. The two implementations are (Addr & 0xff000000) == 0x7f000001 and (Addr & 0xff000000) == (0x7f000001 & 0xff000000). (Numbers in network byte order.)

A lot of your problem seems to stem from copying information without understanding it.

1 Like