Using two sip trunks at time

How can use the two sip trunks at time to make one call, like one account is unreachable the call should go throuh the 2nd account.

check the below link where i have posted for multiple carriers dialplan

dial the number through first trunk and based on the hangupcode and answered duration, you can decide on further process.

If trunk A, answered duration is 0. then u can try to dial the same using trunk B.

Hope it helps.

I test to see if my trunk is available with the ChainIsAvail application.

https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_ChanIsAvail

Based on that test I dial out that trunk or my backup trunk.

 same =>   n,ChanIsAvail(SIP/trunk1)
 same =>   n,GotoIf($[${AVAILSTATUS}=20 | ${AVAILSTATUS}=5]?ALTTRUNK)  ; 20 means qualify has marked it unreachable, 5=Unavailable
 same =>   n,Dial(SIP/trunk1/${ARG1},,${DIALOPS})

 same =>   n(ALTTRUNK),Dial(SIP/trunk2/${ARG1},,${DIALOPS})

ChanIsAvail doesn’t tell you if the trunk will fail, only if it has already failed, you still need the HANGUPCAUSE checks to cope with the case of a failure since the last qualify. Also, it can only detect failures on the first hop.