Dual Trunk Routing |
|
| Solution Integration > PBXs > BT Call Server > Example Configurations > Route Configuration |
Example 1Web UI > Configuration > Trunks
; Trunk template
[trunk-defaults](!) type = wizard transport = transport-tcp ; Explicit transport configuration to use endpoint/allow = !all,ulaw,alaw ; Media Codec(s) to allow endpoint/context = incoming ; Dialplan context to use endpoint/dtmf_mode = auto ; DTMF is sent as RFC 4733 if the other side supports it or as INBAND if not endpoint/direct_media = yes ; Enable direct media (peer to peer RTP) ;endpoint/tos_audio = ef ; Sets TOS for audio streams (QoS) ;endpoint/cos_audio = 5 ; Sets COS for audio streams (QoS) aor/qualify_frequency = 30 ; Interval at which to qualify an AoR (SIP Options Ping)
; Trunk to CUCM (dual nodes)
[CUCM](trunk-defaults) remote_hosts = IP_address_PBX_Pub:5060,IP_address_PBX_Sub:5060 ; Comma separated IP's (with port) of PBX Pub and Sub identify/match = IP_address_PBX_Pub,IP_address_PBX_Sub ; Comma separated IP's of PBX Pub and Sub
; Trunk to TWILIO
; Trunk template definition
[twilio-trunk-defaults](!) type = wizard endpoint/context = incoming endpoint/transport=transport-udp endpoint/allow = !all,ulaw,alaw endpoint/direct_media=no endpoint/rewrite_contact=yes endpoint/rtp_symmetric=yes endpoint/dtmf_mode=rfc4733 endpoint/allow_subscribe = no aor/qualify_frequency = 60
; Trunk definition
[TWILIO](twilio-trunk-defaults) remote_hosts = xxxxxx.pstn.twilio.com, yyyyyy.pstn.dublin.twilio.com ;sends_auth = yes ;outbound_auth/username = username ;outbound_auth/password = password
Web UI > Configuration > Route (Dial Plan)
; Context for incoming calls
[incoming] exten => _X.,1,Dial(PJSIP/${EXTEN},300) ; Call the internal extension exten => _X.,n,Congestion(10) ; Play congestion tone if line is unavailable
; Exact duplicate of above, but note the "+" in "exten => _+X." which caters for +(Plus) dialing, e.g. +44xxxxxxxxxx ; Require both if using + dialing
exten => _+X.,1,Dial(PJSIP/${EXTEN},300) ; Call the internal extension exten => _+X.,n,Congestion(10) ; Play congestion tone if line is unavailable
; Context for outgoing calls
[outbound] exten => _X.,1,GotoIf($[${DEVICE_STATE(PJSIP/${EXTEN})} != INVALID]?local:dialcheck) ; Check if dialed number is locally registered, if not route to "dialcheck" exten => _X.,n(local),Dial(PJSIP/${EXTEN},300) ; Call local extension if number registered exten => _X.,n,Congestion(10) ; Play congestion tone if line is unavailable exten => _X.,n(dialcheck),GotoIf($["${EXTEN:0:3}"="555"]?cucm:twilio) ; Check if the first three digits are "555" if true go to "cucm" if not go to "twilio" exten => _X.,n(cucm),Dial(PJSIP/${EXTEN}@CUCM,300) ; Dial through the trunk exten => _X.,n,Congestion(10) ; Play congestion tone if line is unavailable exten => _X.,n(twilio),GotoIf($["${EXTEN:0:3}"="777"]?match:nomatch) ; Check if the first three digits are "777" if true go to "match" if not go to "nomatch" exten => _X.,n(match),Dial(PJSIP/${EXTEN}@TWILIO,300) ; Dial through the "TWILIO" trunk exten => _X.,n(nomatch),Congestion(10) ; Play congestion tone if line is unavailable
; Duplicate of above (with minor tweaks), but note the "+" in "exten => _+X." which caters for +(Plus) dialing, e.g. +44xxxxxxxxxx ; Require both if using + dialing ; Note the digit checks being done which look for +555 and +777, amend as needed
exten => _+X.,1,GotoIf($[${DEVICE_STATE(PJSIP/${EXTEN})} != INVALID]?local:dialcheck) ; Check if dialed number is locally registered, if not route to "dialcheck" exten => _+X.,n(local),Dial(PJSIP/${EXTEN},300) ; Call local extension if number registered exten => _+X.,n,Congestion(10) ; Play congestion tone if line is unavailable exten => _+X.,n(dialcheck),GotoIf($["${EXTEN:0:4}"="+555"]?cucm:twilio) ; Check if the first four digits are "+555" if true go to "cucm" if not go to "twilio" exten => _+X.,n(cucm),Dial(PJSIP/${EXTEN}@CUCM,300) ; Dial through the trunk exten => _+X.,n,Congestion(10) ; Play congestion tone if line is unavailable exten => _+X.,n(twilio),GotoIf($["${EXTEN:0:4}"="+777"]?match:nomatch) ; Check if the first four digits are "+777" if true go to "match" if not go to "nomatch" exten => _+X.,n(match),Dial(PJSIP/${EXTEN}@TWILIO,300) ; Dial through the "TWILIO" trunk exten => _+X.,n(nomatch),Congestion(10) ; Play congestion tone if line is unavailable
Example 2Web UI > Configuration > Trunks
; Trunk template
[trunk-defaults](!) type = wizard transport = transport-tcp ; Explicit transport configuration to use endpoint/allow = !all,ulaw,alaw ; Media Codec(s) to allow endpoint/context = incoming ; Dialplan context to use endpoint/dtmf_mode = auto ; DTMF is sent as RFC 4733 if the other side supports it or as INBAND if not endpoint/direct_media = yes ; Enable direct media (peer to peer RTP) ;endpoint/tos_audio = ef ; Sets TOS for audio streams (QoS) ;endpoint/cos_audio = 5 ; Sets COS for audio streams (QoS) aor/qualify_frequency = 30 ; Interval at which to qualify an AoR (SIP Options Ping)
;-----
[TRUNK1](trunk-defaults) remote_hosts = IP_address_PBX:5060 ; IP of PBX identify/match = IP_address_PBX ; IP of PBX
;-----
[TRUNK2](trunk-defaults) remote_hosts = IP_address_PBX:5060 ; IP of PBX identify/match = IP_address_PBX ; IP of PBX
; Context for incoming calls
[incoming] exten => _X.,1,Dial(PJSIP/${EXTEN},300) ; Call the internal extension exten => _X.,n,Congestion(10) ; Play congestion tone if line is unavailable
; Exact duplicate of above, but note the "+" in "exten => _+X." which caters for +(Plus) dialing, e.g. +44xxxxxxxxxx ; Require both if using + dialing
exten => _+X.,1,Dial(PJSIP/${EXTEN},300) ; Call the internal extension exten => _+X.,n,Congestion(10) ; Play congestion tone if line is unavailable
; Context for outgoing calls
[outbound] exten => _X.,1,GotoIf($[${DEVICE_STATE(PJSIP/${EXTEN})} != INVALID]?10:15) ; Check dialed number locally registered, else route to trunk exten => _X.,10,Dial(PJSIP/${EXTEN},300) ; Call local extension if number registered exten => _X.,n,Congestion(10) ; Play congestion tone if line is unavailable exten => _X.,15,ChanIsAvail(PJSIP/TRUNK1&PJSIP/TRUNK2) ; Check which trunk is available exten => _X.,n,Set(AVAILCHAN=${CUT(PASSTHRU(${CUT(AVAILCHAN,-,1)}),/,2)}) ; Remove unwanted info from the response string exten => _X.,n,Dial(PJSIP/${EXTEN}@${AVAILCHAN},300) ; Dial through the available trunk exten => _X.,n,Congestion(10) ; Play congestion tone if line is unavailable
; Exact duplicate of above, but note the "+" in "exten => _+X." which caters for +(Plus) dialing, e.g. +44xxxxxxxxxx ; Require both if using + dialing
exten => _+X.,1,GotoIf($[${DEVICE_STATE(PJSIP/${EXTEN})} != INVALID]?10:15) ; Check dialed number locally registered, else route to trunk exten => _+X.,10,Dial(PJSIP/${EXTEN},300) ; Call local extension if number registered exten => _+X.,n,Congestion(10) ; Play congestion tone if line is unavailable exten => _+X.,15,ChanIsAvail(PJSIP/TRUNK1&PJSIP/TRUNK2) ; Check which trunk is available exten => _+X.,n,Set(AVAILCHAN=${CUT(PASSTHRU(${CUT(AVAILCHAN,-,1)}),/,2)}) ; Remove unwanted info from the response string exten => _+X.,n,Dial(PJSIP/${EXTEN}@${AVAILCHAN},300) ; Dial through the available trunk
|