Multiple host setup for one sip trunk for backup

A sip trunk is used to connect to sip provider, which give me two host ip address- one for backup. I use one ip host address in sip trunk

[ncell-out] type=peer host=<ip address 1> context=adhearsion description=Outbound Ncell Link dtmfmode=rfc2833 nat=force_rport,comedia disallow=all allow=g729 insecure= port,invite qualify=yes

How do i use other ip address in same trunk as a back up link? Or is there any better way to do it?

Asterisk doesn’t have trunks. They are a higher level construct imposed by the configuration and dialplan.

When the dial to the first destination fails, have your dialplan dial the alternative one. Ideally check ${HANGUPCAUSE} and suppress the re-dial for conditions that are not related to network problems.

If you want examples, I believe that FreePBX does this, and it is open source.

setup 2 trunks , each one with one of the IP address provided by your carrier, and then setup a sequential dialing or use ${HANGUPCAUSE} variable in your dial plan

Thanks you,
It works perfectly fine in my project. I make two separate sip trunk and call them sequentially when one has problem.