FXO ZAP channel sequence

Can anyone provide some feedback on this please. I have a client with two businesses in the same building. They want the same box to serve both businesses. They will have 8 FXO ports but for this test I’ve used two. I’ve set it up to have one phone in this test to use ZAP channel 2 as first preference and the other phone to use ZAP channel 1 as first preference. I edited zapata-auto.conf so that each channel is in it’s own group and I edited zapata.conf accordingly. Below is the edit to extensions_custom.conf that makes each extension have it’s own outgoing ZAP channel preference. It works for two channels and two phones. I changed the channel order for each ZAP trunk so that PSTN1 uses g1 and then g2, while PSTN2 uses g2 and then g1. I’ve tested it and it works but I’d like some feedback before I install it on a server for my client. This is adapted from trixbox2_without_tears chapter 8.

[from-sequence1]
include => from-internal-additional-custom
include => vmblast-grp
include => app-pbdirectory
include => app-daynight
include => app-daynight-toggle
include => ext-group
include => grps
include => ext-meetme
include => app-cf-busy-off
include => app-cf-busy-off-any
include => app-cf-busy-on
include => app-cf-off
include => app-cf-off-any
include => app-cf-on
include => app-cf-unavailable-off
include => app-cf-unavailable-on
include => app-recordings
include => app-speeddial
include => ext-queues
include => app-calltrace
include => app-directory
include => app-echo-test
include => app-speakextennum
include => app-speakingclock
include => ext-findmefollow
include => fmgrps
include => app-dialvm
include => app-vmmain
include => app-blacklist
include => app-callwaiting-cwoff
include => app-callwaiting-cwon
include => ext-intercom-users
include => ext-paging
include => app-languages
include => app-dnd-off
include => app-dnd-on
include => app-userlogonoff
include => app-pickup
include => app-zapbarge
include => app-chanspy
include => ext-test
include => ext-local
include => parkedcalls

; #### OutBound Routes ########
; # Below are all restricted routes #
; ###########################

;new outbound-restricted-routes-sequence1
include => outbound-allroutes-custom
include => outrt-001-PSTN1
;include => outrt-002-PSTN2
exten => foo,1,Noop(bar)
;end of outbound-restricted-routes-sequence1
exten => h,1,Hangup
exten => s,1,Macro(hangupcall)
exten => h,1,Macro(hangupcall)

[from-sequence2]
include => from-internal-additional-custom
include => vmblast-grp
include => app-pbdirectory
include => app-daynight
include => app-daynight-toggle
include => ext-group
include => grps
include => ext-meetme
include => app-cf-busy-off
include => app-cf-busy-off-any
include => app-cf-busy-on
include => app-cf-off
include => app-cf-off-any
include => app-cf-on
include => app-cf-unavailable-off
include => app-cf-unavailable-on
include => app-recordings
include => app-speeddial
include => ext-queues
include => app-calltrace
include => app-directory
include => app-echo-test
include => app-speakextennum
include => app-speakingclock
include => ext-findmefollow
include => fmgrps
include => app-dialvm
include => app-vmmain
include => app-blacklist
include => app-callwaiting-cwoff
include => app-callwaiting-cwon
include => ext-intercom-users
include => ext-paging
include => app-languages
include => app-dnd-off
include => app-dnd-on
include => app-userlogonoff
include => app-pickup
include => app-zapbarge
include => app-chanspy
include => ext-test
include => ext-local
include => parkedcalls

; #### OutBound Routes ########
; # Below are all restricted routes #
; ###########################

;new outbound-restricted-routes-sequence1
include => outbound-allroutes-custom
;include => outrt-001-PSTN1
include => outrt-002-PSTN2
exten => foo,1,Noop(bar)
;end of outbound-restricted-sequence2
exten => h,1,Hangup
exten => s,1,Macro(hangupcall)
exten => h,1,Macro(hangupcall)

Can you please post your zapata-auto.conf and zapata.conf files as well?
How is it working for you. Are there any problems?

The way I handle this is a little different. I create a context for each business, such as:

[from-business1] and [from-business2].

For the extensions in business1 change the context for those extensions to from-business1 in FreePBX. Do the same for the extensions tied to business2.

Now create an outbound route for business 1 with steering digits in FreePBX.

Business1Out

9988|NXXNXXXXXX
9988|1NXXNXXXXXX

Create an outbound route for business 2 with the different steering digits;

Business2Out

9977|NXXNXXXXXX
9977|1NXXNXXXXXX

Now, you need to edit the extension_custom.conf file. At the bottom of this file add the following:

[from-business1]
exten => NXXNXXXXXX,1,goto(from-internal,9988${EXTEN},1)
exten => 1NXXNXXXXXX,1,goto(from-internal,9988${EXTEN},1)
include => from-internal

[from-business2]
exten => NXXNXXXXXX,1,goto(from-internal,9977${EXTEN},1)
exten => 1NXXNXXXXXX,1,goto(from-internal,9977${EXTEN},1)
include => from-internal

Any call originated from a phone in business 1 will be processed by the from-business1 context. If the caller dials either a 10 digit or 11 digit number, the number will have 9988 pre-pended to it and then sent to the from-internal context. Once it gets to the outbound route for business 1, the route will strip the steering digits, 9988, and send the call to the trunk. The same is true with business 2, just different steering digits. All other calls will be caught by the includes at the bottom and handled normally.