Connecting to two IP addresses

I have a trunk from a telephony provider, I received 2 IP addresses from him to connect.
My system is built to receive calls, contact the AGI interface, perform authentication, and dial external phones (outside the switchboard).
These are my configuration files:

; sip_trunk
[call]
type=friend
insecure=port,invite
host=<ip-A>
fromdomain=<ip-A>
context=from-trunks
;extensions.conf
[from-trunks]
exten = _X.,1,AGI(agi://domain:port)
;agi pseudo code
await context?.exec('Dial', `SIP/call/${phone}`);

I have now received a message from my telephone provider that due to maintenance work, at certain hours IP A will not be available, and at other times IP B will not be available.
How can you connect to the two IP addresses, and each time the available address will receive the calls, and dial from the correct trunk?

Thanks in advance

for callin, you only need create 2 trunk to two IP address
for callout, dial trunk A , and if not success then trunk B

1 Like

Trying to connect to an unavailable address might lead to connection delays. A cleverer† approach might be to have the address to use given to Asterisk via a global variable, and have a script update the value of this variable at appropriate times during the day.

†Maybe too clever…

1 Like

You are assuming that type=friend was a mistake, for type=peer. Of course chan_pjsip handles multiple source addresses without having to resort to such tactics, and also, to a significant extent, multiple contact addresses…

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.