here is my code for having multiple trunks
you just need to setup an accounts for each of your providers servers
alternative look into if the provider are using SRV record, assuming that the username/password are identical on the different servers
as that is supported with PJSIP
same => Set(__NoFailoverCause=1,16,17,18,19,20,21,22,28,127)
; 1 UNALLOCATED
; 16 NORMAL_CLEARING
; 17 USER_BUSY
; 18 NO_USER_RESPONSE
; 19 NO_ANSWER
; 20 SUBSCRIBER_ABSENT
; 21 CALL_REJECTED
; 22 NUMBER_CHANGED
; 28 INVALID_NUMBER_FORMAT
; 127 INTERWORKING
same => n,Set(Trunk=Connection1,Connection2,Connection3)
same => n,Goto(Trunk,${EXTEN},1)
[Trunk] ;loadbalacing and failover
exten => _[+0-9*#s]!,1,Set(Num=${FIELDQTY(Trunk,\,)})
same => n,Set(CHANNEL(hangup_handler_push)=Hangup_Handler,${FILTER(+1234567890#*,${EXTEN})},1) ; enable that we show hangup reason in the log
same => n,ExecIf($[${EXISTS(${PJSIP_HEADER(read,Privacy)})} & "${PJSIP_HEADER(read,Privacy)}" != "none"]?Set(_Number_pres="prohib") ; Privacy: id;user;header
same => n,Set(Count=0)
same => n,Set(Current=${RAND(1,${Num})}) ; select a random place to start (load balacing)
same => n,While($[${INC(Count)} <= ${Num}])
same => n,Set(Current=$[${MATH(${Current}%${Num},i)}+1]) ; fancy modulus stuff to loop the list of hosts
same => n,ExecIf($["${DEVICE_STATE(PJSIP/${CUT(Trunk,\,,${Current})})}"="UNAVAILABLE"]?ContinueWhile()) ; check where the device in responding to option
same => n,ExecIf($["${DEVICE_STATE(PJSIP/${CUT(Trunk,\,,${Current})})}"="INVALID"]?ContinueWhile()) ; check that the device exists
same => n,Dial(PJSIP/${EXTEN}@${CUT(Trunk,\,,${Current})},${DialTimeout},iS(${MaxCallTime})b(Dial_Handler^${EXTEN}^1))
same => n,ExecIf($["${NoFailoverCause}"!="${LISTFILTER(NoFailoverCause,",",${HANGUPCAUSE})}"]?ExitWhile()) ; check if we should failover or not
same => n,EndWhile()
same => n,ExecIF($["${HANGUPCAUSE}"!="0"]?Hangup(${HANGUPCAUSE}):Hangup(38)) ; 38 NETWORK_OUT_OF_ORDER