#----------------------------------------------------------------#
#                                                                #
# Shipping Configuration                                         #
#                                                                #
#----------------------------------------------------------------#

cli version 4.00
snmp shutdown

actions

  rule PROV_STARTUP
    condition ip address:WAN.DHCP LINKUP initial
    condition system ntp TIME_INITIALIZED
    action 1 "provisioning execute PF_PROVISIONING_CONFIG"

profile aaa DEFAULT
  method 1 local rule required
  method 2 none rule required

console
  use profile aaa DEFAULT

telnet-server
  use profile aaa DEFAULT
  no shutdown

ssh-server
  use profile aaa DEFAULT
  no shutdown

web-server
  protocol http port 80
  protocol https port 443
  use profile aaa DEFAULT
  no shutdown

system
  clock-source 1 bri 0 0
  clock-source 2 bri 0 1
  clock-source 3 bri 0 2
  clock-source 4 bri 0 3
  clock-source 5 bri 0 4
  clock-source 6 bri 0 5
  clock-source 7 bri 0 6
  clock-source 8 bri 0 7

ntp
  server 0.patton.pool.ntp.org
  server 1.patton.pool.ntp.org
  server 2.patton.pool.ntp.org
  server 3.patton.pool.ntp.org
  no shutdown

profile napt NAPT_WAN

profile provisioning PF_PROVISIONING_CONFIG
  destination configuration
  use profile tls DEFAULT
  location 1 https://provision.patton.io/$(system.serial);mac=$(system.mac);serial=$(system.serial);hwMajor=$(system.hw.major);hwMinor=$(system.hw.minor);swMajor=$(system.sw.major);swMinor=$(system.sw.minor);swDate=$(system.sw.date);productName=$(system.product.name);cliMajor=$(cli.major);cliMinor=$(cli.minor);osName=Trinity;subDirTrinity=/Trinity;subDirSmartWare=;dhcp66=$(dhcp.66);dhcp67=$(dhcp.67)
  location 2 $(dhcp.66)
  location 3 $(dhcp.66)/$(system.serial).cfg
  location 4 http://$(dhcp.66)/$(dhcp.67)
  location 5 http://$(dhcp.66)/$(system.serial).cfg
  location 6 tftp://$(dhcp.66)/$(dhcp.67)
  location 7 tftp://$(dhcp.66)/$(system.serial).cfg
  activation reload immediate

profile voip DEFAULT
  codec 1 g711alaw64k rx-length 20 tx-length 20
  codec 2 g711ulaw64k rx-length 20 tx-length 20

profile sip DEFAULT

context ip ROUTER

  interface WAN
    ipaddress DHCP dhcp
    ipaddress WAN_STATIC 192.168.1.1 255.255.255.0
    use profile napt NAPT_WAN DHCP

  routing-table DEFAULT

profile ppp DEFAULT

cwmp-client
  bind ipaddress ROUTER WAN DHCP
  session-retry-maximum 1
  no shutdown

context cs SWITCH
  no shutdown

  routing-table called-e164 RT_to_SIP
    route .T dest-interface IF_SIP

  routing-table called-e164 RT_to_BRI
    route 2.. dest-table RT_to_ISDN_BRI

  routing-table called-e164 RT_to_ISDN_BRI
    route 200 dest-interface IF_ISDN_BRI_00
    route 201 dest-interface IF_ISDN_BRI_01
    route 202 dest-interface IF_ISDN_BRI_02
    route 203 dest-interface IF_ISDN_BRI_03
    route 204 dest-interface IF_ISDN_BRI_04
    route 205 dest-interface IF_ISDN_BRI_05
    route 206 dest-interface IF_ISDN_BRI_06
    route 207 dest-interface IF_ISDN_BRI_07

  interface sip IF_SIP
    bind context sip-gateway GW_SIP
    route call dest-table RT_to_BRI
    remote sip.domain 5060

  interface isdn IF_ISDN_BRI_00
    route call dest-table RT_to_SIP
    address-complete-indication emit set

  interface isdn IF_ISDN_BRI_01
    route call dest-table RT_to_SIP
    address-complete-indication emit set

  interface isdn IF_ISDN_BRI_02
    route call dest-table RT_to_SIP
    address-complete-indication emit set

  interface isdn IF_ISDN_BRI_03
    route call dest-table RT_to_SIP
    address-complete-indication emit set

  interface isdn IF_ISDN_BRI_04
    route call dest-table RT_to_SIP
    address-complete-indication emit set

  interface isdn IF_ISDN_BRI_05
    route call dest-table RT_to_SIP
    address-complete-indication emit set

  interface isdn IF_ISDN_BRI_06
    route call dest-table RT_to_SIP
    address-complete-indication emit set

  interface isdn IF_ISDN_BRI_07
    route call dest-table RT_to_SIP
    address-complete-indication emit set

