IP Telephony

Document revision:2.2 (Mon Apr 26 12:53:19 GMT 2004)
Applies to: V2.8

General Information

Summary

The MikroTik RouterOS IP Telephony feature enables Voice over IP (VoIP) communications using routers equipped with the following voice port hardware:

Specifications

Packages required: telephony
License required: Level1
Submenu level: /ip telephony
Standards and Technologies: RTP
Hardware usage: Pentium MMX level processor recommended

Related Documents

Description

IP telephony, known as Voice over IP (VoIP), is the transmission of telephone calls over a data network like one of the many networks that make up the Internet. There are four ways that you might talk to someone using VoIP:

Suppoted hardware:

Supported standards:

In PSTN lines there is a known delay of the signal caused by switching and signal compressing devices of the telephone network (so, it depends on the distance between the peers), which is generally rather low. The delay is also present in IP networks. The main difference between a PSTN and an IP network is that in IP networks that delay is more random. The actual packet delay may vary in order of magnutude in congested networks (if a network becomes congested, some packets may even be lost). Also packet reordering may take place. To prevent signal loss, caused by random jitter of IP networks and packet reordering, to corrupt audio signal, a jitter buffer is present in IP telephony devices. The jitter buffer is delaying the actual playback of a received packet forming The larger the jitter buffer, the larger the total delay, but fewer packets get lost due to timeout.

The total delay from the moment of recording the voice signal till its playback is the sum of following three delay times:

Notes

Each installed Quicknet card requires IO memory range in the following sequence: the first card occupies addresses 0x300-0x31f, the second card 0x320-0x33f, the third 0x340-0x35f, and so on. Make sure there is no conflict in these ranges with other devices, e.g., network interface cards, etc.

Use the telephony logging feature to debug your setup.

Additional Resources

IP Telephony Online

General Voice port settings

Submenu level: /ip telephony voice-port

Description

This submenu is used for managing all IP telephony voice ports (linejack, phonejack, isdn, voip, voicetronix, zaptel)

Property Description

name (name) - assigned name of the voice port

type (read-only: phonejack | linejack | phonejack-lite | phonejack-pci | voip | isdn | voicetronix | zaptel) - type of the installed telephony voice port:
phonejack - Quicknet PhoneJACK (ISA)
linejack - Quicknet LineJACK (ISA)
phonejack-lite - Quicknet PhoneJACK Lite Linux Edition (ISA)
phonejack-pci - Quicknet PhoneJACK (PCI)
voip - generic Voice over IP port
isdn - ISDN cards
voicetronix - Voicetronix OpenLine4
zaptel - Zaptel Wildcard X100P

autodial (integer; default: "") - number to be dialed automatically, if call is coming in from this voice port

Notes

If autodial does not exactly match an item in /ip telephony numbers, there can be two possibilities:

Voicetronix Voice Ports

Submenu level: /ip telephony voice-port voicetronix

Property Description

name (name) - name given by the user or the default one

autodial (integer; default: "") - 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, the line is hung up. If the number is correct, then the appropriate number is dialed (the direct-call mode is used - the line is picked up only after the remote party answers the call)

playback-volume (integer: -48..48; default: 0) - playback volume in dB
0 - 0dB meand no change to signal level

record-volume (integer: -48..48; default: 0) - record volume in dB
0 - 0dB meand no change to signal level

region (name; default: us) - regional setting for the voice port. This setting is used for setting the parameters of PSTN line, as well as for detecting and generating the tones

agc-on-playback (yes | no; default: no) - automatic gain control on playback (can not be used together with hardware voice codecs)

agc-on-record (yes | no; default: no) - automatic gain control on record (can not be used together with hardware voice codecs)

detect-cpt (yes | no; default: no) - automatically detect call progress tones

balance-registers (integer: 0..255; default: 199) - registers which depend on telephone line impedance. Can be adjusted to get best echo cancellation. Should be changed only if echo cancellation on voicetronix card does not work good enough. Echo cancellation problems can imply DTMF and busy-tone detection failures. The value has to be in format bal1[,bal3[,bal2]], where bal1, bal2, bal3 - balance registers. bal1 has to be in interval 192..248 (0xC0..0xF8). The others should be in interval 0..255 (0x00..0xFF)

balance-status (read-only: integer; default: unknown) - shows quality of hardware echo cancellation in dB

loop-drop-detection (yes | no; default: yes) - automatically clear call when loop drop is detected

Command Description

test-balance - current balance-registers value is tested once. Result is placed in balance-status parameter. Balance can be tested only when line is off-hook. It won't work if line is on-hook or there is an established connection
Input Parameters
unnamed (name) - port name to test balance of

find-best-balance - series of test-balance is executed with different balance-registers values. During the tests balance-registers are updated to the best values found
Input Parameters
unnamed (name) - port name to find best balance of

