Dialout trunk - how to use different trunk only in case of trunk failures

I have some issue with calling out using trunk sequence;
I have some issue with trunk failure functions.
I have configured 3 trunks in the system

  1. voip - to voip provider
  2. gsm via gsm gateway
  3. Isdn via the BRA and isdn Carrier

The outbound route is set for two different patterns 1 for gsm and the second for any other outgoing call

In “other” configuration I have set trunk sequence:

  1. VoIP
  2. GSM
  3. ISDN

I want to use trunk different than VoIP only in case of VoIP trunk failures.

But now when some outbound call is placeded via voip trunk and the called party does not pick up the phone, the system use different trunks to call the number again.

Is it possible to configure the outbound route to use other trunk only in case of the primary trunk is down or thera are some errors on it and not to forward call to another trunk when the called party does not respond.

I have looked in the [macro-dialout-trunk]
and the call process should be cleared when we have busy or “no answer” response

but the macro goes to the CHANUNAVAIL section and try to use other trunk to cal the party again.

exten => s,n(skipoutnum),Dial(${pre_num:4}${the_num}${post_num},300,${DIAL_TRUNK_OPTIONS})
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s,n(chanfull),Noop(max channels used up)
exten => s-BUSY,1,Noop(Dial failed due to trunk reporting BUSY - giving up)
exten => s-BUSY,n,Playtones(busy)
exten => s-BUSY,n,Busy(20)
exten => s-NOANSWER,1,Noop(Dial failed due to trunk reporting NOANSWER - giving up)
exten => s-NOANSWER,n,Playtones(congestion)
exten => s-NOANSWER,n,Congestion(20)
exten => s-CANCEL,1,Noop(Dial failed due to trunk reporting CANCEL - giving up)
exten => s-CANCEL,n,Playtones(congestion)
exten => s-CANCEL,n,Congestion(20)
exten => s-CHANUNAVAIL,1,GotoIf($[“x${OUTFAIL_${ARG1}}” = “x”]?noreport)
exten => s-CHANUNAVAIL,n,AGI(${OUTFAIL_${ARG1}})
exten => s-CHANUNAVAIL,n(noreport),Noop(TRUNK Dial failed due to ${DIALSTATUS} (hangupcause: ${HANGUPCAUSE}) - failing through to other trunks)
exten => s-.,1,GotoIf($["x${OUTFAIL${ARG1}}" = “x”]?noreport)
exten => s-.,n,AGI(${OUTFAIL${ARG1}})
exten => s-.,n(noreport),Noop(TRUNK Dial failed due to ${DIALSTATUS} - failing through to other trunks)
exten => disabletrunk,1,Noop(TRUNK: ${OUT
${DIAL_TRUNK}} DISABLED - falling through to next trunk)
exten => bypass,1,Noop(TRUNK: ${OUT_${DIAL_TRUNK}} BYPASSING because dialout-trunk-predial-hook)

Hi All,

Just to chase this up a little.

I found another post about this that had more detail but I still could not figure a solution.

I am having a problem, either in my understanding or implementation, where I thought that if I have multiple outbound trunks I could set the trunk sequence in outbound routes to try the next one if a call fails.

Doing this produces a result that if the number is busy, unanswered or rejected then freepbx will try to call the number again on the next trunk in sequence. This has some plus points ! but is starting to raise the running costs a little as failed calls to mobiles are being attempted many times.

I am sorry if this topic has been discussed in detail elsewhere but I have been searching for the past few hours, both here and on other forums, with no real conclusion apart from perhaps the trunk providers are sending the wrong response codes.

Please don’t shout at me for getting my first post wrong,
and if you need further info just let me know what I can get for you.

Would love to sort this so that I can leave the route sequence in place but so asterisk(FreePbx) will only try the additional Trunks when the used trunk is unregistered/offline.

Trunks are a combination of
Sipagte lines,
Dahdi FXO’s,
more SIP connections to another PBX.
About 8 different trunks in total I think.