Outgoing calls using PSTN lines

Hello, I have a server with Asterisk to which 4 PSTN lines are connected (through an FXO Grandstream HT503 gateway) and I needed help to be able to direct outgoing calls, try to exit through the first line if busy, try the second line and so on until the fourth line that if it gives busy returns to try with the first line.

Asterisk version 13.14

Something like this should work assuming the Grandstream sends back CONGESTION on a failed call.

same => n,Dial(PJSIP/${EXTEN}@gateway1,60)
same => n,ExecIf($[${DIALSTATUS} = 'CONGESTION']?Dial(PJSIP/${EXTEN}@gateway2,60))
same => n,ExecIf($[${DIALSTATUS} = 'CONGESTION']?Dial(PJSIP/${EXTEN}@gateway3,60))
same => n,ExecIf($[${DIALSTATUS} = 'CONGESTION']?Dial(PJSIP/${EXTEN}@gateway4,60))
same => n,Playtones(congestion)
same => n,Congestion(30)
same => n,Hangup()

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