clear-call - terminate a current call established with the specified voice port
Input Parameters
unnamed (name) - port name to clear call with

show-stats - show voice port statistics
Input Parameters
unnamed (name) - port name show statistics of

Return Values
round-trip-delay (time) - maximal time of packet round trip
packets-sent (integer) - number of packets sent by this card (these packets are digitalized input of the voice port)
bytes-sent (integer) - number of bytes sent by this card (these packets are digitalized input of the voice port)
sent-time (text) - minimal/average/maximal intervals between packets sent
packets-received (integer) - number of packets received by this card (these packets form analog output of the voice port)
bytes-received (integer) - number of bytes received by this card (these packets form analog output of the voice port)
received-time (text) - minimal/average/maximal intervals between packets received
average-jitter-delay (time) - approximate delay time from the moment of receiving an audio packet from the IP network till it is played back over the telephony voice port. 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 actual delay time.

monitor - monitor status of the voice port
Input Parameters
unnamed (name) - port name to monitor

Return Values
status (on-hook | off-hook | ring | connection | busy) - 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 direction property
  • connection - the connection has been established
  • busy - the connection has been terminated, the handset is still off-hook

  • directiopn (ip-to-port | port-to-ip) - 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

  • phone-number (integer) - the phone number being dialed
    remote-party-name (text) - name and IP address of the remote party
    codec (name) - CODEC used for the audio connection
    duration (time) - duration of the phone call

    Notes

    As some Voicetronix cards fail to detect loop drop correctly, with loop-drop-detection you can manage whether loop drop detection feature is enabled. The effect of not working loop-drop detection is call terminated at once when connection is established.

    Some tips for testing balance registers:

    LineJack Voice Ports

    Submenu level: /ip telephony voice-port linejack

    Property Description

    name (name) - name given by the user or the default one

    autodial (integer; default: "") - 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, the line is hung up (FXO "line" port) or busy tone is played (FXS "phone" port). If the number is correct, then the appropriate number is dialed. If it is an incomming call from the PSTN line, then the direct-call mode is used - the line is picked up only after the remote party answers the call

    playback-volume (integer: -48..48; default: 0) - playback volume in dB
    0 - 0dB meand no change to signal level

    record-volume (integer: -48..48; default: 0) - record volume in dB
    0 - 0dB meand no change to signal level

    ring-cadence (text) - a 16-symbol ring cadence for the phone, each symbol lasts 0.5 seconds, + means ringing, - means no ringing

    region (name; default: us) - regional setting for the voice port. This setting is used for setting the parameters of PSTN line, as well as for detecting and generating the tones

    aec (yes | no) - whether echo detection and cancellation is enabled

    aec-tail-length (short | medium | long; default: short) - size of the buffer of echo detection

    aec-nlp-threshold (off | low | medium | high; default: low) - level of cancellation of silent sounds

    aec-attenuation-scaling (integer: 0..10; default: 4) - factor of additional echo attenuation

    aec-attenuation-boost (integer: 0..90; default: 0) - level of additional echo attenuation

    software-aec (yes | no) - software echo canceller (experimental, for most of the cards)

    agc-on-playback (yes | no; default: no) - automatic gain control on playback (can not be used together with hardware voice codecs)

    agc-on-record (yes | no; default: no) - automatic gain control on record (can not be used together with hardware voice codecs)

    detect-cpt (yes | no; default: no) - automatically detect call progress tones

    Command Description

    blink - blink the LEDs of the specified voice port for five seconds after it is invoked. This command can be used to locate the respective card from several linejack cards
    Input Parameters
    unnamed (name) - card name to blink the LED of

    clear-call - terminate a current call established with the specified voice port
    Input Parameters
    unnamed (name) - port name to clear call with

    show-stats - show voice port statistics
    Input Parameters
    unnamed (name) - port name show statistics of

    Return Values
    round-trip-delay (time) - maximal time of packet round trip
    packets-sent (integer) - number of packets sent by this card (these packets are digitalized input of the voice port)
    bytes-sent (integer) - number of bytes sent by this card (these packets are digitalized input of the voice port)
    sent-time (text) - minimal/average/maximal intervals between packets sent
    packets-received (integer) - number of packets received by this card (these packets form analog output of the voice port)
    bytes-sent (integer) - number of bytes received by this card (these packets form analog output of the voice port)
    sent-time (text) - minimal/average/maximal intervals between packets received
    average-jitter-delay (time) - approximate delay time from the moment of receiving an audio packet from the IP network till it is played back over the telephony voice port. 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 actual delay time.

    monitor - monitor status of the voice port
    Input Parameters
    unnamed (name) - port name to monitor

    Return Values
    status (on-hook | off-hook | ring | connection | busy) - 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 direction property
  • connection - the connection has been established
  • busy - the connection has been terminated, the handset is still off-hook

  • port (phone | line) - the active port of the card
  • phone - telephone connected to the card (POTS FXS port)
  • line - line connected to the card (PSTN FXO port)

  • directiopn (ip-to-port | port-to-ip) - 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 (plugged | unplugged) - state of the PSTN line
  • plugged - the telephone line is connected to the PSTN port of the card
  • unplugged - there is no working line connected to the PSTN port of the card

  • phone-number (integer) - the phone number being dialed
    remote-party-name (text) - name and IP address of the remote party
    codec (name) - CODEC used for the audio connection
    duration (time) - duration of the phone call

    Notes

    When telephone line is connected to the 'line' port, green LED next to the port should be lit in some seconds. If telephone line disappear, the LED next to the 'line' port will change its state to red in an hour or when the line is activated (i.e. when somebody calls to/from it). When telephone line is plugged in the 'phone' port before the router is turned on, red LED next to the port will be lit. WARNING: do not plug telephone line into the 'phone' port when the router is running and green LED next to the port is lit - this might damage the card. The status of the 'phone' port is only detected on system startup.

    PhoneJack Voice Ports

    Submenu level: /ip telephony voice-port phonejack

    Property Description

    name (name) - name given by the user or the default one

    type (read-only: phonejack | phonejack-lite | phonejack-pci) - type of the card

    autodial (integer; default: "") - 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

    playback-volume (integer: -48..48; default: 0) - playback volume in dB
    0 - 0dB meand no change to signal level

    record-volume (integer: -48..48; default: 0) - record volume in dB
    0 - 0dB meand no change to signal level

    ring-cadence (text) - a 16-symbol ring cadence for the phone, each symbol lasts 0.5 seconds, + means ringing, - means no ringing

    region (name; default: us) - regional setting for the voice port. This setting is used for generating the dial tones

    aec (yes | no) - wheteher echo detection and cancellation is enabled

    aec-tail-length (short | medium | long; default: short) - size of the buffer of echo detection

    aec-nlp-threshold (off | low | medium | high; default: low) - level of cancellation of silent sounds

    aec-attenuation-scaling (integer: 0..10; default: 4) - factor of additional echo attenuation

    aec-attenuation-boost (integer: 0..90; default: 0) - level of additional echo attenuation

    software-aec (yes | no) - software echo canceller (experimental, for most of the cards)

    agc-on-playback (yes | no; default: no) - automatic gain control on playback (can not be used together with hardware voice codecs)

    agc-on-record (yes | no; default: no) - automatic gain control on record (can not be used together with hardware voice codecs)

    detect-cpt (yes | no; default: no) - automatically detect call progress tones

    Command Description

    clear-call - terminate a current call established with the specified voice port
    Input Parameters
    unnamed (name) - port name to clear call with

    show-stats - show voice port statistics
    Input Parameters
    unnamed (name) - port name show statistics of

    Return Values
    round-trip-delay (time) - maximal time of packet round trip
    packets-sent (integer) - number of packets sent by this card (these packets are digitalized input of the voice port)
    bytes-sent (integer) - number of bytes sent by this card (these packets are digitalized input of the voice port)
    sent-time (text) - minimal/average/maximal intervals between packets sent
    packets-received (integer) - number of packets received by this card (these packets form analog output of the voice port)
    bytes-sent (integer) - number of bytes received by this card (these packets form analog output of the voice port)
    sent-time (text) - minimal/average/maximal intervals between packets received
    average-jitter-delay (time) - approximate delay time from the moment of receiving an audio packet from the IP network till it is played back over the telephony voice port. 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 actual delay time.

    monitor - monitor status of the voice port
    Input Parameters
    unnamed (name) - port name to monitor

    Return Values
    status (on-hook | off-hook | ring | connection | busy) - 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 direction property
  • connection - the connection has been established
  • busy - the connection has been terminated, the handset is still off-hook

  • port (phone | line) - the active port of the card
  • phone - telephone connected to the card (POTS FXS port)
  • line - line connected to the card (PSTN FXO port)

  • directiopn (ip-to-port | port-to-ip) - 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 (plugged | unplugged) - state of the PSTN line
  • plugged - the telephone line is connected to the PSTN port of the card
  • unplugged - there is no working line connected to the PSTN port of the card

  • phone-number (integer) - the phone number being dialed
    remote-party-name (text) - name and IP address of the remote party
    codec (name) - CODEC used for the audio connection
    duration (time) - duration of the phone call

    Zaptel Voice Ports

    Submenu level: /ip telephony voice-port zaptel

    Property Description

    name (name) - name given by the user or the default one

    autodial (integer; default: "") - 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, the line is hung up. If the number is correct, then the appropriate number is dialed (the direct-call mode is used - the line is picked up only after the remote party answers the call)

    playback-volume (integer: -48..48; default: 0) - playback volume in dB
    0 - 0dB meand no change to signal level

    record-volume (integer: -48..48; default: 0) - record volume in dB
    0 - 0dB meand no change to signal level

    region (name; default: us) - regional setting for the voice port. This setting is used for setting the parameters of PSTN line, as well as for detecting and generating the tones

    aec (yes | no) - wheteher echo detection and cancellation is enabled

    aec-tail-length (short | medium | long; default: short) - size of the buffer of echo detection

    aec-nlp-threshold (off | low | medium | high; default: low) - level of cancellation of silent sounds

    aec-attenuation-scaling (integer: 0..10; default: 4) - factor of additional echo attenuation

    aec-attenuation-boost (integer: 0..90; default: 0) - level of additional echo attenuation

    software-aec (yes | no) - software echo canceller (experimental, for most of the cards)

    agc-on-playback (yes | no; default: no) - automatic gain control on playback (can not be used together with hardware voice codecs)

    agc-on-record (yes | no; default: no) - automatic gain control on record (can not be used together with hardware voice codecs)

    detect-cpt (yes | no; default: no) - automatically detect call progress tones

    Command Description

    clear-call - terminate a current call established with the specified voice port
    Input Parameters
    unnamed (name) - port name to clear call with

    show-stats - show voice port statistics
    Input Parameters
    unnamed (name) - port name show statistics of

    Return Values
    round-trip-delay (time) - maximal time of packet round trip
    packets-sent (integer) - number of packets sent by this card (these packets are digitalized input of the voice port)
    bytes-sent (integer) - number of bytes sent by this card (these packets are digitalized input of the voice port)
    sent-time (text) - minimal/average/maximal intervals between packets sent
    packets-received (integer) - number of packets received by this card (these packets form analog output of the voice port)
    bytes-sent (integer) - number of bytes received by this card (these packets form analog output of the voice port)
    sent-time (text) - minimal/average/maximal intervals between packets received
    average-jitter-delay (time) - approximate delay time from the moment of receiving an audio packet from the IP network till it is played back over the telephony voice port. 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 actual delay time.

    monitor - monitor status of the voice port
    Input Parameters
    unnamed (name) - port name to monitor

    Return Values
    status (on-hook | off-hook | ring | connection | busy) - 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 direction property
  • connection - the connection has been established
  • busy - the connection has been terminated, the handset is still off-hook

  • directiopn (ip-to-port | port-to-ip) - 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 (plugged | unplugged) - state of the PSTN line
  • plugged - the telephone line is connected to the PSTN port of the card
  • unplugged - there is no working line connected to the PSTN port of the card

  • phone-number (integer) - the phone number being dialed
    remote-party-name (text) - name and IP address of the remote party
    codec (name) - CODEC used for the audio connection
    duration (time) - duration of the phone call

    ISDN Voice Ports

    Submenu level: /ip telephony voice-port isdn

    Property Description

    name (name) - name given by the user or the default one

    msn (integer) - telephone number of the ISDN voice port (ISDN MSN number)

    lmsn (text) - msn pattern to listen on. It determines which calls from the ISDN line this voice port should answer. If left empty, msn is used

    autodial (integer; default: "") - phone number which will be dialed immediately on each incoming ISDN call. If this number contains 'm', then it will be replaced by originally called (ISDN) telephone number. If this number is incomplete, then the remaining part has to be dialed by the caller. If the number is incorrect, call is refused. If the number is correct, then the appropriate number is dialed. For that direct-call mode is used - the line is picked up only after the remote party answers the call

    playback-volume (integer: -48..48; default: 0) - playback volume in dB
    0 - 0dB meand no change to signal level

    record-volume (integer: -48..48; default: 0) - record volume in dB
    0 - 0dB meand no change to signal level

    region (name; default: us) - regional setting for the voice port. This setting is used for setting the parameters of PSTN line, as well as for detecting and generating the tones

    aec (yes | no) - wheteher echo detection and cancellation is enabled

    aec-tail-length (short | medium | long; default: short) - size of the buffer of echo detection

    software-aec (yes | no) - software echo canceller (experimental, for most of the cards)

    agc-on-playback (yes | no; default: no) - automatic gain control on playback (can not be used together with hardware voice codecs)

    agc-on-record (yes | no; default: no) - automatic gain control on record (can not be used together with hardware voice codecs)

    Command Description

    clear-call - terminate a current call established with the specified voice port
    Input Parameters
    unnamed (name) - port name to clear call with

    show-stats - show voice port statistics
    Input Parameters
    unnamed (name) - port name show statistics of

    Return Values
    round-trip-delay (time) - maximal time of packet round trip
    packets-sent (integer) - number of packets sent by this card (these packets are input of the voice port)
    bytes-sent (integer) - number of bytes sent by this card (these packets are input of the voice port)
    sent-time (text) - minimal/average/maximal intervals between packets sent
    packets-received (integer) - number of packets received by this card (these packets form output of the voice port)
    bytes-sent (integer) - number of bytes received by this card (these packets form output of the voice port)
    sent-time (text) - minimal/average/maximal intervals between packets received
    average-jitter-delay (time) - approximate delay time from the moment of receiving an audio packet from the IP network till it is played back over the telephony voice port. 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 actual delay time.

    monitor - monitor status of the voice port
    Input Parameters
    unnamed (name) - port name to monitor

    Return Values
    status (on-hook | off-hook | ring | connection | busy) - 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 direction property
  • connection - the connection has been established
  • busy - the connection has been terminated, the handset is still off-hook

  • directiopn (ip-to-port | port-to-ip) - 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

  • phone-number (integer) - the phone number being dialed
    remote-party-name (text) - name and IP address of the remote party
    codec (name) - CODEC used for the audio connection
    duration (time) - duration of the phone call

    Notes

    In contrary to analog voice ports phonejack, linejack, voicetronix, zaptel), which are as many as the number of cards installed, the isdn ports can be added as many as desired.

    There is a possibility to enter some special symbols in lmsn property. Meaning of the special symbols:

    Voice Port for Voice over IP (voip)

    Submenu level: /ip telephony voice-port voip

    Description

    The voip voice ports are virtual ports, which designate a voip channel to another host over the IP network. You must have at least one voip voice port to be able to make calls to other H.323 devices over IP network.

    Property Description

    name (name) - name given by the user or the default one

    remote-address (IP address; default: 0.0.0.0) - 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 is used. If there is no default record, then default values are used
    0.0.0.0 - the record with this IP address will specify the default values for an incomming call

    autodial (integer) - 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 (time: 0..1000ms; default: 100ms) - size of the jitter buffer
    0 - the size of it is adjusted automatically during the conversation, to keep amount of lost packets under 1%

    silence-detection (yes | no; default: no) - whether silence is detected and no audio data is sent over the IP network during the silence period

    prefered-codec (name; default: none) - the preferred codec to be used for this voip voice port. If possible, the specified codec will be used
    none - there is no preferred codec defined for this port, so whichever codec advised by the remote peer will be used (if it is supported)

    fast-start (yes | no; default: yes) - allow or disallow the fast start. The fast start allows establishing the audio connection in a shorter time. However, not all H.323 endpoints support this feature. Therefore, it should be turned off, if there are problems to establish telephony connection using the fast start mode

    Numbers

    Description

    This is the so-called "routing table" for voice calls. This table assigns numbers to the voice ports.The main function of the numbers routing table is to determine:

    Property Description

    dst-pattern (integer) - pattern of the telephone number. Symbol '.' designate any digit, symbol '_' (only as the last one) designate any symbols (i.e. any number of characters can follow, ended with '#' button)

    voice-port (name) - voice port to be used when calling the specified telephone number

    prefix (integer) - prefix, which will be used to substitute the known part of the dst-pattern, i.e., the part containing digits. The dst-pattern argument is used to determine which voice port to be used, whereas the prefix argument designates 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

    Notes

    More than one entry can be added with exactly the same dst-pattern. If first one of them is already busy, next one with the same dst-pattern is used. Telephony number entries can be moved, to select desired order.

    Example

    Let us consider the following example for the number table:

    [admin@MikroTik] ip telephony numbers> print
    Flags: I - invalid, X - disabled, D - dynamic, R - registered
      #     DST-PATTERN                    VOICE-PORT PREFIX
      0     12345                          XX
      1     1111.                          YY
      2     22...                          ZZ         333
      3     ...                            QQ         55
    
    [admin@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.

    Let us add a few more records:

    [admin@MikroTik] ip telephony numbers> print
    Flags: I - invalid, X - disabled, D - dynamic, R - registered
      #     DST-PATTERN                    VOICE-PORT PREFIX
      0     12345                          XX
      1     1111.                          YY
      2     22...                          ZZ         333
      3     ...                            QQ         55
      4     222                            KK         44444
      5     3..                            LL         553
    
    [admin@MikroTik] ip telephony numbers>
          

    Let us add a few more records:

    [admin@MikroTik] ip telephony numbers> print
    Flags: I - invalid, X - disabled, D - dynamic, R - registered
    Flags: I - invalid, X - disabled, D - dynamic, R - registered
      #     DST-PATTERN                    VOICE-PORT PREFIX
      0     12345                          XX
      1     1111.                          YY
      2     22...                          ZZ         333
      3     ...                            QQ         55
      4     222                            KK         44444
      5     3..                            LL         553
      6     33...                          MM         33
      7     11.                            NN         7711
    
    [admin@MikroTik] ip telephony numbers>
          

    It is impossible to add the following records:

      #     DST-PATTERN                    VOICE-PORT PREFIX
                                                                  reason:
            11                             DD               conflict with record # 1
                                                            and # 7
            11..                           DD               conflict with record # 7
            111                            DD               conflict with record # 1
            22.                            DD               conflict with record # 2
            .....                          DD               conflict with record # 3
          

    Regional Settings

    Submenu level: /ip telephony region

    Description

    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 (correct busy-tone-frequency and busy-tone-cadence). Without that, detect-cpt parameter the voice port has to be enabled.

    Property Description

    name (name) - name of the regional setting

    busy-tone-cadence (integer: 0..30000; default: 500,500) - busy tone cadence in ms
    0 - end of cadence

    busy-tone-frequency (integer: 20..2000integer: -24..6; default: 440x0) - frequency and volume gain of busy tone, Hz x dB

    data-access-arrangement (australia | france | germany | japan | uk | us; default: us) - ring voltage, impedance setting for line-jack card

    dial-tone-frequency (integer: 20..2000integer: -24..6; default: 440x0) - frequency and volume gain of dial tone, Hz x dB

    dtmf-tone-cadence (integer: 0..30000; default: 180,60) - Dual Tone Multi Frequency tone cadence in ms
    0 - end of cadence

    dtmf-tone-volume (integer: -24..6; default: -3,-3) - Dual Tone Multi Frequency tone volume in dB

    ring-tone-cadence (integer: 0..30000; default: 1000,2000) - Ring tone cadence in ms
    0 - end of cadence

    ring-tone-frequency (integer: 20..2000integer: -24..6; default: 440x0) - frequency and volume gain of busy tone, Hz x dB

    Notes

    To generate a tone, frequency and cadence arguments are used. The dialtone always is continuous signal, therefore it does not have the cadence argument. In order to detect dialtone, it should be at least 100ms long.

    There are 10 pre-defined regions, which can not be deleted (but may be changed)

    Audio CODECs

    Submenu level: /ip telephony codec

    Description

    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 some cards.

    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.3kb/s throughput for each direction of the call.

    Example

    [admin@MikroTik] ip telephony codec> print
    Flags: X - disabled
      #   NAME
      0   G.723.1-6.3k/sw
      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   GSM-06.10-13.2k/sw
      8   LPC-10-2.5k/sw
      9   G.723.1-6.3k/hw
     10   G.729-8k/sw
    [admin@MikroTik] ip telephony codec>
          

    AAA

    Submenu level: /ip telephony aaa

    Description

    AAA (Authentication Authorization Accounting) can be used to configure the RADIUS accounting feature.

    The contents of the CDR (Call Detail Record) are as follows:

    Property Description

    use-radius-accounting (yes | no; default: no) - whether to use radius accounting or not

    interim-update (integer; default: 0) - defines time interval between communications with the router. If this time will exceed, RADIUS server will assume that this connection is down. This value is suggested not to be less than 3 minutes
    0 - no interim-update messages are sent at all

    Notes

    All the parameters, which names begin with h323, are CISCO vendor specific Radius attributes

    Gatekeeper

    Submenu level: /ip telephony gatekeeper

    Description

    For each H.323 endpoint gatekeeper stores its telephone numbers. So, gatekeeper knows all telephone numbers for all registered endpoints. And it knows which telephone number is handled by which endpoint. Mapping between endpoints and their telephone numbers is the main functionality of gatekeepers.

    If endpoint is registered to endpoint, it does not have to know every single endpoint and every single telephone number, which can be called. Instead, every time some number is dialed, endpoint asks gatekeeper for destination endpoint to call by providing called telephone number to it.

    MikroTik IP telephony package includes a very simple gatekeeper. This gatekeeper can be activated by setting gatekeeper parameter to local. In this case the local endpoint automatically is registered to the local gatekeeper. And any other endpoint can register to this gatekeeper too.

    Registered endpoints are added to the /ip telephony voice-port voip table. Those entries are marked as dynamic and can not be removed or changed. If there already was an voip entry with the same IP address, it is marked as registred. Remote-address can not be changed for these entries too, but registered voip voice ports can be removed - they will stay as dynamic ones. If there already is a dynamic voip voice port and a static one with the same IP address is added, then instead of dynamic entry, registered will appear.

    Dynamic entries disappear when corresponding endpoint unregisters itself from the gatekeeper. Registered entries are static and will stay even after that endpoint will be unregistered from this gatekeeper.

    Registered telephone numbers are added to /ip telephony numbers table. Here is exactly the same idea behind dynamic and registered telephone numbers as it is with voip voice ports.

    When an endpoint registers to the gatekeeper, it sends its own telephone numbers (aliases and prefixes) within this registration request. /ip telephony numbers entry is registered to the endpoint only if voice-port for that entry is local (not voip). If dst-pattern contains '.' or '_', it is sent as prefix, otherwise - as alias. The known part of the dst-pattern is sent as prefix. If there is no known part (dst-pattern is "_" or "...", for example), then this entry is not sent at all.

    Property Description

    gatekeeper (none | local | remote; default: none) - Gatekeeper type to use
    none - don't use any gatekeeper at all
    local - start and use local gatekeeper
    remote - use some other gatekeeper

    remote-address (IP address; default: 0.0.0.0) - IP address of remote gatekeeper to use. If set to 0.0.0.0, broadcast gatekeeper discovery is used

    remote-id (name) - name of remote gatekeeper to use. If left empty, first available gatekeeper will be used. Name of locally started gatekeeper is the same as system identity

    registered (read-only: yes | no) - shows whether local H.323 endpoint is registered to any gatekeeper

    registered-with (read-only: name) - name of gatekeeper to which local H.323 endpoint is registered

    Example

    In most simple case with one phonejack card and some remote gatekeeper, configuration can be as follows:

    [admin@MikroTik] ip telephony voice-port> print
    Flags: X - disabled
      #   NAME                          TYPE            AUTODIAL
      0   phonejack1                phonejack
      1   voip1                         voip
    
    [admin@MikroTik] ip telephony voice-port voip> print
    Flags: X - disabled, D - dynamic, R - registered
      #    NAME      AUTODIAL REMOTE-ADDRESS  JITTER-BUFFER PREFERED-CODEC  SIL FAS
      0    voip1              0.0.0.0         0s            none            no  yes
    
    [admin@MikroTik] ip telephony numbers> print
    Flags: I - invalid, X - disabled, D - dynamic, R - registered
      #     DST-PATTERN             VOICE-PORT              PREFIX
      0     11                      phonejack1
      1     _                       voip1
    
    [admin@MikroTik] ip telephony gatekeeper> print
             gatekeeper: remote
              remote-id: ""
         remote-address: 10.0.0.98
             registered: yes
        registered-with: "MikroTik@10.0.0.98"
          

    In this case this endpoint will register to gatkeeper with the IP address of 10.0.0.98 and telephone number 11. Every call to telephone number 11 will be transfered from gatekeeper to this endpoint. And this endpoint will route this call to phonejack1 voice port. On any other telephone number gatekeeper will be asked for real destination. From this endpoint it will be possible to call all the endpoints, which are registered to the same gatekeeper. If that gatekeeper has static entries about endpoints, which are not registered to gatekeeper, it still will be possible to call those endpoints by those statically defined telephone numbers at gatekeeper.

    Example

    For example, if numbers table is like this:

    [admin@MikroTik] ip telephony numbers> print
    Flags: I - invalid, X - disabled, D - dynamic, R - registered
      #     DST-PATTERN             VOICE-PORT              PREFIX
      0     1.                      phonejack1
      1     128                     voip1                   128
      2     78                      voip2                   78
      3     77                      phonejack1
      4     76                      phonejack1              55
      5     _                       voip1
          

    then entries 0, 3 and 4 will be sent to the gatekeeper, others are voip voice ports and are ignored. Entry 0 will be sent as prefix 1, entry 3 - as alias 77, and entry 4 - as alias 76.

    If IP address of local endpoint is 10.0.0.100, then gatekeeper voip and numbers tables will look as follows:

          [admin@MikroTik] ip telephony voice-port voip> print
    Flags: X - disabled, D - dynamic, R - registered
      #    NAME      AUTODIAL REMOTE-ADDRESS  JITTER-BUFFER PREFERED-CODEC  SIL FAS
      0    tst-2.5            10.0.0.101      0s            none            no  yes
      1  D local              127.0.0.1       100ms         none            no  yes
      2  D 10.0.0...          10.0.0.100      100ms         none            no  yes
    
    [admin@MikroTik] ip telephony numbers> print
    Flags: I - invalid, X - disabled, D - dynamic, R - registered
      #     DST-PATTERN             VOICE-PORT              PREFIX
      0     78                      linejack1
      1     3...                    vctx1
      2     33_                     voip1
      3     5..                     voip1
      4  XD 78                      local                   78
      5  XD 3_                      local                   3
      6   D 76                      10.0.0.100              76
      7   D 77                      10.0.0.100              77
      8   D 1_                      10.0.0.100              1
          

    Here we can see how aliases and prefixes are added to numbers table. Entries 0..3 are static. Entries 4 and 5 are added by registering the local endpoint to the local gatekeeper. Entries 6..8 are added by registering endpoint (with IP address 10.0.0.100) to the local gatekeeper.

    For prefixes, '_' is added at the end of dst-pattern to allow any additional digits to be added at the end.

    Local endpoint is registered to the local gatekeeper too. So, local aliases and prefixes are added as dynamic numbers too. Only, as they are local and corresponding number entries already exist in the number table, then these dynamically added entries are disabled by default.

    If any registered telephone number will conflict with some existing telephone numbers entry, it will be added as disabled and dynamic.

    If in gatekeeper's numbers table there already exists exactly the same dst-pattern as some other endpoint is trying to register, this gatekeeper registration for that endpoint will fail.

    Troubleshooting

    Description

    A simple example

    Description

    The following describes examples of some useful IP telephony applications using MikroTik RouterOS.

    Let us consider the following example of IP telephony gateway, one MikroTik IP telephone, and one Welltech LAN Phone 101 setup:

    Setting up the MikroTik IP Telephone

    If you pick up the handset, a dialtone should be heard.

    The basic telephony configuration should be as follows:

    Making calls from the IP telephone 10.0.0.224:

    Setting up the IP Telephony Gateway

    The IP telephony gateway [voip_gw] requires the following configuration:

    Making calls through the IP telephony gateway:

    Setting up the Welltech IP Telephone

    Please follow the documentation from www.welltech.com.tw on how to set up the Welltech LAN Phone 101. Here we give just brief recommendations:

    1. We recommend to upgrade the Welltech LAN Phone 101 with the latest application software. Telnet to the phone and check what you have, for example:

      usr/config$ rom -print
      
      Download Method  :  TFTP
       Server Address  :  10.5.8.1
      
         Hardware Ver. :  4.0
             Boot Rom  :  nblp-boot.102a
      Application Rom  :  wtlp.108h
              DSP App  :  48302ce3.127
           DSP Kernel  :  48302ck.127
        DSP Test Code  :  483cbit.bin
        Ringback Tone  :  wg-ringbacktone.100
            Hold Tone  :  wg-holdtone10s.100
        Ringing Tone1  :  ringlow.bin
        Ringing Tone2  :  ringmid.bin
        Ringing Tone3  :  ringhi.bin
      
      usr/config$
                
    2. Check if you have the codecs arranged in the desired order:

      usr/config$ voice -print
      Voice codec setting relate information
          Sending packet size  :
                  G.723.1      : 30 ms
                  G.711A       : 20 ms
                  G.711U       : 20 ms
                  G.729A       : 20 ms
                  G.729        : 20 ms
          Priority order codec :
                  g7231 g711a g711u g729a g729
          Volume levels        :
                  voice volume : 54
                  input gain   : 26
                   dtmf volume : 23
      Silence suppression & CNG:
                  G.723.1      : Off
          Echo canceller       : On
       JitterBuffer Min Delay  : 90
       JitterBuffer Max Delay  : 150
      usr/config$
                
    3. Make sure you have set the H.323 operation mode to phone to phone (P2P), not gatekeeper (GK):

      usr/config$ h323 -print
      H.323 stack relate information
          RAS mode               : Non-GK mode
          Registered e164        : 31
          Registered H323 ID     : Rob
          RTP port               : 16384
          H.245 port             : 16640
          Allocated port range   :
                    start port   : 1024
                    end port     : 65535
          Response timeOut       : 5
          Connect  timeOut       : 5000
      usr/config$
                
    4. Add the gateway's address to the phonebook:

      usr/config$ pbook -add name gw ip 10.1.1.12
      usr/config$
      This may take a few seconds, please wait....
      
      Commit to flash memory ok!
      
      usr/config$ pbook -print
      index   Name                 IP                    E164
      ======================================================================
      1       gw                   10.1.1.12
      ----------------------------------------------------------------------
      usr/config$
                

    Making calls from the IP telephone 10.5.8.2:

    Use the telephony logging feature on the gateway to debug your setup.

    Setting up MikroTik Router and CISCO Router

    Let's try a different example.

    Here are some hints on how to get working configuration for telephony calls between CISCO and MikroTik router.

    Configuration on the MikroTik side

    Configuration on the CISCO side:

    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
          

    Setting up PBX to PBX Connection over an IP Network

    To interconnect two telephone switchboards (PBX) over an IP network, two IP telephony gateways should be configured. The setup is shown in the following diagram:

    We want to be able to use make calls from local telephones of one PBX to local telephones or external lines of the other PBX.

    Assume that:

    The IP telephony configuration should be as follows:

    The system works as follows:

    To dial from the main office PBX#1 any extension of the remote office PBX#2, the extension with the connected gateway at PBX#1 should be dialed first. Then, after the dial tone of the gateway#1 is received, the remote extension number should be dialed.

    To dial from the main office PBX#2 any extension of the remote office PBX#1, the actions are the same as in first situation.