Scheme:
Task: You need to configure the ESR-12 to provide call routing between users 333, 444, 888 and 777. To complete this task, you need to configure the registration of users 555 (FXO), 888 (FXS), 444 (IP-telephone) on the local PBX server of the router ESR-12, configure a trunk for incoming calls from an external SIP server, and also configure a routing context (rules) for call processing.
The solution to this problem will be solved in 2 stages:
1. Setting up a PBX-server.
2. Configuring interfaces gi 1/0/1, gi 1/0/2, FXO and FXS.
1. Setting up a PBX-server.
Example of setting up the PBX-server:
1) Configuring routing context on the PBX-server.
The example of configuring a routing context for the IP-telephone (444). You need to configure call rules to numbers 888, 777 and 333.
Number 888 is a local user and the calling rule will be as follows:
esr-12vf# configure esr-12vf(config)# pbxesr-12vf(config-pbx)# ruleset sip_phoneesr-12vf(config-pbx-ruleset)# rule 1esr-12vf(config-pbx-rule)# description "Calling the 888"esr-12vf(config-pbx-rule)# pattern '888,1,Dial(SIP/${EXTEN},,t)'esr-12vf(config-pbx-rule)# enable
Number 777 is available through FXO (number 555) and the calling rule is as follows:
esr-12vf# configure esr-12vf(config)# pbxesr-12vf(config-pbx)# ruleset sip_phoneesr-12vf(config-pbx-ruleset)# rule 3esr-12vf(config-pbx-rule)# description "Calling the 777 via FXO"esr-12vf(config-pbx-rule)# pattern '777,1,Dial(SIP/555/555${EXTEN})'esr-12vf(config-pbx-rule)# enable
The 888 number is available via a SIP-server (203.0.113.2) and the calling rule can be configured in two ways:
The first way via IP address:
esr-12vf# configure esr-12vf(config)# pbxesr-12vf(config-pbx)# ruleset sip_phoneesr-12vf(config-pbx-ruleset)# rule 5esr-12vf(config-pbx-rule)# description "Calling the 333 via SIP-Server"esr-12vf(config-pbx-rule)# pattern '333,1,Dial(SIP/${EXTEN}@203.0.113.2)'esr-12vf(config-pbx-rule)# enable
The second way via the trunk profile, which we will configure in the next item:
esr-12vf# configure esr-12vf(config)# pbxesr-12vf(config-pbx)# ruleset sip_phoneesr-12vf(config-pbx-ruleset)# rule 3esr-12vf(config-pbx-rule)# description "Calling the 333 via SIP-Server"esr-12vf(config-pbx-rule)# pattern '333,1,Dial(SIP/trunk_to_SIP_server/${EXTEN})'esr-12vf(config-pbx-rule)# enable
To successfully complete a call, it is recommended to add the following rule after each call rule:
esr-12vf# configure esr-12vf(config)# pbxesr-12vf(config-pbx)# ruleset sip_phoneesr-12vf(config-pbx-ruleset)# rule 2esr-12vf(config-pbx-rule)# description "Hang up 888"esr-12vf(config-pbx-rule)# pattern '888,2,Hangup()'esr-12vf(config-pbx-rule)# enable
2) Configuring a SIP-profile on the PBX-Server.
The example of configuring SIP-profiles for IP-telephone (444) and for a trunk towards the SIP-server (203.0.113.2). In the SIP-profile configuration, you need to enable codecs and bind configured routing contexts. In the trunk configuration for the SIP server (203.0.113.2), you need to specify the type external and host-address of the SIP-server.
esr-12vf# configure esr-12vf(config)# pbxesr-12vf(config-pbx)# profile sip_phoneesr-12vf(config-pbx-profile)# client friendesr-12vf(config-pbx-profile)# codec allow g711aesr-12vf(config-pbx-profile)# codec allow g711uesr-12vf(config-pbx-profile)# codec allow g722esr-12vf(config-pbx-profile)# codec allow g726esr-12vf(config-pbx-profile)# nat comediaesr-12vf(config-pbx-profile)# qualify 10000esr-12vf(config-pbx-profile)# ruleset sip_phoneesr-12vf(config-pbx-profile)# exitesr-12vf(config-pbx)#esr-12vf(config-pbx)# profile trunk_to_SIP_serveresr-12vf(config-pbx-profile)# type externalesr-12vf(config-pbx-profile)# client friendesr-12vf(config-pbx-profile)# codec allow g711aesr-12vf(config-pbx-profile)# codec allow g711uesr-12vf(config-pbx-profile)# security level invite-portesr-12vf(config-pbx-profile)# nat comediaesr-12vf(config-pbx-profile)# qualify 10000esr-12vf(config-pbx-profile)# host-address 203.0.113.2esr-12vf(config-pbx-profile)# ruleset from_sip_server
3) User setup on the PBX-server.
Example of user setup for the IP-telephone (444). In the user configuration, you need to specify the profile and password:
esr-12vf# configure esr-12vf(config)# pbxesr-12vf(config-pbx)# user 444esr-12vf(config-pbx-user)# profile sip_phoneesr-12vf(config-pbx-user)# password 444
An example of a complete PBX-server setup for this scheme:
pbx ruleset FXO rule 1 description "Incomming from FXO" pattern '333,1,Dial(SIP/${EXTEN}@203.0.113.2)' enable exit rule 1 description "Hang up 333" pattern '333,2,Hangup()' enable exit exit ruleset FXS rule 1 description "Calling the 444" pattern '444,1,Dial(SIP/${EXTEN},,t)' enable exit rule 2 description "Hang up 900" pattern '900,2,Hangup()' enable exit rule 3 description "Calling the 777 via FXO" pattern '777,1,Dial(SIP/555/555${EXTEN})' enable exit rule 4 description "Hang up 777" pattern '777,2,Hangup()' enable exit rule 5 description "Calling the 333 via SIP-Server" pattern '333,1,Dial(SIP/${EXTEN}@203.0.113.2)' enable exit rule 6 description "Hang up 333" pattern '333,2,Hangup()' enable exit exit ruleset from_sip_server rule 1 description "Calling the 444" pattern '444,1,Dial(SIP/${EXTEN},,t)' enable exit rule 2 description "Hang up 444" pattern '444,2,Hangup()' enable exit rule 3 description "Calling the 888" pattern '888,1,Dial(SIP/${EXTEN},,t)' enable exit rule 4 description "Hang up 888" pattern '888,2,Hangup()' enable exit rule 5 description "Calling the 777 via FXO" pattern '777,1,Dial(SIP/555/555${EXTEN})' enable exit rule 6 description "Hang up 777" pattern '777,2,Hangup()' enable exit exit ruleset sip_phone rule 1 description "Calling the 888" pattern '888,1,Dial(SIP/${EXTEN},,t)' enable exit rule 2 description "Hang up 888" pattern '888,2,Hangup()' enable exit rule 3 description "Calling the 777 via FXO" pattern '777,1,Dial(SIP/555/555${EXTEN})' enable exit rule 4 description "Hang up 777" pattern '777,2,Hangup()' enable exit rule 5 description "Calling the 333 via SIP-Server" pattern '333,1,Dial(SIP/${EXTEN}@203.0.113.2)' enable exit rule 6 description "Hang up 333" pattern '333,2,Hangup()' enable exit exit profile fxo_port client friend codec allow g711a codec allow g711u security level invite-port ruleset FXO exit profile fxs_ports client friend codec allow g711a codec allow g711u codec allow g729 ruleset FXS exit profile sip_phone client friend codec allow g711a codec allow g711u codec allow g722 codec allow g726 nat comedia qualify 10000 ruleset sip_phone exit profile trunk_to_SIP_server type external client friend codec allow g711a codec allow g711u security level invite-port nat comedia qualify 10000 host-address 203.0.113.2 ruleset from_sip_server exit user 555 profile fxo_port exit user 888 profile fxs_ports exit user 444 profile sip_phone password encrypted C8E057 exit enableexit
2. Configuring interfaces
In the FXS interface configuration you need to specify the user 888 and the fxs_ports profile:
esr-12vf# configure
esr-12vf(config)# interface voice-port 1
esr-12vf(config-voice-port-fxs)# sip user phone 888
esr-12vf(config-voice-port-fxs)# profile pbx fxs_ports
esr-12vf(config-voice-port-fxs)# exit
In the FXO interface configuration, you need to specify user 555, fxo_port profile, and forwarding number when calling the FXO number (555). For example, the call will be forwarded to number 333:
esr-12vf(config)# interface voice-port 4esr-12vf(config-voice-port-fxo)# sip user phone 555esr-12vf(config-voice-port-fxo)# profile pbx fxo_portesr-12vf(config-voice-port-fxo)# hotline iptesr-12vf(config-voice-port-fxo)# hotline number ipt 333esr-12vf(config-voice-port-fxo)# pstn transmit-numberesr-12vf(config-voice-port-fxo)# no pstn transmit-prefixesr-12vf(config-voice-port-fxo)# exit
Configuring physical interfaces without a firewall:
esr-12vf(config)# interface gigabitethernet 1/0/1esr-12vf(config-if-gi)# ip firewall disableesr-12vf(config-if-gi)# ip address 198.51.100.1/24esr-12vf(config-if-gi)# exitesr-12vf(config)# interface gigabitethernet 1/0/2esr-12vf(config-if-gi)# ip firewall disableesr-12vf(config-if-gi)# ip address 203.0.113.1/30esr-12vf(config-if-gi)# exit
