#----------------------------------------------------------------#
#                                                                #
# 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

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

dns-server
  host 192.168.1.1 smartnode.local
  no shutdown

profile dhcp-server DHCPS_LAN
  network 192.168.1.0/24
  lease 24 hours
  default-router 192.168.1.1
  domain-name-server 192.168.1.1
  include 192.168.1.10 192.168.1.99

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 fxs DEFAULT_EU
  electrical-standard etsi
  caller-id standard fsk-etsi presentation mid-ring

profile fxs DEFAULT_US
  electrical-standard bell
  caller-id standard fsk-bell presentation mid-ring

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
    use profile napt NAPT_WAN DHCP

  interface LAN
    ipaddress LAN 192.168.1.1/24

  routing-table DEFAULT

context ip ROUTER
  use profile dhcp-server DHCPS_LAN

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_FXS
    route 100 dest-interface IF_FXS_00
    route 101 dest-interface IF_FXS_01
    route 102 dest-interface IF_FXS_02
    route 103 dest-interface IF_FXS_03
    route 104 dest-interface IF_FXS_04
    route 105 dest-interface IF_FXS_05
    route 106 dest-interface IF_FXS_06
    route 107 dest-interface IF_FXS_07
    route 108 dest-interface IF_FXS_08
    route 109 dest-interface IF_FXS_09
    route 110 dest-interface IF_FXS_10
    route 111 dest-interface IF_FXS_11
    route 112 dest-interface IF_FXS_12
    route 113 dest-interface IF_FXS_13
    route 114 dest-interface IF_FXS_14
    route 115 dest-interface IF_FXS_15
    route 116 dest-interface IF_FXS_16
    route 117 dest-interface IF_FXS_17
    route 118 dest-interface IF_FXS_18
    route 119 dest-interface IF_FXS_19
    route 120 dest-interface IF_FXS_20
    route 121 dest-interface IF_FXS_21
    route 122 dest-interface IF_FXS_22
    route 123 dest-interface IF_FXS_23
    route 124 dest-interface IF_FXS_24
    route 125 dest-interface IF_FXS_25
    route 126 dest-interface IF_FXS_26
    route 127 dest-interface IF_FXS_27
    route 128 dest-interface IF_FXS_28
    route 129 dest-interface IF_FXS_29
    route 130 dest-interface IF_FXS_30
    route 131 dest-interface IF_FXS_31

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

  interface fxs IF_FXS_00
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_01
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_02
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_03
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_04
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_05
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_06
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_07
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_08
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_09
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_10
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_11
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_12
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_13
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_14
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_15
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_16
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_17
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_18
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_19
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_20
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_21
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_22
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_23
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_24
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_25
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_26
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_27
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_28
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_29
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_30
    route call dest-table RT_to_SIP

  interface fxs IF_FXS_31
    route call dest-table RT_to_SIP

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 ethernet 0 1
  bind interface ROUTER LAN
  no shutdown

port fxs 0 0
  subscriber-number 100
  bind interface SWITCH IF_FXS_00
  no shutdown

port fxs 0 1
  subscriber-number 101
  bind interface SWITCH IF_FXS_01
  no shutdown

port fxs 0 2
  subscriber-number 102
  bind interface SWITCH IF_FXS_02
  no shutdown

port fxs 0 3
  subscriber-number 103
  bind interface SWITCH IF_FXS_03
  no shutdown

port fxs 0 4
  subscriber-number 104
  bind interface SWITCH IF_FXS_04
  no shutdown

port fxs 0 5
  subscriber-number 105
  bind interface SWITCH IF_FXS_05
  no shutdown

port fxs 0 6
  subscriber-number 106
  bind interface SWITCH IF_FXS_06
  no shutdown

port fxs 0 7
  subscriber-number 107
  bind interface SWITCH IF_FXS_07
  no shutdown

port fxs 0 8
  subscriber-number 108
  bind interface SWITCH IF_FXS_08
  no shutdown

port fxs 0 9
  subscriber-number 109
  bind interface SWITCH IF_FXS_09
  no shutdown

port fxs 0 10
  subscriber-number 110
  bind interface SWITCH IF_FXS_10
  no shutdown

port fxs 0 11
  subscriber-number 111
  bind interface SWITCH IF_FXS_11
  no shutdown

port fxs 0 12
  subscriber-number 112
  bind interface SWITCH IF_FXS_12
  no shutdown

port fxs 0 13
  subscriber-number 113
  bind interface SWITCH IF_FXS_13
  no shutdown

port fxs 0 14
  subscriber-number 114
  bind interface SWITCH IF_FXS_14
  no shutdown

port fxs 0 15
  subscriber-number 115
  bind interface SWITCH IF_FXS_15
  no shutdown

port fxs 0 16
  subscriber-number 116
  bind interface SWITCH IF_FXS_16
  no shutdown

port fxs 0 17
  subscriber-number 117
  bind interface SWITCH IF_FXS_17
  no shutdown

port fxs 0 18
  subscriber-number 118
  bind interface SWITCH IF_FXS_18
  no shutdown

port fxs 0 19
  subscriber-number 119
  bind interface SWITCH IF_FXS_19
  no shutdown

port fxs 0 20
  subscriber-number 120
  bind interface SWITCH IF_FXS_20
  no shutdown

port fxs 0 21
  subscriber-number 121
  bind interface SWITCH IF_FXS_21
  no shutdown

port fxs 0 22
  subscriber-number 122
  bind interface SWITCH IF_FXS_22
  no shutdown

port fxs 0 23
  subscriber-number 123
  bind interface SWITCH IF_FXS_23
  no shutdown

port fxs 0 24
  subscriber-number 124
  bind interface SWITCH IF_FXS_24
  no shutdown

port fxs 0 25
  subscriber-number 125
  bind interface SWITCH IF_FXS_25
  no shutdown

port fxs 0 26
  subscriber-number 126
  bind interface SWITCH IF_FXS_26
  no shutdown

port fxs 0 27
  subscriber-number 127
  bind interface SWITCH IF_FXS_27
  no shutdown

port fxs 0 28
  subscriber-number 128
  bind interface SWITCH IF_FXS_28
  no shutdown

port fxs 0 29
  subscriber-number 129
  bind interface SWITCH IF_FXS_29
  no shutdown

port fxs 0 30
  subscriber-number 130
  bind interface SWITCH IF_FXS_30
  no shutdown

port fxs 0 31
  subscriber-number 131
  bind interface SWITCH IF_FXS_31
  no shutdown