location-service LS
  domain 1 sip.domain
  match-any-domain

context sip-gateway GW_SIP
  bind location-service LS

  interface IF_SIP
    transport-protocol udp+tcp 5060
    bind ipaddress ROUTER WAN DHCP

context sip-gateway GW_SIP
  no shutdown

port ethernet 0 0
  bind interface ROUTER WAN
  no shutdown

port bri 0 0
  clock auto
  encapsulation q921

  q921
    protocol pmp
    uni-side auto
    encapsulation q931

    q931
      protocol dss1
      uni-side net
      max-calls 2
      channel-range 0 1
      encapsulation cc-isdn
      bind interface SWITCH IF_ISDN_BRI_00

port bri 0 0
  no shutdown

port bri 0 1
  clock auto
  encapsulation q921

  q921
    protocol pmp
    uni-side auto
    encapsulation q931

    q931
      protocol dss1
      uni-side net
      max-calls 2
      channel-range 0 1
      encapsulation cc-isdn
      bind interface SWITCH IF_ISDN_BRI_01

port bri 0 1
  no shutdown

port bri 0 2
  clock auto
  encapsulation q921

  q921
    protocol pmp
    uni-side auto
    encapsulation q931

    q931
      protocol dss1
      uni-side net
      max-calls 2
      channel-range 0 1
      encapsulation cc-isdn
      bind interface SWITCH IF_ISDN_BRI_02

port bri 0 2
  no shutdown

port bri 0 3
  clock auto
  encapsulation q921

  q921
    protocol pmp
    uni-side auto
    encapsulation q931

    q931
      protocol dss1
      uni-side net
      max-calls 2
      channel-range 0 1
      encapsulation cc-isdn
      bind interface SWITCH IF_ISDN_BRI_03

port bri 0 3
  no shutdown

port bri 0 4
  clock auto
  encapsulation q921

  q921
    protocol pmp
    uni-side auto
    encapsulation q931

    q931
      protocol dss1
      uni-side net
      max-calls 2
      channel-range 0 1
      encapsulation cc-isdn
      bind interface SWITCH IF_ISDN_BRI_04

port bri 0 4
  no shutdown

port bri 0 5
  clock auto
  encapsulation q921

  q921
    protocol pmp
    uni-side auto
    encapsulation q931

    q931
      protocol dss1
      uni-side net
      max-calls 2
      channel-range 0 1
      encapsulation cc-isdn
      bind interface SWITCH IF_ISDN_BRI_05

port bri 0 5
  no shutdown

port bri 0 6
  clock auto
  encapsulation q921

  q921
    protocol pmp
    uni-side auto
    encapsulation q931

    q931
      protocol dss1
      uni-side net
      max-calls 2
      channel-range 0 1
      encapsulation cc-isdn
      bind interface SWITCH IF_ISDN_BRI_06

port bri 0 6
  no shutdown

port bri 0 7
  clock auto
  encapsulation q921

  q921
    protocol pmp
    uni-side auto
    encapsulation q931

    q931
      protocol dss1
      uni-side net
      max-calls 2
      channel-range 0 1
      encapsulation cc-isdn
      bind interface SWITCH IF_ISDN_BRI_07

port bri 0 7
  no shutdown
