The MikroTik RouterOS IP Telephony feature enables Voice over IP (VoIP) connunications using routers equiped with the following voice ports:
Topics covered in this manual:
The software package size is 1.2MB, after installation it requires 9.1MB of additional HDD space and 8.8MB of additional RAM. Please make sure you have the required capacity. Use /system resource print command to see the amount of available resources:
[MikroTik] > system resource print
uptime: 7m17s
total-memory: 61240
free-memory: 32756
cpu-type: AMD-K6(tm)
cpu-frequency: 300
hdd-total: 46474
hdd-free: 20900
[MikroTik] >
You may want to increase the amount of RAM from 32MB to 48/64MB if you use telephony. Use the /system package print command to see the list of installed packages:
[MikroTik] > system package print # NAME VERSION BUILD-TIME UNINSTALL 0 ppp 2.4.1 oct/12/2001 10:09:35 no 1 pptp 2.4.1 oct/12/2001 10:10:17 no 2 pppoe 2.4.1 oct/12/2001 10:11:17 no 3 ssh 2.4.1 oct/12/2001 10:16:38 no 4 isdn 2.4.1 oct/12/2001 10:19:04 no 5 telephony 2.4.1 oct/12/2001 10:35:03 no 6 wavelan 2.4.1 oct/12/2001 10:15:18 no 7 system 2.4.1 oct/12/2001 10:05:27 no 8 routing 2.4.1 oct/12/2001 10:07:32 no 9 snmp 2.4.1 oct/12/2001 10:07:58 no [MikroTik] >
If the MikroTik router will be used as
Configuration of the IP telephony can be accessed under the /ip telephony menu:
[MikroTik] ip telephony> ?
codec Audio compression capability management
export Export IP Telephony settings
numbers Telephone numbers management
region Telephony voice port regional setting management
voice-port Telephony voice port management
[MikroTik] ip telephony>
Telephony Voice Ports
The management of all IP telephony voice ports (linejack, phonejack, isdn, voip)
can be accessed under the /ip telephony voice-port menu.
Use the print command to view the list of available telephony voice ports and their configuration.
[MikroTik] ip telephony voice-port> print Flags: X - disabled # NAME AUTODIAL TYPE 0 PBX_Line linejack 1 ISDN_GW isdn 2 VoIP_GW voip [MikroTik] ip telephony voice-port>
Description of arguments:
name - name assigned to the voice port by user.
type - ( phonejack / linejack / isdn / voip ) type of the installed telephony voice port, i.e., PhoneJack or LineJack.
autodial-number - number to be dialed automatically, if the voice port is to be used. The number should be present under the /ip telephony numbers list
[MikroTik] ip telephony voice-port linejack> monitor PBX_Line
status: connection
port: phone
direction: port-to-ip
line-status: unplugged
phone-number: 26
remote-party-name: pbx_20 [10.5.8.12]
codec: G.723.1-6.4k/hw
duration: 14s
[MikroTik] ip telephony voice-port linejack>
Argument description:
status - current state of the port
'on-hook' - the handset is on-hook, no activity
'off-hook' - the handset is off-hook, the number is being dialed
'ring' - call in progress, direction of the call is shown by the argument 'direction'
'connection' - the connection has been established
'busy' - the connection has been terminated, the handset is still 'off-hook'
port - (only for linejack) the active port of the card
'phone' - telephone connected to the card (POTS)
'line' - line connected to the linejack card (PSTN)
direction - direction of the call
'ip-to-port' - call from the IP network to the voice card
'port-to-ip' - call from the voice card to an IP address
line-status - (only for linejack) state of the PSTN line
'plugged' - the telephone line is connected to the PSTN port of the linejack card
'unplugged' - theri is no vorking line connected to the PSTN port of the linejack card
phone-number - the number which is being dialed
remote-party-name - name and IP address of the remote party
codec - CODEC used for the audio connection
duration - duration of the audio call
[MikroTik] ip telephony voice-port linejack> show-stats PBX_Line
round-trip-delay: 5ms
packets-sent: 617
bytes-sent: 148080
max-send-time: 31ms
avg-send-time: 30ms
min-send-time: 29ms
packets-received: 589
bytes-received: 141360
max-receive-time: 41ms
avg-receive-time: 30ms
min-receive-time: 19ms
average-jitter-delay: 59ms
packets-lost: 0
packets-out-of-order: 0
packets-too-late: 2
[MikroTik] ip telephony voice-port linejack>
The average-jitter-delay shows the approximate delay time till fhe received voice packet is forwarded to the driver for playback. The value shown is never less than 30ms, although the actual delay time could be less. If the shown value is >40ms, then it is close (+/-1ms) to the real delay time.
The jitter buffer preserves quality of the voice signal against the loss or delay of packets while traveling over the network. The larger the jitter buffer, the larger the total delay, but fewer packets lost due to timeout. If the jitter-buffer=0, then it is adjusted automatically during the conversation to minimize the number of lost packets. The 'average-jitter-delay' is the approximate average time from the moment of receiving an audio packet from the IP network till it is played back over the telephony voice port.
The total delay from the moment of recording the voice signal till its playback is
the sum of following three delay times:
A voice call can be terminated using the clear-call command in phonejack, linejack or isdn submenus. If the voiceport has an actve connection, the command cler-call voiceport terminates it. The command is useful in the cases, when the termantion of connection has not been detected by one of the parties, and there is an "infinete call". It can also be used to terminate someones call, if it is using up the required line for another call.
[MikroTik] ip telephony voice-port linejack> print
Flags: X - disabled
0 name=linejack autodial="" playback-volume=-2 record-volume=-2
ring-cadence=++-++--- ++-++--- region=us echo-cancellation=yes
aec-tail-length=short aec-nlp-threshold=low aec-atten-scaling=4
aec-atten-boost=0
1 name=linejack_1 autodial="" playback-volume=-2 record-volume=-2
ring-cadence=++-++--- ++-++--- region=us echo-cancellation=yes
aec-tail-length=short aec-nlp-threshold=low aec-atten-scaling=4
aec-atten-boost=0
[MikroTik] ip telephony voice-port linejack>
Argument descriptions:
name - name given by the user or the default one (phonejack or phonejack_x)
type - (only for phonejack) type of the card (phonejack, phonejack-lite or phonejack-pci), cannot be changed
autodial - phone number which will be dialed immediately after the handset has been lifted. If this number is incomplete, then the remaining part has to be dialed on the dial-pad. If the number is incorrect, busy tone is played. If the number is correct, then the appropriate number is dialed. If it is an incoming call from the PSTN line (linejack), then the 'directcall' mode is used - the line is picked up only after the remote party answers the call.
playback-volume - playback volume in dB, 0dB means no change, possible values are -24...24dB.
record-volume - recording volume in dB, 0dB means no change, possible values are -24...24dB.
ring-cadence - a 16-symbol ring cadence for the phone, each symbol is 0.5 seconds, '+' means ringing, '-' means no ringing.
region - regional setting for the voice port. For phonejack, this setting is used for generating the tones. For linejacks, this setting is used for detecting the parameters of PSTN line, as well as for detecting and generating the tones.
echo-cancellation - echo detection and cancellation. Possible values are 'yes/no'.
If the echo cancellation is on, then the following parameters are used:
aec-tail-length - size of the buffer of echo detection. Possible values are 'short/medium/long'.
aec-nlp-threshold - level of cancellation of silent sounds. Possible values are 'off/low/medium/high'.
aec-atten-scaling - factor of additional echo attenuation. Possible values are 0...10.
aec-atten-boost - level of additional echo attenuation. Possible values are 0, 6, 12 ... 84, 90dB, i.e., should be multipliers of 6.
For linejacks, there is a command blink voiceport, which blinks the LEDs of the specified voiceport for five seconds after it is invoked. This command can be used to locate the respective card under several linejack cards.
[MikroTik] ip telephony voice-port isdn> print Flags: X - disabled # NAME MSN AUTODIAL REGION PLAYBACK-VOLUME RECORD-VOLUME 0 ISDN_GW us -2 -2 [MikroTik] ip telephony voice-port isdn>
Argument descriptions:
name - Name given by the user or the default one.
msn - Telephone number of the ISDN voice port (ISDN MSN number). It determines which calls from the ISDN line this voice port should answer.
autodial - phone number which will be dialed immediately after the handset has been lifted. If this number is incomplete, then the remaining part has to be dialed on the dial-pad. If the number is incorrect, busy tone is played. If the number is correct, then the appropriate number is dialed. If it is an incoming call from the ISDN line, then the 'directcall' mode is used - the line is picked up only after the remote party answers the call.
playback-volume - playback volume in dB, 0dB means no change, possible values are -24...24dB.
record-volume - recording volume in dB, 0dB means no change, possible values are -24...24dB.
region - regional setting for the voice port (for generating tones only).
[MikroTik] ip telephony voice-port voip> print detail
Flags: X - disabled
0 name=VoIP_GW autodial="" address=10.5.8.12 jitter-buffer=50ms
silence-detection=no prefered-codec=none fast-start=yes
[MikroTik] ip telephony voice-port voip>
Argument description:
name - Name given by the user or the default one.
address - IP address of the remote party (IP telephone or gateway) associated with this voice port. If the call has to be performed through this voice port, then the specified IP address is called. If there is an incoming call from the specified IP address, then the parameters of this voice port are used. If there is an incoming call from an IP address, which is not specified in any of the voip voice port records, then the default record with the address 0.0.0.0 is used. If there is no default record, then default values are used.
autodial - phone number which will be added in front of the telephone number received over the IP network. In most cases it should be blank.
jitter-buffer - size of the jitter buffer, 0...1000ms. The jitter buffer preserves quality of the voice signal against the loss or delay of packets while traveling over the network. The larger the jitter buffer, the larger the total delay, but fewer packets lost due to timeout. If the setting is jitter-buffer=0, the size of it is adjusted automatically during the conversation, to minimize the number of lost packets and the length of the jitter buffer.
silence-detection - if 'yes', then no silence is detected and no audio data is sent over the IP network during the silence period.
prefered-codec - the preferred codec to be used for this voip voice port. If possible, the specified codec will be used.
fast-start - allow or disallow the fast start. The fast start allows establishing the audio connection in a shorter time. However, not always it is possible. Therefore, it should be turned off, there are problems using the fast start mode.
Numbers
This is the so-called "routing table" for voice calls.
This table assigns numbers to the voice ports.
[MikroTik] ip telephony numbers> print Flags: I - invalid, X - disabled # DESTINATION-PATTERN VOICE-PORT PREFIX 0 26 VoIP_GW 26 [MikroTik] ip telephony numbers>
Argument description:
destination-pattern - pattern of the telephone number. Symbols '.' and '#' designate any digit. The telephone numbers should be unique.
voice-port - voice port to be used when calling the specified telephone number.
prefix - prefix, which will be used to substitute the known part of the 'destination-pattern', i.e., the part containing digits, when using this voice port. The 'destination-pattern' argument is used to determine which voice port to be used, whereas the 'prefix' argument designated the number to dial over the voice port (be sent over to the remote party). If the remote party is an IP telephony gateway, then the number will be used for making the call.
The main function of the number routing table is to determine:
[MikroTik] ip telephony numbers> print Flags: I - invalid, X - disabled # DESTINATION-PATTERN VOICE-PORT PREFIX 0 12345 XX 1 1111. YY 2 22... ZZ 333 3 ... QQ 55 [MikroTik] ip telephony numbers>
We will analyze the Number Received (nr) - number dialed at the telephone, or received over the line, the Voice Port (vp) - voice port to be used for the call, and the Number to Call (nc) - number to be called over the Voice Port.
If nr=55555, it does not match any of the destination patterns, therefore it is rejected.
If nr=123456, it does not match any of the destination patterns, therefore it is rejected.
If nr=1234, it does not match any of the destination patterns (incomplete for record #0, therefore it is rejected.
If nr=12345, it matches the record #0, therefore number "" is dialed over the voice port XX.
If nr=11111, it matches the record #1, therefore number "1" is dialed over the voice port YY.
If nr=22987, it matches the record #2, therefore number "333987" is dialed over the voice port ZZ.
If nr=22000, it matches the record #2, therefore number "333000" is dialed over the voice port ZZ.
If nr=444, it matches the record #3, therefore number "55444" is dialed over the voice port QQ.
Regional Settings
Regional settings are used to adjust the voice port properties to the PSTN system or the PBX.
For example, to detect hang-up from line, there has to be correct regional setting for the LineJACK card:
there must be correct busy-tone-filter frequency and busy-tone-cadence set for region which this LineJACK card uses.
Regional settings are managed under the /ip telephony region menu:
[MikroTik] ip telephony region> print
Flags: P - predefined
0 P name=us data-access-arrangement=us dial-tone-frequency=350x-6,440x-6
dial-tone-filter=350-440 busy-tone-frequency=480x-6,620x-6
busy-tone-filter=480-620 busy-tone-cadence=500,500,500,500
ring-tone-frequency=480x-6,440x-6 ring-tone-filter=440-480
ring-tone-cadence=2000,4000
1 P name=uk data-access-arrangement=uk dial-tone-frequency=350x-6,440x-6
dial-tone-filter=350-440 busy-tone-frequency=400x-6 busy-tone-filter=400
busy-tone-cadence=375,375,375,375 ring-tone-frequency=400x-6,450x-6
ring-tone-filter=400-450 ring-tone-cadence=400,200,400,2000
2 P name=france data-access-arrangement=france dial-tone-frequency=440x-6
dial-tone-filter=440 busy-tone-frequency=440x-6 busy-tone-filter=440
busy-tone-cadence=250,250,250,250 ring-tone-frequency=440x-6
ring-tone-filter=440 ring-tone-cadence=1500,3500
Argument description:
flag - (P) predefined, cannot be changed or removed. Users can add their own regional settings, which can be changed and removed.Sometimes it is necessary to add an additional regional setting matching the properties of a particular PBX. Use the add command to add a new regional setting:
name - Name of the regional setting
busy-tone-cadence - Busy tone cadence in ms (0 - end of cadence)
busy-tone-filter - Busy tone detection frequency Hz
busy-tone-frequency - Frequency and volume gain of busy tone Hz x dB
data-access-arrangement - Ring voltage, impedance setting for line-jack card
dial-tone-filter - Dial tone detection frequency Hz
dial-tone-frequency - Frequency and volume gain of dial tone Hz x dB
ring-tone-cadence - Ring tone cadence in ms (0 - end of cadence)
ring-tone-filter - Ring tone detection frequency Hz
ring-tone-frequency - Frequency and volume gain of ring tone Hz x dB
[MikroTik] ip telephony region> add
Creates new item with specified property values.
busy-tone-cadence Busy tone cadence in ms (0 - end of cadence)
busy-tone-filter Busy tone detection frequency Hz
busy-tone-frequency Frequency and volume gain of busy tone Hz x dB
copy-from Item number
data-access-arrangement Ring voltage, impedance setting for line-jack card
dial-tone-filter Dial tone detection frequency Hz
dial-tone-frequency Frequency and volume gain of dial tone Hz x dB
name New regional setting name
ring-tone-cadence Ring tone cadence in ms (0 - end of cadence)
ring-tone-filter Ring tone detection frequency Hz
ring-tone-frequency Frequency and volume gain of ring tone Hz x dB
[MikroTik] ip telephony region> add
Audio CODEC
The available Audio Coding and Decoding Protocols (CODEC) are listed under /ip telephony codec menu:
[MikroTik] ip telephony codec> print Flags: X - disabled # NAME 0 G.723.1-6.4k/hw 1 G.728-16k/hw 2 G.711-ALaw-64k/hw 3 G.711-uLaw-64k/hw 4 G.711-uLaw-64k/sw 5 G.711-ALaw-64k/sw 6 G.729A-8k/sw 7 G.723.1-6.4k/sw 8 GSM-06.10-13.2k/sw 9 LPC-10-2.5k/sw [MikroTik] ip telephony codec>
CODECs are listed according to their priority of use. The highest priority is at the top. CODECs can be enabled, disabled and moved within the list. When connecting with other H.323 systems, the protocol will negotiate the CODEC which both of them support according to the priority order.
The hardware codecs (/hw) are built-in CODECs supported by Quicknet cards. If an ISDN card is used, then the hardware CODECs are ignored, only software CODECs (/sw) are used.
The choice of the CODEC type is based on the throughput and speed of the network. Better audio quality can be achieved by using CODEC requiring higher network throughput. The highest audio quality can be achieved by using the G.711-uLaw CODEC requiring 64kb/s throughput for each direction of the call. It is used mostly within a LAN. The G.723.1 CODEC is the most popular one to be used for audio connections over the Internet. It requires only 6.4kb/s throughput for each direction of the call.
Let us consider the following example of two IP telephones and an IP telephony gateway setup:

[Joe] ip telephony voice-port voip> add name=gw address=10.5.8.12 add name=robert address=10.5.8.2 [Joe] ip telephony voice-port voip> print Flags: X - disabled # NAME ADDRESS AUTODIAL JITTER-BUFFER PREFE... SIL FAS 0 gw 10.5.8.12 50ms none no yes 1 robert 10.5.8.2 50ms none no yes [Joe] ip telephony voice-port voip>
[Joe] ip telephony numbers> add destination-pattern=31 voice-port=robert add destination-pattern=33 voice-port=linejack add destination-pattern=1. voice-port=gw prefix=1 [Joe] ip telephony numbers> print Flags: I - invalid, X - disabled # DESTINATION-PATTERN VOICE-PORT PREFIX 0 31 robert 1 33 linejack 2 1. gw 1 [Joe] ip telephony numbers>
Making calls from the IP telephone 10.0.0.224:
After establishing the connection with '13', the voice port monitor shows:
[Joe] ip telephony voice-port linejack> monitor linejack
status: connection
port: phone
direction: port-to-ip
line-status: unplugged
phone-number: 13
remote-party-name: PBX_Line [10.1.1.12]
codec: G.723.1-6.4k/hw
duration: 16s
[Joe] ip telephony voice-port linejack>
[voip_gw] ip telephony voice-port linejack> set 0 region=mikrotik
[voip_gw] ip telephony voice-port linejack> print
Flags: X - disabled
0 name=PBX_Line autodial="" playback-volume=-2 record-volume=-2
ring-cadence=++-++--- ++-++--- region=mikrotik echo-cancellation=yes
aec-tail-length=short aec-nlp-threshold=low aec-atten-scaling=4
aec-atten-boost=0
[voip_gw] ip telephony voice-port linejack>
[voip_gw] ip telephony voice-port voip>
add name=joe address=10.0.0.224
add name=robert address=10.5.8.2 prefered-codec=G.723.1-6.4k/hw
[voip_gw] ip telephony voice-port voip> print detail
Flags: X - disabled
0 name=joe autodial="" address=10.0.0.224 jitter-buffer=50ms
silence-detection=no prefered-codec=none fast-start=yes
1 name=robert autodial="" address=10.5.8.2 jitter-buffer=50ms
silence-detection=no prefered-codec=G.723.1-6.4k/hw fast-start=yes
[voip_gw] ip telephony voice-port voip>
[voip_gw] ip telephony numbers> add destination-pattern=31 voice-port=robert prefix=31 add destination-pattern=33 voice-port=joe prefix=33 add destination-pattern=1. voice-port=PBX_Line prefix=1 [voip_gw] ip telephony numbers> print Flags: I - invalid, X - disabled # DESTINATION-PATTERN VOICE-PORT PREFIX 0 31 robert 31 1 33 joe 33 2 1. PBX_Line 1 [voip_gw] ip telephony numbers>
Making calls through the IP telephony gateway:
After establishing the voice connection with '33' (the call has been answered), the voice port monitor shows:
[voip_gw] ip telephony voice-port linejack> monitor PBX_Line
status: connection
port: line
direction: port-to-ip
line-status: plugged
phone-number: 33
remote-party-name: linejack [10.0.0.224]
codec: G.723.1-6.4k/hw
duration: 1m46s
[voip_gw] ip telephony voice-port linejack>
Setting up the MikroTik Router and CISCO Router
Here are some hints on how to get working configuration for telephony calls between CISCO and MikroTik router.
Tested on:
/ip telephony codec disable G.729A-8k/sw
/ip telephony codec disable "G.711-ALaw-64k/sw G.711-ALaw-64k/hw"
/ip telephony voice-port set cisco fast-start=yes
/ip telephony numbers add destination-pattern=101 voice-port=cisco prefix=101
/ip telephony numbers add destination-pattern=098 voice-port=linejack
Configuration on the CISCO side:
ip routing
voice service pots
default h323 call start
exit
voice service voip
default h323 call start
exit
voice rtp send-recv
dial-peer voice 1 pots
destination-pattern 101
port 0/0
exit
voice class codec codec_class_number
codec preference 1 g711ulaw
codec preference 2 g723r63
exit
NOTE: g723r53 codec can be used, too
dial-peer voice 11 voip
destination-pattern 098
session target ipv4:10.0.0.98
voice-class codec codec_class_number
exit
NOTE: instead of codec class, one specified codec could be specified:
codec g711ulaw
For reference, following is an exported CISCO configuration, that works:
! version 12.1 no service single-slot-reload-enable service timestamps debug uptime service timestamps log uptime no service password-encryption ! hostname Router ! logging rate-limit console 10 except errors enable secret 5 $1$bTMC$nDGl9/n/pc3OMbtWxADMg1 enable password 123 ! memory-size iomem 25 ip subnet-zero no ip finger ! call rsvp-sync voice rtp send-recv ! voice class codec 1 codec preference 1 g711ulaw codec preference 2 g723r63 ! interface FastEthernet0 ip address 10.0.0.101 255.255.255.0 no ip mroute-cache speed auto half-duplex ! ip classless ip route 0.0.0.0 0.0.0.0 10.0.0.1 no ip http server ! dialer-list 1 protocol ip permit dialer-list 1 protocol ipx permit ! voice-port 0/0 ! voice-port 0/1 ! voice-port 2/0 ! voice-port 2/1 ! dial-peer voice 1 pots destination-pattern 101 port 0/0 ! dial-peer voice 97 voip destination-pattern 097 session target ipv4:10.0.0.97 codec g711ulaw ! dial-peer voice 98 voip destination-pattern 098 voice-class codec 1 session target ipv4:10.0.0.98 ! ! line con 0 transport input none line aux 0 line vty 0 4 password 123 login ! end