<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Solo Cyber City</title>
	<atom:link href="http://telogodog.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://telogodog.wordpress.com</link>
	<description>Catatan Telogodog Belajar MikroTik</description>
	<lastBuildDate>Sun, 29 Mar 2009 06:42:18 +0000</lastBuildDate>
	<language>id</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='telogodog.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/1f013be41e5eee15c67d4361da8e3ca8?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Solo Cyber City</title>
		<link>http://telogodog.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://telogodog.wordpress.com/osd.xml" title="Solo Cyber City" />
	<atom:link rel='hub' href='http://telogodog.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Virtual Router Redundancy Protocol (VRRP)</title>
		<link>http://telogodog.wordpress.com/2009/03/29/virtual-router-redundancy-protocol-vrrp/</link>
		<comments>http://telogodog.wordpress.com/2009/03/29/virtual-router-redundancy-protocol-vrrp/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 04:20:32 +0000</pubDate>
		<dc:creator>telogodog</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Virtual Router Redundancy Protocol (VRRP)]]></category>

		<guid isPermaLink="false">http://telogodog.wordpress.com/?p=533</guid>
		<description><![CDATA[Bahasa Indonesia Virtual Router Redundancy Protocol (VRRP) implementation in the MikroTik RouterOS is RFC2338 compliant. VRRP protocol is used to ensure constant access to some resources. Two or more routers (referred as VRRP Routers in this context) create a highly available cluster (also referred as Virtual routers) with dynamic fail over. Each router can participate [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=telogodog.wordpress.com&amp;blog=6674117&amp;post=533&amp;subd=telogodog&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span id="more-533"></span></p>
<p><a title="Indonesian" href="http://translate.google.com/translate?hl=id&amp;langpair=en%7Cid&amp;u=http://telogodog.wordpress.com/2009/03/29/virtual-router-redundancy-protocol-vrrp/"><strong>Bahasa Indonesia</strong></a></p>
<p>Virtual Router Redundancy Protocol (VRRP) implementation in the MikroTik RouterOS is RFC2338 compliant. VRRP protocol is used to ensure constant access to some resources. Two or more routers (referred as VRRP Routers in this context) create a highly available cluster (also referred as Virtual routers) with dynamic fail over. Each router can participate in not more than 255 virtual routers per interface. Many modern routers support this protocol.</p>
<p>Network setups with VRRP clusters provide high availability for routers without using clumsy ping-based scripts.</p>
<p><a name=".52.1.2"></a></p>
<h3>Specifications</h3>
<p>Packages required: <strong><em>system</em></strong><br />
License required: <em>Level1</em><br />
Submenu level: <strong><em>/ip vrrp</em></strong><br />
Standards and Technologies: <a href="http://www.faqs.org/rfcs/rfc2338.html" target="new">VRRP</a>,        <a href="http://www.faqs.org/rfcs/rfc2402.html" target="new">AH</a>,        <a href="http://www.faqs.org/rfcs/rfc2403.html" target="new">HMAC-MD5-96 within ESP and AH</a><br />
Hardware usage: <em>Not significant</em><br />
<a name=".52.1.3"></a></p>
<h3>Related Documents</h3>
<div class="itemizedlist">
<ul>
<li> <a href="http://www.mikrotik.com/testdocs/ros/2.9/guide/packages.php" target="_top">Software Package Management</a></li>
<li> <a href="http://www.mikrotik.com/testdocs/ros/2.9/ip/address.php" target="_top">IP Addresses and ARP</a></li>
</ul>
</div>
<p><a name=".52.1.4"></a></p>
<h3>Description</h3>
<p>Virtual Router Redundancy Protocol is an election protocol that provides high availability for routers. A number of routers may participate in one or more virtual routers. One or more IP addresses may be assigned to a virtual router. A node of a virtual router can be in one of the following states:</p>
<div class="itemizedlist">
<ul>
<li> <strong>MASTER</strong> state, when the node answers all the requests to the instance&#8217;s IP addresses. There may only be one MASTER node in a virtual router. This node sends VRRP advertisement packets to all the backup routers (using multicast address) every once in a while (set in <strong>interval</strong> property).</li>
<li> <strong>BACKUP</strong> state, when the VRRP router monitors the availability and state of the Master Router. It does not answer any requests to the instance&#8217;s IP addresses. Should master become unavailable (if at least three sequential VRRP packets are lost), election process happens, and new master is proclaimed based on its priority. For more details on virtual routers, see RFC2338.</li>
</ul>
</div>
<p><a name=".52.1.5"></a></p>
<h3>Notes</h3>
<p><a name=".52.1.5.1"></a></p>
<p>VRRP does not currently work on VLAN interfaces, as it is impossible to have the MAC address of a VLAN interface different from the MAC address of the physical interface it is put on.</p>
<p><a name=".52.2"></a></p>
<h2>VRRP Routers</h2>
<p><a name=".52.2.1"></a> Submenu level: <strong><em>/ip vrrp</em></strong><br />
<a name=".52.2.2"></a></p>
<h3>Description</h3>
<p>A number of VRRP routers may form a virtual router. The maximal number of clusters on one network is 255 each having a unique VRID (Virtual Router ID). Each router participating in a VRRP cluster must have it priority set to a valid value.</p>
<p><a name=".52.2.3"></a></p>
<h3>Property Description</h3>
<p><strong>authentication</strong> (none | simple | ah; default: <strong>none</strong>) &#8211; authentication method to use for VRRP advertisement packets</p>
<div class="params"><strong>none</strong> &#8211; no authentication<br />
<strong>simple</strong> &#8211; plain text authentication<br />
<strong>ah</strong> &#8211; Authentication Header using HMAC-MD5-96 algorithm</div>
<p><strong>interface</strong> (<em>name</em>) &#8211; interface name the instance is running on<strong>interval</strong> (<em>integer</em>: 1..255; default: <strong>1</strong>) &#8211; VRRP update interval in seconds. Defines how frequently the master of the given cluster sends VRRP advertisement packets<strong>name</strong> (<em>name</em>) &#8211; assigned name of the VRRP instance<strong>on-backup</strong> (<em>name</em>; default: <strong>&#8220;&#8221;</strong>) &#8211; script to execute when the node switch to backup state<strong>on-master</strong> (<em>name</em>; default: <strong>&#8220;&#8221;</strong>) &#8211; script to execute when the node switch to master state<strong>password</strong> (<em>text</em>; default: <strong>&#8220;&#8221;</strong>) &#8211; password required for authentication depending on method used can be ignored (if no authentication used), 8-character long text string (for plain-text authentication) or 16-character long text string (128-bit key required for AH authentication)<strong>preemption-mode</strong> (yes | no; default: <strong>yes</strong>) &#8211; whether preemption mode is enabled</p>
<div class="params"><strong>no</strong> &#8211; a backup node will not be elected to be a master until the current master fail even if the backup node has higher priority than the current master<br />
<strong>yes</strong> &#8211; the master node always has the priority</div>
<p><strong>priority</strong> (<em>integer</em>: 1..255; default: <strong>100</strong>) &#8211; priority of the current node (higher values mean higher priority)</p>
<div class="params"><strong>255</strong> &#8211; RFC requires that the router that owns the IP addresses assigned to this instance had the priority of 255</div>
<p><strong>vrid</strong> (<em>integer</em>: 0..255; default: <strong>1</strong>) &#8211; Virtual Router Identifier (must be unique on one interface)                                                                         <a name=".52.2.4"></a></p>
<h3>Notes</h3>
<p><a name=".52.2.4.1"></a></p>
<p>All the nodes of one cluster must have the same <strong>vrid</strong>, <strong>interval</strong>, <strong>preemption-mode</strong>, <strong>authentication</strong> and <strong>password</strong>.</p>
<p><a name=".52.2.4.2"></a></p>
<p>As said before, priority of 255 is reserved for the real owner of the virtual router&#8217;s IP addresses. Theoretically, the owner should have the IP address added statically to its IP address list and also to the VRRP virtual address list, but you should never do this! Any addresses that you are using as virtual addresses (i.e. they are added in <strong>/ip vrrp address</strong>) must not appear in <strong>/ip address</strong> list as they otherwise can cause IP address conflict, which will not be resolved automatically.</p>
<p><a name=".52.2.4.3"></a></p>
<p>Also You must have an IP address (no matter what) on the interface you want to run VRRP on.</p>
<p><a name=".52.2.5"></a></p>
<p>To add a VRRP instance on <strong>ether1</strong> interface, forming (because <strong>priority</strong> is <strong>255</strong>) a virtual router with <strong>vrid</strong> of <strong>1</strong>:</p>
<pre>[admin@MikroTik] ip vrrp&gt; add interface=ether1 vrid=1 priority=255
[admin@MikroTik] ip vrrp&gt; print
Flags: X - disabled, I - invalid, M - master, B - backup
  0  I  name="vr1" interface=ether1 vrid=1 priority=255 interval=1
        preemption-mode=yes authentication=none password="" on-backup=""
        on-master=""

[admin@MikroTik] ip vrrp&gt;</pre>
<p><a name=".52.3"></a></p>
<h2>Virtual IP addresses</h2>
<p><a name=".52.3.1"></a> Submenu level: <strong><em>/ip vrrp address</em></strong><br />
<a name=".52.3.2"></a></p>
<h3>Property Description</h3>
<p><strong>address</strong> (<em>IP address</em>) &#8211; IP address belongs to the virtual router<strong>broadcast</strong> (<em>IP address</em>) &#8211; broadcasting IP address<strong>interface</strong> (<em>name</em>; default: <strong>default</strong>) &#8211; interface, where to put the address on (may be different form the interface this  VRRP instance is running on)</p>
<div class="params"><strong>default</strong> &#8211; put this address on the interface the given VRRP instane is working on</div>
<p><strong>network</strong> (<em>IP address</em>) &#8211; IP address of the network<strong>virtual-router</strong> (<em>name</em>) &#8211; VRRP router&#8217;s name the address belongs to                                      <a name=".52.3.3"></a></p>
<h3>Notes</h3>
<p><a name=".52.3.3.1"></a></p>
<p>The virtual IP addresses should be the same for each node of a virtual router.</p>
<p><a name=".52.3.4"></a></p>
<p>To add a virtual address of <strong>192.168.1.1/24</strong> to the <strong>vr1</strong> VRRP router:</p>
<pre>[admin@MikroTik] ip vrrp&gt; address add address=192.168.1.1/24 \
\... virtual-router=vr1
[admin@MikroTik] ip vrrp&gt; address print
Flags: X - disabled, A - active
 #    ADDRESS            NETWORK         BROADCAST       INSTANCE INTERFACE
 0    192.168.1.1/24     192.168.1.0     192.168.1.255   vr1      default

[admin@MikroTik] ip vrrp&gt;</pre>
<p><a name=".52.4"></a></p>
<h2>A simple example of VRRP fail over</h2>
<p><a name=".52.4.1"></a></p>
<h3>Description</h3>
<p><img src="http://www.mikrotik.com/testdocs/ros/2.9/img/vrrp1.jpg" alt="" /></p>
<p>VRRP protocol may be used to make a redundant Internet connection with seamless fail-over. Let us assume that we have 192.168.1.0/24 network and we need to provide highly available Internet connection for it. This network should be NATted (to make fail-over with public IPs, use such dynamic routing protocols as BGP or OSPF together with VRRP). We have connections to two different Internet Service Providers (ISPs), and one of them is preferred (for example, it is cheaper or faster).</p>
<p>This example shows how to configure VRRP on the two routers shown on the diagram. The routers must have initial configuration: interfaces are enabled, each interface have appropriate IP address (note that each of the two interfaces should have an IP address), routing table is set correctly (it should have at least a default route). SRC-NAT or masquerading should also be configured before. See the respective manual chapters on how to make this configuration.</p>
<p>We will assume that the interface the 192.168.1.0/24 network is connected to is named <strong>local</strong> on both VRRP routers</p>
<p><a name=".52.4.2"></a></p>
<h3>Configuring Master VRRP router</h3>
<p>First of all we should create a VRRP instance on this router. We will use the priority of 255 for this router as it should be preferred router.</p>
<pre>[admin@MikroTik] ip vrrp&gt; add interface=local priority=255
[admin@MikroTik] ip vrrp&gt; print
Flags: X - disabled, I - invalid, M - master, B - backup
  0   M name="vr1" interface=local vrid=1 priority=255 interval=1
        preemption-mode=yes authentication=none password="" on-backup=""
        on-master=""

[admin@MikroTik] ip vrrp&gt;</pre>
<p>Next the virtual IP address should be added to this VRRP instance</p>
<pre>[admin@MikroTik] ip vrrp&gt; address add address=192.168.1.1/24 \
\... virtual-router=vr1
[admin@MikroTik] ip vrrp&gt; address print
Flags: X - disabled, A - active
 #    ADDRESS            NETWORK         BROADCAST       INSTANCE INTERFACE
 0    192.168.1.1/24     192.168.1.0     192.168.1.255   vr1      default

[admin@MikroTik] ip vrrp&gt;</pre>
<p>Now this address should appear in <strong>/ip address</strong> list:</p>
<pre>[admin@MikroTik] ip address&gt; print
Flags: X - disabled, I - invalid, D - dynamic
  #   ADDRESS            NETWORK         BROADCAST       INTERFACE
  0   10.0.0.1/24        10.0.0.0        10.0.0.255      public
  1   192.168.1.2/24     192.168.1.0     192.168.1.255   local
  2 D 192.168.1.1/24     192.168.1.0     192.168.1.255   local

[admin@MikroTik] ip address&gt;</pre>
<p><a name=".52.4.3"></a></p>
<h3>Configuring Backup VRRP router</h3>
<p>Now we will create VRRP instance with lower priority (we can use the default value of <strong>100</strong>), so this router will back up the preferred one:</p>
<pre>[admin@MikroTik] ip vrrp&gt; add interface=local
[admin@MikroTik] ip vrrp&gt; print
Flags: X - disabled, I - invalid, M - master, B - backup
  0   B name="vr1" interface=local vrid=1 priority=100 interval=1
        preemption-mode=yes authentication=none password="" on-backup=""
        on-master=""

[admin@MikroTik] ip vrrp&gt;</pre>
<p>Now we should add the same virtual address as was added to the master node:</p>
<pre>[admin@MikroTik] ip vrrp&gt; address add address=192.168.1.1/24 \
\... virtual-router=vr1
[admin@MikroTik] ip vrrp&gt; address print
Flags: X - disabled, A - active
 #    ADDRESS            NETWORK         BROADCAST       INSTANCE INTERFACE
 0    192.168.1.1/24     192.168.1.0     192.168.1.255   vr1      default

[admin@MikroTik] ip vrrp&gt;</pre>
<p>Note that this address will not appear in <strong>/ip address</strong> list:</p>
<pre>[admin@MikroTik] ip address&gt; print
Flags: X - disabled, I - invalid, D - dynamic
  #   ADDRESS            NETWORK         BROADCAST       INTERFACE
  0   10.1.0.1/24        10.0.0.0        10.0.0.255      public
  1   192.168.1.3/24     192.168.1.0     192.168.1.255   local

[admin@MikroTik] ip address&gt;</pre>
<p><a name=".52.4.4"></a></p>
<h3>Testing fail over</h3>
<p>Now, when we will disconnect the master router, the backup one will switch to the master state:</p>
<pre>[admin@MikroTik] ip vrrp&gt; print
Flags: X - disabled, I - invalid, M - master, B - backup
  0   M name="vr1" interface=local vrid=1 priority=100 interval=1
        preemption-mode=yes authentication=none password="" on-backup=""
        on-master=""

[admin@MikroTik] ip vrrp&gt; /ip address print
Flags: X - disabled, I - invalid, D - dynamic
  #   ADDRESS            NETWORK         BROADCAST       INTERFACE
  0   10.1.0.1/24        10.0.0.0        10.0.0.255      public
  1   192.168.1.3/24     192.168.1.0     192.168.1.255   local
  2 D 192.168.1.1/24     192.168.1.0     192.168.1.255   local

[admin@MikroTik] ip vrrp&gt;</pre>
<p>©</p>
<br />Posted in Uncategorized Tagged: Virtual Router Redundancy Protocol (VRRP) <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/telogodog.wordpress.com/533/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/telogodog.wordpress.com/533/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/telogodog.wordpress.com/533/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/telogodog.wordpress.com/533/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/telogodog.wordpress.com/533/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/telogodog.wordpress.com/533/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/telogodog.wordpress.com/533/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/telogodog.wordpress.com/533/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/telogodog.wordpress.com/533/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/telogodog.wordpress.com/533/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/telogodog.wordpress.com/533/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/telogodog.wordpress.com/533/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/telogodog.wordpress.com/533/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/telogodog.wordpress.com/533/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=telogodog.wordpress.com&amp;blog=6674117&amp;post=533&amp;subd=telogodog&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://telogodog.wordpress.com/2009/03/29/virtual-router-redundancy-protocol-vrrp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/497bf9708054bf3707509276e2eeac68?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">telogodog</media:title>
		</media:content>

		<media:content url="http://www.mikrotik.com/testdocs/ros/2.9/img/vrrp1.jpg" medium="image" />
	</item>
		<item>
		<title>UPS Monitor</title>
		<link>http://telogodog.wordpress.com/2009/03/29/ups-monitor/</link>
		<comments>http://telogodog.wordpress.com/2009/03/29/ups-monitor/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 04:17:24 +0000</pubDate>
		<dc:creator>telogodog</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[UPS Monitor]]></category>

		<guid isPermaLink="false">http://telogodog.wordpress.com/?p=530</guid>
		<description><![CDATA[Bahasa Indonesia The UPS monitor feature works with APC UPS units that support “smart” signaling over serial RS232 or USB connection. This feature enables the network administrator to monitor the UPS and set the router to ‘gracefully’ handle any power outage with no corruption or damage to the router. The basic purpose of this feature [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=telogodog.wordpress.com&amp;blog=6674117&amp;post=530&amp;subd=telogodog&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span id="more-530"></span></p>
<p><a title="Indonesian" href="http://translate.google.com/translate?hl=id&amp;langpair=en%7Cid&amp;u=http://telogodog.wordpress.com/2009/03/29/ups-monitor/"><strong>Bahasa Indonesia</strong></a></p>
<p>The UPS monitor feature works with APC UPS units that support “smart” signaling over serial RS232 or USB connection. This feature enables the network administrator to monitor the UPS and set the router to ‘gracefully’ handle any power outage with no corruption or damage to the router. The basic purpose of this feature is to ensure that the router will come back online after an extended power failure. To do this, the router will monitor the UPS and set itself to hibernate mode when the utility power is down and the UPS battery is has less than 10% of its battery power left. The router will then continue to monitor the UPS (while in hibernate mode) and then restart itself after when the utility power returns. If the UPS battery is drained and the router loses all power, the router will power back to full operation when the ‘utility’ power returns.</p>
<p>The UPS monitor feature on the MikroTik RouterOS supports</p>
<div class="itemizedlist">
<ul>
<li>hibernate and safe reboot on power and battery failure</li>
<li>UPS battery test and run time calibration test</li>
<li>monitoring of all &#8220;smart&#8221; mode status information supported by UPS</li>
<li>logging of power changes</li>
</ul>
</div>
<p><a name="9.76.1.2"></a></p>
<h3>Specifications</h3>
<p>Packages required: <strong><em>ups</em></strong><br />
License required: <em>Level1</em><br />
Submenu level: <strong><em>/system ups</em></strong><br />
Standards and Technologies: <a href="http://www.exploits.org/nut/library/protocols/apcsmart.html" target="new">APC&#8217;s smart protocol</a><br />
Hardware usage: <em>Not significant</em><br />
<a name="9.76.1.3"></a></p>
<h3>Related Documents</h3>
<div class="itemizedlist">
<ul>
<li><a href="http://www.mikrotik.com/testdocs/ros/2.9/guide/packages.php" target="_top">Software Package Management</a></li>
</ul>
</div>
<p><a name="9.76.1.4"></a></p>
<h3>Description</h3>
<p><a name="9.76.1.4.1"></a> <strong class="title"><span style="text-decoration:underline;">Cabling</span></strong></p>
<p>The APC UPS (BackUPS Pro or SmartUPS) requires a special serial cable. If no cable came with the UPS, a cable may be ordered from APC or one can be made &#8220;in-house&#8221;. Use the following diagram:</p>
<table border="1" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<td>Router Side (DB9f)</td>
<td>Signal</td>
<td>Direction</td>
<td>UPS Side (DB9m)</td>
</tr>
<tr>
<td>2</td>
<td>Receive</td>
<td>IN</td>
<td>2</td>
</tr>
<tr>
<td>3</td>
<td>Send</td>
<td>OUT</td>
<td>1</td>
</tr>
<tr>
<td>5</td>
<td>Ground</td>
<td></td>
<td>4</td>
</tr>
<tr>
<td>7</td>
<td>CTS</td>
<td>IN</td>
<td>6</td>
</tr>
</tbody>
</table>
<p>Note that you may also connect with USB if available.</p>
<p><a name="9.76.2"></a></p>
<h2>UPS Monitor Setup</h2>
<p><a name="9.76.2.1"></a>Submenu level: <strong><em>/system ups</em></strong><br />
<a name="9.76.2.2"></a></p>
<h3>Property Description</h3>
<p><strong>alarm-setting</strong> (delayed | immediate | low-battery | none; default: <strong>immediate</strong>) &#8211; UPS sound alarm setting:</p>
<div class="params"><strong>delayed</strong> &#8211; alarm is delayed to the on-battery event<br />
<strong>immediate</strong> &#8211; alarm immediately after the on-battery event<br />
<strong>low-battery</strong> &#8211; alarm only when the battery is low<br />
<strong>none</strong> &#8211; do not alarm</div>
<p><strong>load</strong> (<em>read-only: </em><em>percentage</em>) &#8211; the UPS&#8217;s output load as a percentage of full rated load in Watts. The typical accuracy of this measurement is ±3% of the maximum of 105%<strong>manufacture-date</strong> (<em>read-only: </em><em>text</em>) &#8211; the UPS&#8217;s date of manufacture in the format &#8220;mm/dd/yy&#8221; (month, day, year)<strong>min-runtime</strong> (<em>time</em>; default: <strong>5m</strong>) &#8211; minimal run time remaining. After a &#8216;utility&#8217; failure, the router will monitor the <strong>runtime-left</strong> value. When the value reaches the <strong>min-runtime</strong> value, the router will go to hibernate mode</p>
<div class="params"><strong>0</strong> &#8211; the router will go to hibernate mode when the &#8220;battery low&#8221; signal is sent indicating that the battery power is below 10%</div>
<p><strong>model</strong> (<em>read-only: </em><em>text</em>) &#8211; less than 32 ASCII character string consisting of the UPS model name (the words on the front of the UPS itself)<strong>nominal-battery-voltage</strong> (<em>read-only: </em><em>integer</em>) &#8211; the UPS&#8217;s nominal battery voltage rating (this is not the UPS&#8217;s actual battery voltage)<strong>offline-time</strong> (<em>time</em>; default: <strong>5m</strong>) &#8211; how long to work on batteries. The router waits that amount of time and then goes into hibernate mode until the UPS reports that the &#8216;utility&#8217; power is back</p>
<div class="params"><strong>0</strong> &#8211; the router will go into hibernate mode according the <strong>min-runtime</strong> setting and 10% of battery power event. In this case, the router will wait until the UPS reports that the battery power is below 10%</div>
<p><strong>port</strong> (<em>name</em>) &#8211; communication port of the router<strong>serial</strong> (<em>read-only: </em><em>text</em>) &#8211; a string of at least 8 characters directly representing the UPS&#8217;s serial number as set at the factory. Newer SmartUPS models have 12-character serial numbers<strong>version</strong> (<em>read-only: </em><em>text</em>) &#8211; UPS version, consists of three fields: SKU number, firmware revision, country code. The county code may be one of the following:</p>
<div class="params"><strong>I</strong> &#8211; 220/230/240 Vac<br />
<strong>D</strong> &#8211; 115/120 Vac<br />
<strong>A</strong> &#8211; 100 Vac<br />
<strong>M</strong> &#8211; 208 Vac<br />
<strong>J</strong> &#8211; 200 Vac</div>
<p><a name="9.76.2.3"></a></p>
<h3>Notes</h3>
<p><a name="9.76.2.3.1"></a></p>
<p>In order to enable UPS monitor, the serial port should be available.</p>
<p><a name="9.76.2.4"></a></p>
<h3>Example</h3>
<p>To enable the UPS monitor for port <strong>serial1</strong>:</p>
<pre>[admin@MikroTik] system ups&gt; add port=serial1 disabled=no
[admin@MikroTik] system ups&gt; print
Flags: X - disabled, I - invalid
 0    name="ups" port=serial1 offline-time=5m min-runtime=5m
      alarm-setting=immediate model="SMART-UPS 1000" version="60.11.I"
      serial="QS0030311640" manufacture-date="07/18/00"
      nominal-battery-voltage=24V
[admin@MikroTik] system ups&gt;</pre>
<p><a name="9.76.3"></a></p>
<h2>Runtime Calibration</h2>
<p><a name="9.76.3.1"></a>Command name: <strong><em>/system ups rtc</em></strong><br />
<a name="9.76.3.2"></a></p>
<h3>Description</h3>
<p>The <strong>rtc</strong> command causes the UPS to start a run time calibration until less than 25% of full battery capacity is reached. This command calibrates the returned run time value.</p>
<p><a name="9.76.3.3"></a></p>
<h3>Notes</h3>
<p><a name="9.76.3.3.1"></a></p>
<p>The test begins only if the battery capacity is 100%.</p>
<p><a name="9.76.3.4"></a></p>
<h3>Example</h3>
<pre>[admin@MikroTik] system ups&gt; rtc 0</pre>
<p><a name="9.76.4"></a></p>
<h2>UPS Monitoring</h2>
<p><a name="9.76.4.1"></a>Command name: <strong><em>/system ups monitor</em></strong><br />
<a name="9.76.4.2"></a></p>
<h3>Property Description</h3>
<p><strong>battery-charge</strong> (<em>percentage</em>) &#8211; the UPS&#8217;s remaining battery capacity as a percent of the fully charged condition<strong>battery-voltage</strong> &#8211; the UPS&#8217;s present battery voltage. The typical accuracy of this measurement is ±5% of the maximum value (depending on the UPS&#8217;s nominal battery voltage)<strong>frequency</strong> (<em>percentage</em>) &#8211; when operating on-line, the UPS&#8217;s internal operating frequency is synchronized to the line within variations within 3 Hz of the nominal 50 or 60 Hz. The typical accuracy of this measurement is ±1% of the full scale value of 63 Hz<strong>line-voltage</strong> &#8211; the in-line utility power voltage<strong>load</strong> (<em>percentage</em>) &#8211; the UPS&#8217;s output load as a percentage of full rated load in Watts. The typical accuracy of this measurement is ±3% of the maximum of 105%<strong>low-battery</strong> &#8211; only shown when the UPS reports this status<strong>on-battery</strong> (yes | no) &#8211; Whether UPS battery is supplying power<strong>on-line</strong> (yes | no) &#8211; whether power is being provided by the external utility (power company)<strong>output-voltage</strong> &#8211; the UPS&#8217;s output voltage<strong>overloaded-output</strong> &#8211; only shown when the UPS reports this status<strong>replace-battery</strong> &#8211; only shown when the UPS reports this status<strong>runtime-calibration-running</strong> &#8211; only shown when the UPS reports this status<strong>runtime-left</strong> (<em>time</em>) &#8211; the UPS&#8217;s estimated remaining run time in minutes. You can query the UPS when it is operating in the on-line, bypass, or on-battery modes of operation. The UPS&#8217;s remaining run time reply is based on available battery capacity and output load<strong>smart-boost-mode</strong> &#8211; only shown when the UPS reports this status<strong>smart-ssdd-mode</strong> &#8211; only shown when the UPS reports this status<strong>transfer-cause</strong> (<em>text</em>) &#8211; the reason for the most recent transfer to on-battery operation (only shown when the unit is on-battery) 	 	<a name="9.76.4.3"></a></p>
<h3>Example</h3>
<p>When running on utility power:</p>
<pre>[admin@MikroTik] system ups&gt; monitor 0
          on-line: yes
       on-battery: no
      RTC-running: no
     runtime-left: 20m
   battery-charge: 100%
  battery-voltage: 27V
     line-voltage: 226V
   output-voltage: 226V
             load: 45%
      temperature: 39C
        frequency: 50Hz
  replace-battery: no
      smart-boost: no
       smart-trim: no
         overload: no
      low-battery: no

[admin@MikroTik] system ups&gt;</pre>
<p>When running on battery:</p>
<pre>[admin@MikroTik] system ups&gt; monitor 0
          on-line: no
       on-battery: yes
   transfer-cause: "Line voltage notch or spike"
      RTC-running: no
     runtime-left: 19m
    offline-after: 4m46s
   battery-charge: 94%
  battery-voltage: 24V
     line-voltage: 0V
   output-voltage: 228V
             load: 42%
      temperature: 39C
        frequency: 50Hz
  replace-battery: no
      smart-boost: no
       smart-trim: no
         overload: no
      low-battery: no

      [admin@MikroTik] system ups&gt;</pre>
<p>©</p>
<br />Posted in Uncategorized Tagged: UPS Monitor <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/telogodog.wordpress.com/530/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/telogodog.wordpress.com/530/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/telogodog.wordpress.com/530/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/telogodog.wordpress.com/530/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/telogodog.wordpress.com/530/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/telogodog.wordpress.com/530/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/telogodog.wordpress.com/530/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/telogodog.wordpress.com/530/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/telogodog.wordpress.com/530/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/telogodog.wordpress.com/530/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/telogodog.wordpress.com/530/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/telogodog.wordpress.com/530/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/telogodog.wordpress.com/530/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/telogodog.wordpress.com/530/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=telogodog.wordpress.com&amp;blog=6674117&amp;post=530&amp;subd=telogodog&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://telogodog.wordpress.com/2009/03/29/ups-monitor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/497bf9708054bf3707509276e2eeac68?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">telogodog</media:title>
		</media:content>
	</item>
		<item>
		<title>System Watchdog</title>
		<link>http://telogodog.wordpress.com/2009/03/29/system-watchdog/</link>
		<comments>http://telogodog.wordpress.com/2009/03/29/system-watchdog/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 04:13:57 +0000</pubDate>
		<dc:creator>telogodog</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[System Watchdog]]></category>

		<guid isPermaLink="false">http://telogodog.wordpress.com/?p=527</guid>
		<description><![CDATA[Bahasa Indonesia System watchdog feature is needed to reboot the system in case of software failures. Specifications Packages required: system License required: Level1 Submenu level: /system watchdog Standards and Technologies: Hardware usage: Not significant Hardware Watchdog Management Submenu level: /system watchdog Description This menu allows to configure system to reboot on kernel panic, when an [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=telogodog.wordpress.com&amp;blog=6674117&amp;post=527&amp;subd=telogodog&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span id="more-527"></span></p>
<p><a title="Indonesian" href="http://translate.google.com/translate?hl=id&amp;langpair=en%7Cid&amp;u=http://telogodog.wordpress.com/2009/03/29/system-watchdog/"><strong>Bahasa Indonesia</strong></a></p>
<p>System watchdog feature is needed to reboot the system in case of software failures.</p>
<p><a name="9.85.1.2"></a></p>
<h3>Specifications</h3>
<p>Packages required: <strong><em>system</em></strong><br />
License required: <em>Level1</em><br />
Submenu level: <strong><em>/system watchdog</em></strong><br />
Standards and Technologies:<br />
Hardware usage: <em>Not significant</em><br />
<a name="9.85.2"></a></p>
<h2>Hardware Watchdog Management</h2>
<p><a name="9.85.2.1"></a> Submenu level: <strong><em>/system watchdog</em></strong><br />
<a name="9.85.2.2"></a></p>
<h3>Description</h3>
<p>This menu allows to configure system to reboot on kernel panic, when an IP address does not respond, or in case the system has locked up. Software watchdog timer is used to provide the last option, so in very rare cases (caused by hardware malfunction) it can lock up by itself. There is a hardware watchdog device available in RouterBOARD hardware, which can reboot the system in any case.</p>
<p><a name="9.85.2.3"></a></p>
<h3>Property Description</h3>
<p><strong>reboot-on-failure</strong> (yes | no; default: <strong>no</strong>) &#8211; whether to reboot on kernel panic 			<strong>watch-address</strong> (<em>IP address</em>; default: <strong>none</strong>) &#8211; if set, the system will reboot in case 6 sequental pings to the given IP address (sent once per 10 seconds) will fail</p>
<div class="params"><strong>none</strong> &#8211; disable this option</div>
<p><strong>watchdog-timer</strong> (yes | no; default: <strong>no</strong>) &#8211; whether to reboot if system is unresponsive for a minute 			<strong>no-ping-delay</strong> (<em>time</em>; default: <strong>5m</strong>) &#8211; specifies how long after reboot not to test and ping <strong>watch-address</strong>. The default setting means that if <strong>watch-address</strong> is set and is not reachable, the router will reboot about every 6 minutes.       <strong>automatic-supout</strong> (yes | no; default: <strong>yes</strong>) &#8211; when software failure happens, a file named &#8220;autosupout.rif&#8221; is generated automatically. The previous &#8220;autosupout.rif&#8221; file is renamed to &#8220;autosupout.old.rif&#8221;       <strong>auto-send-supout</strong> (yes | no; default: <strong>no</strong>) &#8211; after the support output file is automatically generated, it can be sent by email       <strong>send-email-from</strong> (<em>text</em>; default: <strong>&#8220;&#8221;</strong>) &#8211; e-mail address to send the support output file from. If not set, the value set in <strong>/tool e-mail</strong> is used       <strong>send-email-to</strong> (<em>text</em>; default: <strong>&#8220;&#8221;</strong>) &#8211; e-mail address to send the support output file to       <strong>send-smtp-server</strong> (<em>text</em>; default: <strong>&#8220;&#8221;</strong>) &#8211; SMTP server address to send the support output file through. If not set, the value set in <strong>/tool e-mail</strong> is used 		 		<a name="9.85.2.4"></a></p>
<h3>Example</h3>
<p>To make system generate a support output file and sent it automatically to <strong>support@example.com</strong> throught the <strong>192.0.2.1</strong>in case of a software crash:</p>
<pre>[admin@MikroTik] system watchdog&gt; set auto-send-supout=yes \
\... send-to-email=support@example.com send-smtp-server=192.0.2.1
[admin@MikroTik] system watchdog&gt; print
  reboot-on-failure: yes
      watch-address: none
     watchdog-timer: yes
      no-ping-delay: 5m
   automatic-supout: yes
   auto-send-supout: yes
   send-smtp-server: 192.0.2.1
      send-email-to: support@example.com
[admin@MikroTik] system watchdog&gt;</pre>
<p>©</p>
<br />Posted in Uncategorized Tagged: System Watchdog <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/telogodog.wordpress.com/527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/telogodog.wordpress.com/527/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/telogodog.wordpress.com/527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/telogodog.wordpress.com/527/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/telogodog.wordpress.com/527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/telogodog.wordpress.com/527/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/telogodog.wordpress.com/527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/telogodog.wordpress.com/527/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/telogodog.wordpress.com/527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/telogodog.wordpress.com/527/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/telogodog.wordpress.com/527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/telogodog.wordpress.com/527/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/telogodog.wordpress.com/527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/telogodog.wordpress.com/527/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=telogodog.wordpress.com&amp;blog=6674117&amp;post=527&amp;subd=telogodog&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://telogodog.wordpress.com/2009/03/29/system-watchdog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/497bf9708054bf3707509276e2eeac68?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">telogodog</media:title>
		</media:content>
	</item>
		<item>
		<title>IP Telephony</title>
		<link>http://telogodog.wordpress.com/2009/03/29/ip-telephony/</link>
		<comments>http://telogodog.wordpress.com/2009/03/29/ip-telephony/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 04:10:18 +0000</pubDate>
		<dc:creator>telogodog</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[IP Telephony]]></category>

		<guid isPermaLink="false">http://telogodog.wordpress.com/?p=524</guid>
		<description><![CDATA[Bahasa Indonesia The MikroTik RouterOS IP Telephony feature enables Voice over IP (VoIP) communications using routers equipped with the following voice port hardware: Quicknet LineJACK or PhoneJACK analog telephony cards ISDN cards Voicetronix OpenLine4 (was V4PCI) &#8211; 4 analog telephone lines cards Zaptel Wildcard X100P IP telephony card &#8211; 1 analog telephone line Specifications Packages [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=telogodog.wordpress.com&amp;blog=6674117&amp;post=524&amp;subd=telogodog&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span id="more-524"></span></p>
<p><a title="Indonesian" href="http://translate.google.com/translate?hl=id&amp;langpair=en%7Cid&amp;u=http://telogodog.wordpress.com/2009/03/29/ip-telephony/"><strong>Bahasa Indonesia</strong></a></p>
<p>The MikroTik RouterOS IP Telephony feature enables Voice over IP (VoIP) communications using routers equipped with the following voice port hardware:</p>
<div class="itemizedlist">
<ul>
<li> Quicknet LineJACK or PhoneJACK analog telephony cards</li>
<li> ISDN cards</li>
<li> Voicetronix OpenLine4 (was V4PCI) &#8211; 4 analog telephone lines cards</li>
<li> Zaptel Wildcard X100P IP telephony card &#8211; 1 analog telephone line</li>
</ul>
</div>
<p><a name="7.45.1.2"></a></p>
<h3>Specifications</h3>
<p>Packages required: <strong><em>telephony</em></strong><br />
License required: <em>Level1</em><br />
Submenu level: <strong><em>/ip telephony</em></strong><br />
Standards and Technologies: <a href="http://www.faqs.org/rfcs/rfc1889.html" target="new">RTP</a><br />
Hardware usage: <em>Pentium MMX level processor recommended</em><br />
<a name="7.45.1.3"></a></p>
<h3>Related Documents</h3>
<div class="itemizedlist">
<ul>
<li> <a href="http://www.mikrotik.com/testdocs/ros/2.9/guide/packages.php" target="_top">Package Management</a></li>
<li> <a href="http://www.mikrotik.com/testdocs/ros/2.9/interface/isdn.php" target="_top">ISDN</a></li>
<li> <a href="http://www.mikrotik.com/testdocs/ros/2.9/guide/aaa.php" target="_top">AAA</a></li>
</ul>
</div>
<p><a name="7.45.1.4"></a></p>
<h3>Description</h3>
<div class="itemizedlist">
<p>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:</p>
<ul>
<li> Computer-to-computer &#8211; This is certainly the easiest way to use VoIP, and you don&#8217;t have to pay for long-distance calls.</li>
<li> Computer-to-telephone &#8211; This method allows you to call anyone (who has a phone) from your computer. Like computer-to-computer calling, it requires a software client. The software is typically free, but the calls may have a small per-minute charge.</li>
<li> Telephone-to-computer &#8211; Allows a standard telephone user to initiate a call to a computer user.</li>
<li> Telephone-to-telephone &#8211; Through the use of gateways, you can connect directly with any other standard telephone in the world.</li>
</ul>
</div>
<div class="itemizedlist">
<p>Suppoted hardware:</p>
<ul>
<li> <a href="http://www.quicknet.net/" target="_new">Quicknet Technologies</a> cards:
<div class="itemizedlist">
<ul>
<li> Internet PhoneJACK (ISA or PCI) for connecting an analog telephone (FXS port)</li>
<li> Internet LineJACK (ISA) for connecting an analog telephone line (FXO port) or a telephone (FXS port)</li>
</ul>
</div>
</li>
<li> ISDN client cards (PCI) for connecting an ISDN line. See <a href="http://www.mikrotik.com/testdocs/ros/2.9/guide/driverlist.main.php" target="_top">Device Driver List</a> for the list of supported PCI ISDN cards</li>
<li> <a href="http://www.voicetronix.com.au/" target="_new">Voicetronix</a> OpenLine4 card for connecting four (4) analog telephone lines (FXO ports)</li>
<li> Zaptel Wildcard X100P IP telephony card (from <a href="http://www.digium.com/" target="_new">Linux Support Services</a>) for connecting one analog telephone line (FXO port)</li>
</ul>
</div>
<div class="itemizedlist">
<p>Supported standards:</p>
<ul>
<li> MikroTik RouterOS supports IP Telephony in compliance with the International Telecommunications Union &#8211; Telecommunications (ITU-T) specification H.323v4. H.323 is a specification for transmitting multimedia (voice, video, and data) across an IP network. H.323v4 includes: H.245, H.225, Q.931, H.450.1, RTP(real-time protocol)</li>
<li> The followong audio codecs are supported: <strong>G.711</strong> (the 64 kbps Pulse code modulation (PCM) voice coding), <strong>G.723.1</strong> (the 6.3 kbps compression technique that can be used for compressing audio signal at very low bit rate), <strong>GSM-06.10</strong> (the 13.2 kbps coding), <strong>LPC-10</strong> (the 2.5 kbps coding), <strong>G.729</strong> and <strong>G.729a</strong> (the 8 kbps CS-ACELP software coding), <strong>G.728</strong> (16 kbps coding technique, supported only on Quicknet LineJACK cards)</li>
</ul>
</div>
<p>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.</p>
<div class="itemizedlist">
<p>The total delay from the moment of recording the voice signal till its playback is the sum of following three delay times:</p>
<ul>
<li> delay time at the recording point (approx. 38ms)</li>
<li> delay time of the IP network (1..5ms and up)</li>
<li> delay time at the playback point (the jitter delay)</li>
</ul>
</div>
<p><a name="7.45.1.5"></a></p>
<h3>Notes</h3>
<p><a name="7.45.1.5.1"></a></p>
<p>Each installed Quicknet card requires IO memory range in the following sequence: the first card occupies addresses 0&#215;300-0x31f, the second card 0&#215;320-0x33f, the third 0&#215;340-0x35f, and so on. Make sure there is no conflict in these ranges with other devices, e.g., network interface cards, etc.</p>
<p><a name="7.45.1.5.2"></a></p>
<p>Use the telephony logging feature to debug your setup.</p>
<p><a name="7.45.1."></a></p>
<h3>Additional Resources</h3>
<p><a href="http://www.internet-telephony.org/research_reference/" target="_new">IP Telephony Online</a> <a name="7.45.2"></a></p>
<h2>General Voice port settings</h2>
<p><a name="7.45.2.1"></a> Submenu level: <strong><em>/ip telephony voice-port</em></strong><br />
<a name="7.45.2.2"></a></p>
<h3>Description</h3>
<p>This submenu is used for managing all IP telephony voice ports (linejack, phonejack, isdn, voip, voicetronix, zaptel)</p>
<p><a name="7.45.2.3"></a></p>
<h3>Property Description</h3>
<p><strong>name</strong> (<em>name</em>) &#8211; assigned name of the voice port 			<strong>type</strong> (<em>read-only: </em>phonejack | linejack | phonejack-lite | phonejack-pci | voip | isdn | voicetronix | zaptel) &#8211; type of the installed telephony voice port:</p>
<div class="params"><strong>phonejack</strong> &#8211; Quicknet PhoneJACK (ISA)<br />
<strong>linejack</strong> &#8211; Quicknet LineJACK (ISA)<br />
<strong>phonejack-lite</strong> &#8211; Quicknet PhoneJACK Lite Linux Edition (ISA)<br />
<strong>phonejack-pci</strong> &#8211; Quicknet PhoneJACK (PCI)<br />
<strong>voip</strong> &#8211; generic Voice over IP port<br />
<strong>isdn</strong> &#8211; ISDN cards<br />
<strong>voicetronix</strong> &#8211; Voicetronix OpenLine4<br />
<strong>zaptel</strong> &#8211; Zaptel Wildcard X100P</div>
<p><strong>autodial</strong> (<em>integer</em>; default: <strong>&#8220;&#8221;</strong>) &#8211; number to be dialed automatically, if call is coming in from this voice port 		 		<a name="7.45.2.4"></a></p>
<h3>Notes</h3>
<p><a name="7.45.2.4.1"></a></p>
<div class="itemizedlist">
<p>If <strong>autodial</strong> does not exactly match an item in <strong>/ip telephony numbers</strong>, there can be two possibilities:</p>
<ul>
<li> if <strong>autodial</strong> is incomplete, rest of the number is asked (local voice port) or incoming call is denied (VoIP)</li>
<li> if <strong>autodial</strong> is invalid, line is hung up (PSTN line), busy tone is played (POTS) or incoming call is denied (VoIP)</li>
</ul>
</div>
<p><a name="7.45.3"></a></p>
<h2>Voicetronix Voice Ports</h2>
<p><a name="7.45.3.1"></a> Submenu level: <strong><em>/ip telephony voice-port voicetronix</em></strong><br />
<a name="7.45.3.2"></a></p>
<h3>Property Description</h3>
<p><strong>name</strong> (<em>name</em>) &#8211; name given by the user or the default one 			<strong>autodial</strong> (<em>integer</em>; default: <strong>&#8220;&#8221;</strong>) &#8211; 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 &#8211; the line is picked up only after the remote party answers the call) 			<strong>playback-volume</strong> (<em>integer</em>: -48..48; default: <strong>0</strong>) &#8211; playback volume in dB</p>
<div class="params"><strong>0</strong> &#8211; 0dB meand no change to signal level</div>
<p><strong>record-volume</strong> (<em>integer</em>: -48..48; default: <strong>0</strong>) &#8211; record volume in dB</p>
<div class="params"><strong>0</strong> &#8211; 0dB meand no change to signal level</div>
<p><strong>region</strong> (<em>name</em>; default: <strong>us</strong>) &#8211; 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 			<strong>agc-on-playback</strong> (yes | no; default: <strong>no</strong>) &#8211; automatic gain control on playback (can not be used together with hardware voice codecs) 			<strong>agc-on-record</strong> (yes | no; default: <strong>no</strong>) &#8211; automatic gain control on record (can not be used together with hardware voice codecs) 			<strong>detect-cpt</strong> (yes | no; default: <strong>no</strong>) &#8211; automatically detect call progress tones 			<strong>balance-registers</strong> (<em>integer</em>: 0..255; default: <strong>199</strong>) &#8211; 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 <strong>bal1[,bal3[,bal2]]</strong>, where <strong>bal1</strong>, <strong>bal2</strong>, <strong>bal3</strong> &#8211; balance registers. <strong>bal1</strong> has to be in interval 192..248 (0xC0..0xF8). The others should be in interval 0..255 (0&#215;00..0xFF) 			<strong>balance-status</strong> (<em>read-only: </em><em>integer</em>; default: <strong>unknown</strong>) &#8211; shows quality of hardware echo cancellation in dB 			<strong>loop-drop-detection</strong> (yes | no; default: <strong>yes</strong>) &#8211; automatically clear call when loop drop is detected 		 		<a name="7.45.3.3"></a></p>
<h3>Command Description</h3>
<p><strong>test-balance</strong> &#8211; current <strong>balance-registers</strong> value is tested once. Result is placed in <strong>balance-status</strong> parameter. Balance can be tested only when line is off-hook. It won&#8217;t work if line is on-hook or there is an established connection</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em> (<em>name</em>) 					 &#8211; port name to test balance of</div>
<p><strong>find-best-balance</strong> &#8211; series of <strong>test-balance</strong> is executed with different <strong>balance-registers</strong> values. During the tests <strong>balance-registers</strong> are updated to the best values found</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em> (<em>name</em>) 					 &#8211; port name to find best balance of</div>
<p><strong>clear-call</strong> &#8211; terminate a current call established with the specified voice port</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em> (<em>name</em>) 					 &#8211; port name to clear call with</div>
<p><strong>show-stats</strong> &#8211; show voice port statistics</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em> (<em>name</em>) 					 &#8211; port name show statistics of 				<strong><span style="text-decoration:underline;">Return Values</span></strong><br />
<strong>round-trip-delay</strong> (<em>time</em>) 					 &#8211; maximal time of packet round trip<br />
<strong>packets-sent</strong> (<em>integer</em>) 					 &#8211; number of packets sent by this card (these packets are digitalized input of the voice port)<br />
<strong>bytes-sent</strong> (<em>integer</em>) 					 &#8211; number of bytes sent by this card (these packets are digitalized input of the voice port)<br />
<strong>sent-time</strong> (<em>text</em>) 					 &#8211; minimal/average/maximal intervals between packets sent<br />
<strong>packets-received</strong> (<em>integer</em>) 					 &#8211; number of packets received by this card (these packets form analog output of the voice port)<br />
<strong>bytes-received</strong> (<em>integer</em>) 					 &#8211; number of bytes received by this card (these packets form analog output of the voice port)<br />
<strong>received-time</strong> (<em>text</em>) 					 &#8211; minimal/average/maximal intervals between packets received<br />
<strong>average-jitter-delay</strong> (<em>time</em>)  &#8211; 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 &gt;40ms, then it is close (+/-1ms) to the actual delay time.</div>
<p><strong>monitor</strong> &#8211; monitor status of the voice port</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em> (<em>name</em>) 					 &#8211; port name to monitor 				<strong><span style="text-decoration:underline;">Return Values</span></strong><br />
<strong>status</strong> (on-hook | off-hook | ring | connection | busy) 					 &#8211; current state of the port:</p>
<li> <strong>on-hook</strong> &#8211; the handset is on-hook, no activity</li>
<li> <strong>off-hook</strong> &#8211; the handset is off-hook, the number is being dialed</li>
<li> <strong>ring</strong> &#8211; call in progress, direction of the call is shown by the <strong>direction</strong> property</li>
<li> <strong>connection</strong> &#8211; the connection has been established</li>
<li> <strong>busy</strong> &#8211; the connection has been terminated, the handset is still off-hook</li>
<p><strong>directiopn</strong> (ip-to-port | port-to-ip) 					 &#8211; direction of the call</p>
<li> <strong>ip-to-port</strong> &#8211; call from the IP network to the voice card</li>
<li> <strong>port-to-ip</strong> &#8211; call from the voice card to an IP address</li>
<p><strong>phone-number</strong> (<em>integer</em>) 					 &#8211; the phone number being dialed<br />
<strong>remote-party-name</strong> (<em>text</em>) 					 &#8211; name and IP address of the remote party<br />
<strong>codec</strong> (<em>name</em>) 					 &#8211; CODEC used for the audio connection<br />
<strong>duration</strong> (<em>time</em>) 					 &#8211; duration of the phone call</div>
<p><a name="7.45.3.4"></a></p>
<h3>Notes</h3>
<p><a name="7.45.3.4.1"></a></p>
<p>As some Voicetronix cards fail to detect loop drop correctly, with <strong>loop-drop-detection</strong> 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.</p>
<p><a name="7.45.3.4.2"></a></p>
<div class="itemizedlist">
<p>Some tips for testing balance registers:</p>
<ul>
<li> test is sensitive to noise from the phone, so it&#8217;s recommended to cover mouth piece during it;</li>
<li> <strong>find-best-balance</strong> can be interrupted by <strong>clear-call</strong> command;</li>
<li> once best <strong>balance-registers</strong> value is known, it can be set manually to this best value for all voicetronix voice ports, which will use the same telephone line.</li>
</ul>
</div>
<p><a name="7.45.4"></a></p>
<h2>LineJack Voice Ports</h2>
<p><a name="7.45.4.1"></a> Submenu level: <strong><em>/ip telephony voice-port linejack</em></strong><br />
<a name="7.45.4.2"></a></p>
<h3>Property Description</h3>
<p><strong>name</strong> (<em>name</em>) &#8211; name given by the user or the default one 			<strong>autodial</strong> (<em>integer</em>; default: <strong>&#8220;&#8221;</strong>) &#8211; 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 &#8220;line&#8221; port) or busy tone is played (FXS &#8220;phone&#8221; 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 &#8211; the line is picked up only after the remote party answers the call 			<strong>playback-volume</strong> (<em>integer</em>: -48..48; default: <strong>0</strong>) &#8211; playback volume in dB</p>
<div class="params"><strong>0</strong> &#8211; 0dB meand no change to signal level</div>
<p><strong>record-volume</strong> (<em>integer</em>: -48..48; default: <strong>0</strong>) &#8211; record volume in dB</p>
<div class="params"><strong>0</strong> &#8211; 0dB meand no change to signal level</div>
<p><strong>ring-cadence</strong> (<em>text</em>) &#8211; a 16-symbol ring cadence for the phone, each symbol lasts 0.5 seconds, <strong>+</strong> means ringing, <strong>-</strong> means no ringing 			<strong>region</strong> (<em>name</em>; default: <strong>us</strong>) &#8211; 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 			<strong>aec</strong> (yes | no) &#8211; whether echo detection and cancellation is enabled 			<strong>aec-tail-length</strong> (short | medium | long; default: <strong>short</strong>) &#8211; size of the buffer of echo detection 			<strong>aec-nlp-threshold</strong> (off | low | medium | high; default: <strong>low</strong>) &#8211; level of cancellation of silent sounds 			<strong>aec-attenuation-scaling</strong> (<em>integer</em>: 0..10; default: <strong>4</strong>) &#8211; factor of additional echo attenuation 			<strong>aec-attenuation-boost</strong> (<em>integer</em>: 0..90; default: <strong>0</strong>) &#8211; level of additional echo attenuation 			<strong>software-aec</strong> (yes | no) &#8211; software echo canceller (experimental, for most of the cards) 			<strong>agc-on-playback</strong> (yes | no; default: <strong>no</strong>) &#8211; automatic gain control on playback (can not be used together with hardware voice codecs) 			<strong>agc-on-record</strong> (yes | no; default: <strong>no</strong>) &#8211; automatic gain control on record (can not be used together with hardware voice codecs) 			<strong>detect-cpt</strong> (yes | no; default: <strong>no</strong>) &#8211; automatically detect call progress tones 		 		<a name="7.45.4.3"></a></p>
<h3>Command Description</h3>
<p><strong>blink</strong> &#8211; 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</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em> (<em>name</em>) 					 &#8211; card name to blink the LED of</div>
<p><strong>clear-call</strong> &#8211; terminate a current call established with the specified voice port</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em> (<em>name</em>) 					 &#8211; port name to clear call with</div>
<p><strong>show-stats</strong> &#8211; show voice port statistics</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em> (<em>name</em>) 					 &#8211; port name show statistics of 				<strong><span style="text-decoration:underline;">Return Values</span></strong><br />
<strong>round-trip-delay</strong> (<em>time</em>) 					 &#8211; maximal time of packet round trip<br />
<strong>packets-sent</strong> (<em>integer</em>) 					 &#8211; number of packets sent by this card (these packets are digitalized input of the voice port)<br />
<strong>bytes-sent</strong> (<em>integer</em>) 					 &#8211; number of bytes sent by this card (these packets are digitalized input of the voice port)<br />
<strong>sent-time</strong> (<em>text</em>) 					 &#8211; minimal/average/maximal intervals between packets sent<br />
<strong>packets-received</strong> (<em>integer</em>) 					 &#8211; number of packets received by this card (these packets form analog output of the voice port)<br />
<strong>bytes-sent</strong> (<em>integer</em>) 					 &#8211; number of bytes received by this card (these packets form analog output of the voice port)<br />
<strong>sent-time</strong> (<em>text</em>) 					 &#8211; minimal/average/maximal intervals between packets received<br />
<strong>average-jitter-delay</strong> (<em>time</em>)  &#8211; 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 &gt;40ms, then it is close (+/-1ms) to the actual delay time.</div>
<p><strong>monitor</strong> &#8211; monitor status of the voice port</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em> (<em>name</em>) 					 &#8211; port name to monitor 				<strong><span style="text-decoration:underline;">Return Values</span></strong><br />
<strong>status</strong> (on-hook | off-hook | ring | connection | busy) 					 &#8211; current state of the port:</p>
<li> <strong>on-hook</strong> &#8211; the handset is on-hook, no activity</li>
<li> <strong>off-hook</strong> &#8211; the handset is off-hook, the number is being dialed</li>
<li> <strong>ring</strong> &#8211; call in progress, direction of the call is shown by the <strong>direction</strong> property</li>
<li> <strong>connection</strong> &#8211; the connection has been established</li>
<li> <strong>busy</strong> &#8211; the connection has been terminated, the handset is still off-hook</li>
<p><strong>port</strong> (phone | line) 					 &#8211; the active port of the card</p>
<li> <strong>phone</strong> &#8211; telephone connected to the card (POTS FXS port)</li>
<li> <strong>line</strong> &#8211; line connected to the card (PSTN FXO port)</li>
<p><strong>directiopn</strong> (ip-to-port | port-to-ip) 					 &#8211; direction of the call</p>
<li> <strong>ip-to-port</strong> &#8211; call from the IP network to the voice card</li>
<li> <strong>port-to-ip</strong> &#8211; call from the voice card to an IP address</li>
<p><strong>line-status</strong> (plugged | unplugged) 					 &#8211; state of the PSTN line</p>
<li> <strong>plugged</strong> &#8211; the telephone line is connected to the PSTN port of the card</li>
<li> <strong>unplugged</strong> &#8211; there is no working line connected to the PSTN port of the card</li>
<p><strong>phone-number</strong> (<em>integer</em>) 					 &#8211; the phone number being dialed<br />
<strong>remote-party-name</strong> (<em>text</em>) 					 &#8211; name and IP address of the remote party<br />
<strong>codec</strong> (<em>name</em>) 					 &#8211; CODEC used for the audio connection<br />
<strong>duration</strong> (<em>time</em>) 					 &#8211; duration of the phone call</div>
<p><a name="7.45.4.4"></a></p>
<h3>Notes</h3>
<p><a name="7.45.4.4.1"></a></p>
<p>When telephone line is connected to the &#8216;line&#8217; port, green LED next to the port should be lit in some seconds. If telephone line disappear, the LED next to the &#8216;line&#8217; 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 &#8216;phone&#8217; port before the router is turned on, red LED next to the port will be lit. WARNING: do not plug telephone line into the &#8216;phone&#8217; port when the router is running and green LED next to the port is lit &#8211; this might damage the card. The status of the &#8216;phone&#8217; port is only detected on system startup.</p>
<p><a name="7.45.5"></a></p>
<h2>PhoneJack Voice Ports</h2>
<p><a name="7.45.5.1"></a> Submenu level: <strong><em>/ip telephony voice-port phonejack</em></strong><br />
<a name="7.45.5.2"></a></p>
<h3>Property Description</h3>
<p><strong>name</strong> (<em>name</em>) &#8211; name given by the user or the default one 			<strong>type</strong> (<em>read-only: </em>phonejack | phonejack-lite | phonejack-pci) &#8211; type of the card 			<strong>autodial</strong> (<em>integer</em>; default: <strong>&#8220;&#8221;</strong>) &#8211; 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 			<strong>playback-volume</strong> (<em>integer</em>: -48..48; default: <strong>0</strong>) &#8211; playback volume in dB</p>
<div class="params"><strong>0</strong> &#8211; 0dB meand no change to signal level</div>
<p><strong>record-volume</strong> (<em>integer</em>: -48..48; default: <strong>0</strong>) &#8211; record volume in dB</p>
<div class="params"><strong>0</strong> &#8211; 0dB meand no change to signal level</div>
<p><strong>ring-cadence</strong> (<em>text</em>) &#8211; a 16-symbol ring cadence for the phone, each symbol lasts 0.5 seconds, <strong>+</strong> means ringing, <strong>-</strong> means no ringing 			<strong>region</strong> (<em>name</em>; default: <strong>us</strong>) &#8211; regional setting for the voice port. This setting is used for generating the dial tones 			<strong>aec</strong> (yes | no) &#8211; wheteher echo detection and cancellation is enabled 			<strong>aec-tail-length</strong> (short | medium | long; default: <strong>short</strong>) &#8211; size of the buffer of echo detection 			<strong>aec-nlp-threshold</strong> (off | low | medium | high; default: <strong>low</strong>) &#8211; level of cancellation of silent sounds 			<strong>aec-attenuation-scaling</strong> (<em>integer</em>: 0..10; default: <strong>4</strong>) &#8211; factor of additional echo attenuation 			<strong>aec-attenuation-boost</strong> (<em>integer</em>: 0..90; default: <strong>0</strong>) &#8211; level of additional echo attenuation 			<strong>software-aec</strong> (yes | no) &#8211; software echo canceller (experimental, for most of the cards) 			<strong>agc-on-playback</strong> (yes | no; default: <strong>no</strong>) &#8211; automatic gain control on playback (can not be used together with hardware voice codecs) 			<strong>agc-on-record</strong> (yes | no; default: <strong>no</strong>) &#8211; automatic gain control on record (can not be used together with hardware voice codecs) 			<strong>detect-cpt</strong> (yes | no; default: <strong>no</strong>) &#8211; automatically detect call progress tones 		 		<a name="7.45.5.3"></a></p>
<h3>Command Description</h3>
<p><strong>clear-call</strong> &#8211; terminate a current call established with the specified voice port</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em> (<em>name</em>) 					 &#8211; port name to clear call with</div>
<p><strong>show-stats</strong> &#8211; show voice port statistics</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em> (<em>name</em>) 					 &#8211; port name show statistics of 				<strong><span style="text-decoration:underline;">Return Values</span></strong><br />
<strong>round-trip-delay</strong> (<em>time</em>) 					 &#8211; maximal time of packet round trip<br />
<strong>packets-sent</strong> (<em>integer</em>) 					 &#8211; number of packets sent by this card (these packets are digitalized input of the voice port)<br />
<strong>bytes-sent</strong> (<em>integer</em>) 					 &#8211; number of bytes sent by this card (these packets are digitalized input of the voice port)<br />
<strong>sent-time</strong> (<em>text</em>) 					 &#8211; minimal/average/maximal intervals between packets sent<br />
<strong>packets-received</strong> (<em>integer</em>) 					 &#8211; number of packets received by this card (these packets form analog output of the voice port)<br />
<strong>bytes-sent</strong> (<em>integer</em>) 					 &#8211; number of bytes received by this card (these packets form analog output of the voice port)<br />
<strong>sent-time</strong> (<em>text</em>) 					 &#8211; minimal/average/maximal intervals between packets received<br />
<strong>average-jitter-delay</strong> (<em>time</em>)  &#8211; 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 &gt;40ms, then it is close (+/-1ms) to the actual delay time.</div>
<p><strong>monitor</strong> &#8211; monitor status of the voice port</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em> (<em>name</em>) 					 &#8211; port name to monitor 				<strong><span style="text-decoration:underline;">Return Values</span></strong><br />
<strong>status</strong> (on-hook | off-hook | ring | connection | busy) 					 &#8211; current state of the port:</p>
<li> <strong>on-hook</strong> &#8211; the handset is on-hook, no activity</li>
<li> <strong>off-hook</strong> &#8211; the handset is off-hook, the number is being dialed</li>
<li> <strong>ring</strong> &#8211; call in progress, direction of the call is shown by the <strong>direction</strong> property</li>
<li> <strong>connection</strong> &#8211; the connection has been established</li>
<li> <strong>busy</strong> &#8211; the connection has been terminated, the handset is still off-hook</li>
<p><strong>port</strong> (phone | line) 					 &#8211; the active port of the card</p>
<li> <strong>phone</strong> &#8211; telephone connected to the card (POTS FXS port)</li>
<li> <strong>line</strong> &#8211; line connected to the card (PSTN FXO port)</li>
<p><strong>directiopn</strong> (ip-to-port | port-to-ip) 					 &#8211; direction of the call</p>
<li> <strong>ip-to-port</strong> &#8211; call from the IP network to the voice card</li>
<li> <strong>port-to-ip</strong> &#8211; call from the voice card to an IP address</li>
<p><strong>line-status</strong> (plugged | unplugged) 					 &#8211; state of the PSTN line</p>
<li> <strong>plugged</strong> &#8211; the telephone line is connected to the PSTN port of the card</li>
<li> <strong>unplugged</strong> &#8211; there is no working line connected to the PSTN port of the card</li>
<p><strong>phone-number</strong> (<em>integer</em>) 					 &#8211; the phone number being dialed<br />
<strong>remote-party-name</strong> (<em>text</em>) 					 &#8211; name and IP address of the remote party<br />
<strong>codec</strong> (<em>name</em>) 					 &#8211; CODEC used for the audio connection<br />
<strong>duration</strong> (<em>time</em>) 					 &#8211; duration of the phone call</div>
<p><a name="7.45.6"></a></p>
<h2>Zaptel Voice Ports</h2>
<p><a name="7.45.6.1"></a> Submenu level: <strong><em>/ip telephony voice-port zaptel</em></strong><br />
<a name="7.45.6.2"></a></p>
<h3>Property Description</h3>
<p><strong>name</strong> (<em>name</em>) &#8211; name given by the user or the default one 			<strong>autodial</strong> (<em>integer</em>; default: <strong>&#8220;&#8221;</strong>) &#8211; 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 &#8211; the line is picked up only after the remote party answers the call) 			<strong>playback-volume</strong> (<em>integer</em>: -48..48; default: <strong>0</strong>) &#8211; playback volume in dB</p>
<div class="params"><strong>0</strong> &#8211; 0dB meand no change to signal level</div>
<p><strong>record-volume</strong> (<em>integer</em>: -48..48; default: <strong>0</strong>) &#8211; record volume in dB</p>
<div class="params"><strong>0</strong> &#8211; 0dB meand no change to signal level</div>
<p><strong>region</strong> (<em>name</em>; default: <strong>us</strong>) &#8211; 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 			<strong>aec</strong> (yes | no) &#8211; wheteher echo detection and cancellation is enabled 			<strong>aec-tail-length</strong> (short | medium | long; default: <strong>short</strong>) &#8211; size of the buffer of echo detection 			<strong>aec-nlp-threshold</strong> (off | low | medium | high; default: <strong>low</strong>) &#8211; level of cancellation of silent sounds 			<strong>aec-attenuation-scaling</strong> (<em>integer</em>: 0..10; default: <strong>4</strong>) &#8211; factor of additional echo attenuation 			<strong>aec-attenuation-boost</strong> (<em>integer</em>: 0..90; default: <strong>0</strong>) &#8211; level of additional echo attenuation 			<strong>software-aec</strong> (yes | no) &#8211; software echo canceller (experimental, for most of the cards) 			<strong>agc-on-playback</strong> (yes | no; default: <strong>no</strong>) &#8211; automatic gain control on playback (can not be used together with hardware voice codecs) 			<strong>agc-on-record</strong> (yes | no; default: <strong>no</strong>) &#8211; automatic gain control on record (can not be used together with hardware voice codecs) 			<strong>detect-cpt</strong> (yes | no; default: <strong>no</strong>) &#8211; automatically detect call progress tones 		 		<a name="7.45.6.3"></a></p>
<h3>Command Description</h3>
<p><strong>clear-call</strong> &#8211; terminate a current call established with the specified voice port</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em> (<em>name</em>) 					 &#8211; port name to clear call with</div>
<p><strong>show-stats</strong> &#8211; show voice port statistics</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em> (<em>name</em>) 					 &#8211; port name show statistics of 				<strong><span style="text-decoration:underline;">Return Values</span></strong><br />
<strong>round-trip-delay</strong> (<em>time</em>) 					 &#8211; maximal time of packet round trip<br />
<strong>packets-sent</strong> (<em>integer</em>) 					 &#8211; number of packets sent by this card (these packets are digitalized input of the voice port)<br />
<strong>bytes-sent</strong> (<em>integer</em>) 					 &#8211; number of bytes sent by this card (these packets are digitalized input of the voice port)<br />
<strong>sent-time</strong> (<em>text</em>) 					 &#8211; minimal/average/maximal intervals between packets sent<br />
<strong>packets-received</strong> (<em>integer</em>) 					 &#8211; number of packets received by this card (these packets form analog output of the voice port)<br />
<strong>bytes-sent</strong> (<em>integer</em>) 					 &#8211; number of bytes received by this card (these packets form analog output of the voice port)<br />
<strong>sent-time</strong> (<em>text</em>) 					 &#8211; minimal/average/maximal intervals between packets received<br />
<strong>average-jitter-delay</strong> (<em>time</em>)  &#8211; 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 &gt;40ms, then it is close (+/-1ms) to the actual delay time.</div>
<p><strong>monitor</strong> &#8211; monitor status of the voice port</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em> (<em>name</em>) 					 &#8211; port name to monitor 				<strong><span style="text-decoration:underline;">Return Values</span></strong><br />
<strong>status</strong> (on-hook | off-hook | ring | connection | busy) 					 &#8211; current state of the port:</p>
<li> <strong>on-hook</strong> &#8211; the handset is on-hook, no activity</li>
<li> <strong>off-hook</strong> &#8211; the handset is off-hook, the number is being dialed</li>
<li> <strong>ring</strong> &#8211; call in progress, direction of the call is shown by the <strong>direction</strong> property</li>
<li> <strong>connection</strong> &#8211; the connection has been established</li>
<li> <strong>busy</strong> &#8211; the connection has been terminated, the handset is still off-hook</li>
<p><strong>directiopn</strong> (ip-to-port | port-to-ip) 					 &#8211; direction of the call</p>
<li> <strong>ip-to-port</strong> &#8211; call from the IP network to the voice card</li>
<li> <strong>port-to-ip</strong> &#8211; call from the voice card to an IP address</li>
<p><strong>line-status</strong> (plugged | unplugged) 					 &#8211; state of the PSTN line</p>
<li> <strong>plugged</strong> &#8211; the telephone line is connected to the PSTN port of the card</li>
<li> <strong>unplugged</strong> &#8211; there is no working line connected to the PSTN port of the card</li>
<p><strong>phone-number</strong> (<em>integer</em>) 					 &#8211; the phone number being dialed<br />
<strong>remote-party-name</strong> (<em>text</em>) 					 &#8211; name and IP address of the remote party<br />
<strong>codec</strong> (<em>name</em>) 					 &#8211; CODEC used for the audio connection<br />
<strong>duration</strong> (<em>time</em>) 					 &#8211; duration of the phone call</div>
<p><a name="7.45.7"></a></p>
<h2>ISDN Voice Ports</h2>
<p><a name="7.45.7.1"></a> Submenu level: <strong><em>/ip telephony voice-port isdn</em></strong><br />
<a name="7.45.7.2"></a></p>
<h3>Property Description</h3>
<p><strong>name</strong> (<em>name</em>) &#8211; name given by the user or the default one 			<strong>msn</strong> (<em>integer</em>) &#8211; telephone number of the ISDN voice port (ISDN MSN number) 			<strong>lmsn</strong> (<em>text</em>) &#8211; msn pattern to listen on. It determines which calls from the ISDN line this voice port should answer. If left empty, <strong>msn</strong> is used 			<strong>autodial</strong> (<em>integer</em>; default: <strong>&#8220;&#8221;</strong>) &#8211; phone number which will be dialed immediately on each incoming ISDN call. If this number contains &#8216;m&#8217;, 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 &#8211; the line is picked up only after the remote party answers the call 			<strong>playback-volume</strong> (<em>integer</em>: -48..48; default: <strong>0</strong>) &#8211; playback volume in dB</p>
<div class="params"><strong>0</strong> &#8211; 0dB meand no change to signal level</div>
<p><strong>record-volume</strong> (<em>integer</em>: -48..48; default: <strong>0</strong>) &#8211; record volume in dB</p>
<div class="params"><strong>0</strong> &#8211; 0dB meand no change to signal level</div>
<p><strong>region</strong> (<em>name</em>; default: <strong>us</strong>) &#8211; 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 			<strong>aec</strong> (yes | no) &#8211; wheteher echo detection and cancellation is enabled 			<strong>aec-tail-length</strong> (short | medium | long; default: <strong>short</strong>) &#8211; size of the buffer of echo detection 			<strong>software-aec</strong> (yes | no) &#8211; software echo canceller (experimental, for most of the cards) 			<strong>agc-on-playback</strong> (yes | no; default: <strong>no</strong>) &#8211; automatic gain control on playback (can not be used together with hardware voice codecs) 			<strong>agc-on-record</strong> (yes | no; default: <strong>no</strong>) &#8211; automatic gain control on record (can not be used together with hardware voice codecs) 		 		<a name="7.45.7.3"></a></p>
<h3>Command Description</h3>
<p><strong>clear-call</strong> &#8211; terminate a current call established with the specified voice port</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em> (<em>name</em>) 					 &#8211; port name to clear call with</div>
<p><strong>show-stats</strong> &#8211; show voice port statistics</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em> (<em>name</em>) 					 &#8211; port name show statistics of 				<strong><span style="text-decoration:underline;">Return Values</span></strong><br />
<strong>round-trip-delay</strong> (<em>time</em>) 					 &#8211; maximal time of packet round trip<br />
<strong>packets-sent</strong> (<em>integer</em>) 					 &#8211; number of packets sent by this card (these packets are input of the voice port)<br />
<strong>bytes-sent</strong> (<em>integer</em>) 					 &#8211; number of bytes sent by this card (these packets are input of the voice port)<br />
<strong>sent-time</strong> (<em>text</em>) 					 &#8211; minimal/average/maximal intervals between packets sent<br />
<strong>packets-received</strong> (<em>integer</em>) 					 &#8211; number of packets received by this card (these packets form output of the voice port)<br />
<strong>bytes-sent</strong> (<em>integer</em>) 					 &#8211; number of bytes received by this card (these packets form output of the voice port)<br />
<strong>sent-time</strong> (<em>text</em>) 					 &#8211; minimal/average/maximal intervals between packets received<br />
<strong>average-jitter-delay</strong> (<em>time</em>)  &#8211; 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 &gt;40ms, then it is close (+/-1ms) to the actual delay time.</div>
<p><strong>monitor</strong> &#8211; monitor status of the voice port</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em> (<em>name</em>) 					 &#8211; port name to monitor 				<strong><span style="text-decoration:underline;">Return Values</span></strong><br />
<strong>status</strong> (on-hook | off-hook | ring | connection | busy) 					 &#8211; current state of the port:</p>
<li> <strong>on-hook</strong> &#8211; the handset is on-hook, no activity</li>
<li> <strong>off-hook</strong> &#8211; the handset is off-hook, the number is being dialed</li>
<li> <strong>ring</strong> &#8211; call in progress, direction of the call is shown by the <strong>direction</strong> property</li>
<li> <strong>connection</strong> &#8211; the connection has been established</li>
<li> <strong>busy</strong> &#8211; the connection has been terminated, the handset is still off-hook</li>
<p><strong>directiopn</strong> (ip-to-port | port-to-ip) 					 &#8211; direction of the call</p>
<li> <strong>ip-to-port</strong> &#8211; call from the IP network to the voice card</li>
<li> <strong>port-to-ip</strong> &#8211; call from the voice card to an IP address</li>
<p><strong>phone-number</strong> (<em>integer</em>) 					 &#8211; the phone number being dialed<br />
<strong>remote-party-name</strong> (<em>text</em>) 					 &#8211; name and IP address of the remote party<br />
<strong>codec</strong> (<em>name</em>) 					 &#8211; CODEC used for the audio connection<br />
<strong>duration</strong> (<em>time</em>) 					 &#8211; duration of the phone call</div>
<p><a name="7.45.7.4"></a></p>
<h3>Notes</h3>
<p><a name="7.45.7.4.1"></a></p>
<p>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.</p>
<p><a name="7.45.7.4.2"></a></p>
<div class="itemizedlist">
<p>There is a possibility to enter some special symbols in <strong>lmsn</strong> property. Meaning of the special symbols:</p>
<ul>
<li> <strong>;</strong> &#8211; separates pattern entries (more than one pattern can be specified this way)</li>
<li> <strong>?</strong> &#8211; matches one character</li>
<li> <strong>*</strong> &#8211; matches zero or more characters</li>
<li> <strong>[ ]</strong> &#8211; matches any single character from the set in brackets</li>
<li> <strong>[^ ]</strong> &#8211; matches any single character not from the set in brackets</li>
</ul>
</div>
<p><a name="7.45.8"></a></p>
<h2>Voice Port for Voice over IP (voip)</h2>
<p><a name="7.45.8.1"></a> Submenu level: <strong><em>/ip telephony voice-port voip</em></strong><br />
<a name="7.45.8.2"></a></p>
<h3>Description</h3>
<p>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.</p>
<p><a name="7.45.8.3"></a></p>
<h3>Property Description</h3>
<p><strong>name</strong> (<em>name</em>) &#8211; name given by the user or the default one 			<strong>remote-address</strong> (<em>IP address</em>; default: <strong>0.0.0.0</strong>) &#8211; 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</p>
<div class="params"><strong>0.0.0.0</strong> &#8211; the record with this IP address will specify the default values for an incomming call</div>
<p><strong>autodial</strong> (<em>integer</em>) &#8211; phone number which will be added in front of the telephone number received over the IP network. In most cases it should be blank 			<strong>jitter-buffer</strong> (<em>time</em>: 0..1000ms; default: <strong>100ms</strong>) &#8211; size of the jitter buffer</p>
<div class="params"><strong>0</strong> &#8211; the size of it is adjusted automatically during the conversation, to keep amount of lost packets under 1%</div>
<p><strong>silence-detection</strong> (yes | no; default: <strong>no</strong>) &#8211; whether silence is detected and no audio data is sent over the IP network during the silence period 			<strong>prefered-codec</strong> (<em>name</em>; default: <strong>none</strong>) &#8211; the preferred codec to be used for this voip voice port. If possible, the specified codec will be used</p>
<div class="params"><strong>none</strong> &#8211; there is no preferred codec defined for this port, so whichever codec advised by the remote peer will be used (if it is supported)</div>
<p><strong>fast-start</strong> (yes | no; default: <strong>yes</strong>) &#8211; 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 		 	 	<a name="7.45.9"></a></p>
<h2>Numbers</h2>
<p><a name="7.45.9.1"></a></p>
<h3>Description</h3>
<div class="itemizedlist">
<p>This is the so-called &#8220;routing table&#8221; for voice calls. This table assigns numbers to the voice ports.The main function of the numbers routing table is to determine:</p>
<ul>
<li> to which voice port route the call</li>
<li> what number to send over to the remote party</li>
</ul>
</div>
<p><a name="7.45.9.2"></a></p>
<h3>Property Description</h3>
<p><strong>dst-pattern</strong> (<em>integer</em>) &#8211; pattern of the telephone number. Symbol &#8216;.&#8217; designate any digit, symbol &#8216;_&#8217; (only as the last one) designate any symbols (i.e. any number of characters can follow, ended with &#8216;#&#8217; button) 			<strong>voice-port</strong> (<em>name</em>) &#8211; voice port to be used when calling the specified telephone number 			<strong>prefix</strong> (<em>integer</em>) &#8211; prefix, which will be used to substitute the known part of the <strong>dst-pattern</strong>, i.e., the part containing digits. The <strong>dst-pattern</strong> argument is used to determine which voice port to be used, whereas the <strong>prefix</strong> 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 		 		<a name="7.45.9.3"></a></p>
<h3>Notes</h3>
<p><a name="7.45.9.3.1"></a></p>
<p>More than one entry can be added with exactly the same <strong>dst-pattern</strong>. If first one of them is already busy, next one with the same <strong>dst-pattern</strong> is used. Telephony number entries can be moved, to select desired order.</p>
<p><a name="7.45.9.4"></a></p>
<h3>Example</h3>
<p>Let us consider the following example for the number table:</p>
<pre>[admin@MikroTik] ip telephony numbers&gt; 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&gt;</pre>
<p>We will analyze the Number Received (nr) &#8211; number dialed at the telephone, or received over the line, the Voice Port (vp) &#8211; voice port to be used for the call, and the Number to Call (nc) &#8211; number to be called over the Voice Port.</p>
<div class="itemizedlist">
<ul>
<li> If nr=55555, it does not match any of the destination patterns, therefore it is rejected</li>
<li> If nr=123456, it does not match any of the destination patterns, therefore it is rejected</li>
<li> If nr=1234, it does not match any of the destination patterns (incomplete for record #0), therefore it is rejected</li>
<li> If nr=12345, it matches the record #0, therefore number &#8220;&#8221; is dialed over the voice port XX</li>
<li> If nr=11111, it matches the record #1, therefore number &#8220;1&#8243; is dialed over the voice port YY</li>
<li> If nr=22987, it matches the record #2, therefore number &#8220;333987&#8243; is dialed over the voice port ZZ</li>
<li> If nr=22000, it matches the record #2, therefore number &#8220;333000&#8243; is dialed over the voice port ZZ</li>
<li> If nr=444, it matches the record #3, therefore number &#8220;55444&#8243; is dialed over the voice port QQ</li>
</ul>
</div>
<p>Let us add a few more records:</p>
<pre>[admin@MikroTik] ip telephony numbers&gt; 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&gt;</pre>
<div class="itemizedlist">
<ul>
<li> If nr=222 =&gt; the best match is the record #4 =&gt; nc=44444, vp=KK (note: the &#8216;best match&#8217; means that it has the most coinciding digits between the nr and destination pattern).</li>
<li> If nr=221 =&gt; incomplete record #2 =&gt; call is rejected</li>
<li> If nr=321 =&gt; the best match is the record #5 =&gt; nc=55321, vp=LL</li>
<li> If nr=421 =&gt; matches the record #3 =&gt; nc=55421, vp=QQ</li>
<li> If nr=335 =&gt; the best match is the record #5 =&gt; nc=55321, vp=LL</li>
</ul>
</div>
<p>Let us add a few more records:</p>
<pre>[admin@MikroTik] ip telephony numbers&gt; 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&gt;</pre>
<div class="itemizedlist">
<ul>
<li> If nr=335 =&gt; incomplete record #6 =&gt; the call is rejected. The nr=335 fits perfectly both the record #3 and #5. The #5 is chosen as the &#8216;best match&#8217; candidate at the moment. Furthermore, there is record #6, which has two matching digits (more than for #3 or #5). Therefore the #6 is chosen as the &#8216;best match&#8217;. However, the record #6 requires five digits, but the nr has only three. Two digits are missing, therefore the number is incomplete. Two additional digits would be needed to be entered on the dialpad. If the number is sent over from the network, it is rejected.</li>
<li> If nr=325 =&gt; matches the record #5 =&gt; nc=55325, vp=LL</li>
<li> If nr=33123 =&gt; matches the record #6 =&gt; nc=33123, vp=MM</li>
<li> If nr=123 =&gt; incomplete record #0 =&gt; call is rejected</li>
<li> If nr=111 =&gt; incomplete record #1 =&gt; call is rejected</li>
<li> If nr=112 =&gt; matches the record #7 =&gt; nc=77112, vp=NN</li>
<li> If nr=121 =&gt; matches the record #3 =&gt; nc=55121, vp=QQ</li>
</ul>
</div>
<p>It is impossible to add the following records:</p>
<pre>  #     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</pre>
<p><a name="7.45.10"></a></p>
<h2>Regional Settings</h2>
<p><a name="7.45.10.1"></a> Submenu level: <strong><em>/ip telephony region</em></strong><br />
<a name="7.45.10.2"></a></p>
<h3>Description</h3>
<p>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.</p>
<p><a name="7.45.10.3"></a></p>
<h3>Property Description</h3>
<p><strong>name</strong> (<em>name</em>) &#8211; name of the regional setting 			<strong>busy-tone-cadence</strong> (<em>integer</em>: 0..30000; default: <strong>500,500</strong>) &#8211; busy tone cadence in ms</p>
<div class="params"><strong>0</strong> &#8211; end of cadence</div>
<p><strong>busy-tone-frequency</strong> (<em>integer</em>: 20..2000<em>integer</em>: -24..6; default: <strong>440&#215;0</strong>) &#8211; frequency and volume gain of busy tone, Hz x dB 			<strong>data-access-arrangement</strong> (australia | france | germany | japan | uk | us; default: <strong>us</strong>) &#8211; ring voltage, impedance setting for line-jack card 			<strong>dial-tone-frequency</strong> (<em>integer</em>: 20..2000<em>integer</em>: -24..6; default: <strong>440&#215;0</strong>) &#8211; frequency and volume gain of dial tone, Hz x dB 			<strong>dtmf-tone-cadence</strong> (<em>integer</em>: 0..30000; default: <strong>180,60</strong>) &#8211; Dual Tone Multi Frequency tone cadence in ms</p>
<div class="params"><strong>0</strong> &#8211; end of cadence</div>
<p><strong>dtmf-tone-volume</strong> (<em>integer</em>: -24..6; default: <strong>-3,-3</strong>) &#8211; Dual Tone Multi Frequency tone volume in dB 			<strong>ring-tone-cadence</strong> (<em>integer</em>: 0..30000; default: <strong>1000,2000</strong>) &#8211; Ring tone cadence in ms</p>
<div class="params"><strong>0</strong> &#8211; end of cadence</div>
<p><strong>ring-tone-frequency</strong> (<em>integer</em>: 20..2000<em>integer</em>: -24..6; default: <strong>440&#215;0</strong>) &#8211; frequency and volume gain of busy tone, Hz x dB 		 		<a name="7.45.10.4"></a></p>
<h3>Notes</h3>
<p><a name="7.45.10.4.1"></a></p>
<p>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.</p>
<p><a name="7.45.10.4.2"></a></p>
<p>There are 10 pre-defined regions, which can not be deleted (but may be changed)</p>
<p><a name="7.45.11"></a></p>
<h2>Audio CODECs</h2>
<p><a name="7.45.11.1"></a> Submenu level: <strong><em>/ip telephony codec</em></strong><br />
<a name="7.45.11.2"></a></p>
<h3>Description</h3>
<p>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.</p>
<p>The hardware codecs (/hw) are built-in CODECs supported by some cards.</p>
<p>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.</p>
<p><a name="7.45.11.3"></a></p>
<h3>Example</h3>
<pre>[admin@MikroTik] ip telephony codec&gt; 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&gt;</pre>
<p><a name="7.45.12"></a></p>
<h2>AAA</h2>
<p><a name="7.45.12.1"></a> Submenu level: <strong><em>/ip telephony aaa</em></strong><br />
<a name="7.45.12.2"></a></p>
<h3>Description</h3>
<p>AAA (Authentication Authorization Accounting) can be used to configure the RADIUS accounting feature.</p>
<div class="itemizedlist">
<p>The contents of the CDR (Call Detail Record) are as follows:</p>
<ul>
<li> <strong>NAS-Identifier</strong> &#8211; router name (from <strong>/system identity print</strong>)</li>
<li> <strong>NAS-IP-Address</strong> &#8211; router&#8217;s local IP address which the connection was established to (if exist)</li>
<li> <strong>NAS-Port-Type</strong> &#8211; always <strong>Async</strong></li>
<li> <strong>Event-Timestamp</strong> &#8211; data and time of the event</li>
<li> <strong>Acct-Session-Time</strong> &#8211; current connection duration (only in INTERIM-UPDATE and STOP records)</li>
<li> <strong>Acct-Output-Packets</strong> &#8211; sent RTP (Real-Time Transport Protocol) packet count (only in INTERIM-UPDATE and STOP records)</li>
<li> <strong>Acct-Output-Packets</strong> &#8211; sent RTP (Real-Time Transport Protocol) packet count (only in INTERIM-UPDATE and STOP records)</li>
<li> <strong>Acct-Input-Packets</strong> &#8211; received RTP (Real-Time Transport Protocol) packet count (only in INTERIM-UPDATE and STOP records)</li>
<li> <strong>Acct-Output-Octets</strong> &#8211; sent byte count (only in INTERIM-UPDATE and STOP records)</li>
<li> <strong>Acct-Input-Octets</strong> &#8211; received byte count (only in INTERIM-UPDATE and STOP records)</li>
<li> <strong>Acct-Session-Id</strong> &#8211; unique session participient ID</li>
<li> <strong>h323-disconnect-cause</strong> &#8211; session disconnect reason (only in STOP records):</li>
<div class="itemizedlist">
<ul>
<li> <strong>0</strong> &#8211; Local endpoint application cleared call</li>
<li> <strong>1</strong> &#8211; Local endpoint did not accept call</li>
<li> <strong>2</strong> &#8211; Local endpoint declined to answer call</li>
<li> <strong>3</strong> &#8211; Remote endpoint application cleared call</li>
<li> <strong>4</strong> &#8211; Remote endpoint refused call</li>
<li> <strong>5</strong> &#8211; Remote endpoint did not answer in required time</li>
<li> <strong>6</strong> &#8211; Remote endpoint stopped calling</li>
<li> <strong>7</strong> &#8211; Transport error cleared call</li>
<li> <strong>8</strong> &#8211; Transport connection failed to establish call</li>
<li> <strong>9</strong> &#8211; Gatekeeper has cleared call</li>
<li> <strong>10</strong> &#8211; Call failed as could not find user (in GK)</li>
<li> <strong>11</strong> &#8211; Call failed as could not get enough bandwidth</li>
<li> <strong>12</strong> &#8211; Could not find common capabilities</li>
<li> <strong>13</strong> &#8211; Call was forwarded using FACILITY message</li>
<li> <strong>14</strong> &#8211; Call failed a security check and was ended</li>
<li> <strong>15</strong> &#8211; Local endpoint busy</li>
<li> <strong>16</strong> &#8211; Local endpoint congested</li>
<li> <strong>17</strong> &#8211; Remote endpoint busy</li>
<li> <strong>18</strong> &#8211; Remote endpoint congested</li>
<li> <strong>19</strong> &#8211; Could not reach the remote party</li>
<li> <strong>20</strong> &#8211; The remote party is not running an endpoint</li>
<li> <strong>21</strong> &#8211; The remote party host off line</li>
<li> <strong>22</strong> &#8211; The remote failed temporarily app may retry</li>
</ul>
</div>
<li> <strong>h323-disconnect-time</strong> &#8211; session disconnect time (only in INTERIM-UPDATE and STOP records)</li>
<li> <strong>h323-connect-time</strong> &#8211; session establish time (only in INTERIM-UPDATE and STOP records)</li>
<li> <strong>h323-gw-id</strong> &#8211; name of gateway emitting message (should be equal to <strong>NAS-Identifier</strong>)</li>
<li> <strong>h323-call-type</strong> &#8211; call leg type (should be <strong>VoIP</strong>)</li>
<li> <strong>h323-call-origin</strong> &#8211; indicates origin of call relatively to the gateway (<strong>answer</strong> for calls from IP network, <strong>originate</strong> &#8211; to IP network)</li>
<li> <strong>h323-setup-time</strong> &#8211; call setup time</li>
<li> <strong>h323-conf-id</strong> &#8211; unique session ID</li>
<li> <strong>h323-remote-address</strong> &#8211; the remote address of the session</li>
<li> <strong>NAS-Port-Id</strong> &#8211; voice port ID</li>
<li> <strong>Acct-Status-Type</strong> &#8211; record type (<strong>START</strong> when session is established; <strong>STOP</strong> when session is closed; <strong>INTERIM-UPDATE (ALIVE)</strong>session is alive). The time between the interim-update messages is defined by the <strong>interim-update-interval</strong> parameter (if it is set to <strong>0s</strong>, there will be no such messages)</li>
</ul>
</div>
<p><a name="7.45.12.3"></a></p>
<h3>Property Description</h3>
<p><strong>use-radius-accounting</strong> (yes | no; default: <strong>no</strong>) &#8211; whether to use radius accounting or not 			<strong>interim-update</strong> (<em>integer</em>; default: <strong>0</strong>) &#8211; 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</p>
<div class="params"><strong>0</strong> &#8211; no interim-update messages are sent at all</div>
<p><a name="7.45.12.4"></a></p>
<h3>Notes</h3>
<p><a name="7.45.12.4.1"></a></p>
<p>All the parameters, which names begin with <strong>h323</strong>, are CISCO vendor specific Radius attributes</p>
<p><a name="7.45.13"></a></p>
<h2>Gatekeeper</h2>
<p><a name="7.45.13.1"></a> Submenu level: <strong><em>/ip telephony gatekeeper</em></strong><br />
<a name="7.45.13.2"></a></p>
<h3>Description</h3>
<p>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.</p>
<p>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.</p>
<p>MikroTik IP telephony package includes a very simple gatekeeper. This gatekeeper can be activated by setting <strong>gatekeeper</strong> parameter to <strong>local</strong>. In this case the local endpoint automatically is registered to the local gatekeeper. And any other endpoint can register to this gatekeeper too.</p>
<p>Registered endpoints are added to the <strong>/ip telephony voice-port voip</strong> 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 &#8211; 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.</p>
<p>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.</p>
<p>Registered telephone numbers are added to <strong>/ip telephony numbers</strong> table. Here is exactly the same idea behind dynamic and registered telephone numbers as it is with voip voice ports.</p>
<p>When an endpoint registers to the gatekeeper, it sends its own telephone numbers (aliases and prefixes) within this registration request. <strong>/ip telephony numbers</strong> entry is registered to the endpoint only if voice-port for that entry is local (not voip). If <strong>dst-pattern</strong> contains &#8216;.&#8217; or &#8216;_&#8217;, it is sent as prefix, otherwise &#8211; as alias. The known part of the <strong>dst-pattern</strong> is sent as prefix. If there is no known part (<strong>dst-pattern</strong> is &#8220;_&#8221; or &#8220;&#8230;&#8221;, for example), then this entry is not sent at all.</p>
<p><a name="7.45.13.3"></a></p>
<h3>Property Description</h3>
<p><strong>gatekeeper</strong> (none | local | remote; default: <strong>none</strong>) &#8211; Gatekeeper type to use</p>
<div class="params"><strong>none</strong> &#8211; don&#8217;t use any gatekeeper at all<br />
<strong>local</strong> &#8211; start and use local gatekeeper<br />
<strong>remote</strong> &#8211; use some other gatekeeper</div>
<p><strong>remote-address</strong> (<em>IP address</em>; default: <strong>0.0.0.0</strong>) &#8211; IP address of remote gatekeeper to use. If set to <strong>0.0.0.0</strong>, broadcast gatekeeper discovery is used 			<strong>remote-id</strong> (<em>name</em>) &#8211; 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 			<strong>registered</strong> (<em>read-only: </em>yes | no) &#8211; shows whether local H.323 endpoint is registered to any gatekeeper 			<strong>registered-with</strong> (<em>read-only: </em><em>name</em>) &#8211; name of gatekeeper to which local H.323 endpoint is registered 		 		<a name="7.45.13.4"></a></p>
<h3>Example</h3>
<p>In most simple case with one phonejack card and some remote gatekeeper, configuration can be as follows:</p>
<pre>[admin@MikroTik] ip telephony voice-port&gt; print
Flags: X - disabled
  #   NAME                          TYPE            AUTODIAL
  0   phonejack1                phonejack
  1   voip1                         voip

[admin@MikroTik] ip telephony voice-port voip&gt; 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&gt; 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&gt; print
         gatekeeper: remote
          remote-id: ""
     remote-address: 10.0.0.98
         registered: yes
    registered-with: "MikroTik@10.0.0.98"</pre>
<p>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.</p>
<p><a name="7.45.13.5"></a></p>
<h3>Example</h3>
<p>For example, if numbers table is like this:</p>
<pre>[admin@MikroTik] ip telephony numbers&gt; 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</pre>
<p>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 &#8211; as alias 77, and entry 4 &#8211; as alias 76.</p>
<p>If IP address of local endpoint is 10.0.0.100, then gatekeeper voip and numbers tables will look as follows:</p>
<pre>      [admin@MikroTik] ip telephony voice-port voip&gt; 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&gt; 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</pre>
<p>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.</p>
<p>For prefixes, &#8216;_&#8217; is added at the end of dst-pattern to allow any additional digits to be added at the end.</p>
<p>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.</p>
<p>If any registered telephone number will conflict with some existing telephone numbers entry, it will be added as disabled and dynamic.</p>
<p>If in gatekeeper&#8217;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.</p>
<p><a name="7.45.14"></a></p>
<h2>Troubleshooting</h2>
<p><a name="7.45.14.1"></a></p>
<h3>Description</h3>
<div class="itemizedlist">
<ul>
<li> <strong>The IP Telephony does not work after upgrading from 2.5.x version</strong> &#8211; You need to completely reinstall the router using any installation procedure. You may keep the configuration using either the installation program option or the backup file.</li>
<li> <strong>The IP Telephony gateway does not detect the drop of the line when connected to some PBXs</strong> &#8211; Different regional setting should be used to match the parameters of the PBX. For example, try using <strong>uk</strong> for Meridian PBX.</li>
<li> <strong>The IP Telephone does not call the gateway, but gives busy signal</strong> &#8211; Enable the logging of IP telephony events under <strong>/system logging facility</strong>. Use the monitoring function for voice ports to debug your setup while making calls.</li>
<li> <strong>The IP telephony is working without NAT, but sound goes only in one direction</strong> &#8211; Disable H323 service port in firewall: <strong>/ip firewall service-port set h323 disabled=yes</strong></li>
<li> <strong>The IP Telephony does not work through NAT</strong> &#8211; Enable H323 service port in firewall: <strong>/ip firewall service-port set h323 disabled=no</strong></li>
</ul>
</div>
<p><a name="7.45.15"></a></p>
<h2>A simple example</h2>
<p><a name="7.45.15.1"></a></p>
<h3>Description</h3>
<p>The following describes examples of some useful IP telephony applications using MikroTik RouterOS.</p>
<p>Let us consider the following example of IP telephony gateway, one MikroTik IP telephone, and one Welltech LAN Phone 101 setup:</p>
<p><img src="http://www.mikrotik.com/testdocs/ros/2.9/img/1.jpg" alt="" /></p>
<p><a name="7.45.15.2"></a></p>
<h3>Setting up the MikroTik IP Telephone</h3>
<p>If you pick up the handset, a dialtone should be heard.</p>
<div class="itemizedlist">
<p>The basic telephony configuration should be as follows:</p>
<ul>
<li>Add a voip voice port to the <strong>/ip telephony voice-port voip</strong> for each of the devices you want to call, or want to receive calls from, i.e., (the IP telephony gateway 10.1.1.12 and the Welltech IP telephone 10.5.8.2):
<pre>[admin@Joe] ip telephony voice-port voip&gt; add name=gw remote-address=10.1.1.12
[admin@Joe] ip telephony voice-port voip&gt; add name=rob remote-address=10.5.8.2
[admin@Joe] ip telephony voice-port voip&gt; print
Flags: X - disabled, D - dynamic, R - registered
  #    NAME      AUTODIAL REMOTE-ADDRESS  JITTER-BUFFER PREFERED-CODEC  SIL FAS
  0    gw                 10.1.1.12       100ms         none            no  yes
  1    rob                10.5.8.2        100ms         none            no  yes
[admin@Joe] ip telephony voice-port voip&gt;</pre>
<p>You should have three vioce ports now:</p>
<pre>[admin@Joe] ip telephony voice-port&gt; print
Flags: X - disabled
  #   NAME                          TYPE           AUTODIAL
  0   linejack1                     linejack
  1   gw                            voip
  2   rob                           voip
[admin@Joe] ip telephony voice-port&gt;</pre>
</li>
<li>Add at least one unique number to the <strong>/ip telephony numbers</strong> for each voice port. This number will be used to call that port:
<pre>[admin@Joe] ip telephony numbers&gt; add dst-pattern=31 voice-port=rob
[admin@Joe] ip telephony numbers&gt; add dst-pattern=33 voice-port=linejack1
[admin@Joe] ip telephony numbers&gt; add dst-pattern=1. voice-port=gw prefix=1
[admin@Joe] ip telephony numbers&gt; print
Flags: I - invalid, X - disabled, D - dynamic, R - registered
  #     DST-PATTERN             VOICE-PORT              PREFIX
  0     31                          rob                 31
  1     33                          linejack1
  2     1.                          gw                  1
[admin@Joe] ip telephony numbers&gt;</pre>
<p>Here, the <strong>dst-pattern=31</strong> is to call the Welltech IP Telephone, if the number 31 is dialed on the dialpad. The <strong>dst-pattern=33</strong> is to ring the local telephone, if a call for number 33 is received over the network. Anything starting with digit &#8217;1&#8242; would be sent over to the IP Telephony gateway.</li>
</ul>
</div>
<div class="itemizedlist">
<p>Making calls from the IP telephone 10.0.0.224:</p>
<ul>
<li> To call the IP telephone 10.5.8.2, it is enough to lift the handset and dial the number 31</li>
<li>To call the PBX extension 13, it is enough to lift the handset and dial the number 13After establishing the connection with 13, the voice port monitor shows:
<pre>[admin@Joe] ip telephony voice-port linejack&gt; 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.3k/hw
             duration: 16s

[admin@Joe] ip telephony voice-port linejack&gt;</pre>
</li>
</ul>
</div>
<p><a name="7.45.15.3"></a></p>
<h3>Setting up the IP Telephony Gateway</h3>
<p>The IP telephony gateway [voip_gw] requires the following configuration:</p>
<div class="itemizedlist">
<ul>
<li>Set the regional setting to match our PBX. The <strong>mikrotik</strong> region will be used in thisn example:
<pre>[admin@voip_gw] ip telephony voice-port linejack&gt; set linejack1 region=mikrotik
[admin@voip_gw] ip telephony voice-port linejack&gt; print
Flags: X - disabled
  0   name="linejack1" autodial="" region=mikrotik playback-volume=0
      record-volume=0 ring-cadence="++-++--- ++-++---" agc-on-playback=no
      agc-on-record=no aec=yes aec-tail-length=short aec-nlp-threshold=low
      aec-attenuation-scaling=4 aec-attenuation-boost=0 software-aec=no
      detect-cpt=yes

[admin@voip_gw] ip telephony voice-port linejack&gt;</pre>
</li>
<li>Add a voip voice port to the <strong>/ip telephony voice-port voip</strong> for each of the devices you want to call, or want to receive calls from, i.e., (the IP telephone 10.0.0.224 and the Welltech IP telephone 10.5.8.2):
<pre>[admin@voip_gw] ip telephony voice-port voip&gt; add name=joe \
\... remote-address=10.0.0.224
[admin@voip_gw] ip telephony voice-port voip&gt; add name=rob \
\... remote-address=10.5.8.2 prefered-codec=G.723.1-6.3k/hw
[admin@voip_gw] ip telephony voice-port voip&gt; print
Flags: X - disabled, D - dynamic, R - registered
  #    NAME      AUTODIAL REMOTE-ADDRESS  JITTER-BUFFER PREFERED-CODEC  SIL FAS
  0    joe                10.0.0.224      100ms         none            no yes
  1    rob                10.5.8.2        100ms         G.723.1-6.3k/hw no yes
[admin@voip_gw] ip telephony voice-port voip&gt;</pre>
</li>
<li>Add number records to the <strong>/ip telephony numbers</strong>, so you are able to make calls:
<pre>[admin@voip_gw] ip telephony numbers&gt; add dst-pattern=31 voice-port=rob prefix=31
[admin@voip_gw] ip telephony numbers&gt; add dst-pattern=33 voice-port=joe prefix=33
[admin@voip_gw] ip telephony numbers&gt; add dst-pattern=1. voice-port=linejack1 \
\... prefix=1
[admin@voip_gw] ip telephony numbers&gt; print
Flags: I - invalid, X - disabled, D - dynamic, R - registered
  #     DST-PATTERN             VOICE-PORT              PREFIX
  0     31                          rob                 31
  1     33                          joe                 33
  2     1.                          linejack1           1
[admin@voip_gw] ip telephony numbers&gt;</pre>
</li>
</ul>
</div>
<div class="itemizedlist">
<p>Making calls through the IP telephony gateway:</p>
<ul>
<li>To dial the IP telephone 10.0.0.224 from the office PBX line, the extension number 19 should be dialed, and, after the dial tone has been received, the number 33 should be entered. Thus, the telephone [Joe] is ringed.After establishing the voice connection with &#8217;33&#8242; (the call has been answered), the voice port monitor shows:
<pre>[admin@voip_gw] ip telephony voice-port linejack&gt; monitor linejack1
               status: connection
                 port: line
            direction: port-to-ip
          line-status: plugged
         phone-number: 33
    remote-party-name: linejack1 [10.0.0.224]
                codec: G.723.1-6.3k/hw
             duration: 1m46s

[admin@voip_gw] ip telephony voice-port linejack&gt;</pre>
</li>
<li> To dial the IP telephone 10.5.8.2 from the office PBX line, the extension number 19 should be dialed, and, after the dial tone has been received, the number 31 should be entered.</li>
</ul>
</div>
<p><a name="7.45.15."></a></p>
<h3>Setting up the Welltech IP Telephone</h3>
<p>Please follow the documentation from <a href="http://www.welltech.com.tw/" target="_new">www.welltech.com.tw</a> on how to set up the Welltech LAN Phone 101. Here we give just brief recommendations:</p>
<div class="orderedlist">
<ol type="1">
<li>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:
<pre>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$</pre>
</li>
<li>Check if you have the codecs arranged in the desired order:
<pre>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 &amp; CNG:
            G.723.1      : Off
    Echo canceller       : On
 JitterBuffer Min Delay  : 90
 JitterBuffer Max Delay  : 150
usr/config$</pre>
</li>
<li>Make sure you have set the H.323 operation mode to phone to phone (P2P), not gatekeeper (GK):
<pre>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$</pre>
</li>
<li>Add the gateway&#8217;s address to the phonebook:
<pre>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$</pre>
</li>
</ol>
</div>
<div class="itemizedlist">
<p>Making calls from the IP telephone 10.5.8.2:</p>
<ul>
<li> Just lift the handset and dial &#8217;11&#8242;, or &#8217;13&#8242; fo the PBX extensions.</li>
<li>Dial &#8217;33&#8242; for [Joe]. The call request will be sent to the gateway 10.1.1.12, where it will be forwarded to [Joe]. If you want to call [Joe] directly, add a phonebook record for it:
<pre>usr/config$ pbook -add name Joe ip 10.0.0.224 e164 33</pre>
</li>
</ul>
</div>
<p>Use the telephony logging feature on the gateway to debug your setup.</p>
<p><a name="7.45.15."></a></p>
<h3>Setting up MikroTik Router and CISCO Router</h3>
<p>Let&#8217;s try a different example.</p>
<p>Here are some hints on how to get working configuration for telephony calls between CISCO and MikroTik router.</p>
<div class="itemizedlist">
<p>Configuration on the MikroTik side</p>
<ul>
<li>G.729a codec MUST be disabled (otherwise connections are not possible at all!!!)
<pre>/ip telephony codec disable G.729A-8k/sw</pre>
</li>
<li>G.711-ALaw codec should not be used (in some cases there is no sound)
<pre>/ip telephony codec disable "G.711-ALaw-64k/sw G.711-ALaw-64k/hw"</pre>
</li>
<li>Fast start has to be used (otherwise no ring-back tone and problems with codec negotiation)
<pre>/ip telephony voice-port set cisco fast-start=yes</pre>
</li>
<li>Telephone number we want to call to must be sent to Cisco, for example
<pre>/ip telephony numbers add destination-pattern=101 voice-port=cisco prefix=101</pre>
</li>
<li>Telephone number, cisco will call us, must be assigned to some voice port, for example,
<pre>/ip telephony numbers add destination-pattern=098 voice-port=linejack</pre>
</li>
</ul>
</div>
<div class="itemizedlist">
<p>Configuration on the CISCO side:</p>
<ul>
<li>IP routing has to be enabled
<pre>ip routing</pre>
</li>
<li>Default values for fast start can be used:
<pre>voice service pots
    default h323 call start
    exit
voice service voip
    default h323 call start
    exit</pre>
</li>
<li>Enable opening of RTP streams:
<pre>voice rtp send-recv</pre>
</li>
<li>Assign some E.164 number for local telephone, for example, 101 to port 0/0
<pre>dial-peer voice 1 pots
    destination-pattern 101
    port 0/0
    exit</pre>
</li>
<li>create preferred codec listing:
<pre>voice class codec codec_class_number
    codec preference 1 g711ulaw
    codec preference 2 g723r63
    exit</pre>
<p>NOTE: g723r53 codec can be used, too</li>
<li>Tell, that some foreign E.164 telephone number can be reached by calling to some IP address, for example, 098 by calling to 10.0.0.98
<pre>dial-peer voice 11 voip
    destination-pattern 098
    session target ipv4:10.0.0.98
    voice-class codec codec_class_number
    exit</pre>
<p>NOTE: instead of codec class, one specified codec could be specified:</p>
<pre>codec g711ulaw</pre>
</li>
</ul>
</div>
<p>For reference, following is an exported CISCO configuration, that works:</p>
<pre>!
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</pre>
<p><a name="7.45.15."></a></p>
<h3>Setting up PBX to PBX Connection over an IP Network</h3>
<p>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:</p>
<p><img src="http://www.mikrotik.com/testdocs/ros/2.9/img/2.jpg" alt="" /></p>
<p>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.</p>
<div class="itemizedlist">
<p>Assume that:</p>
<ul>
<li> The IP telephony gateway #1 has IP address 10.0.0.182, and the name of the Voicetronix first line is &#8216;vctx1&#8242;.</li>
<li> The IP telephony gateway #2 has IP address 10.0.0.183, and the name of the Voicetronix first line is &#8216;vctx1&#8242;.</li>
</ul>
</div>
<div class="itemizedlist">
<p>The IP telephony configuration should be as follows:</p>
<ul>
<li>IP telephony gateway #1 should have:
<pre>/ip telephony voice-port voip
add name=gw2 remote-address=10.0.0.183
/ip telephony numbers
add dst-pattern=1.. voice-port=gw2 prefix=2
add dst-pattern=2.. voice-port=vctx1 prefix=1</pre>
</li>
<li>IP telephony gateway #2 should have
<pre>/ip telephony voice-port voip
add name=gw1 remote-address=10.0.0.182
/ip telephony numbers
add dst-pattern=2.. voice-port=vctx1 prefix=1
add dst-pattern=1.. voice-port=gw1 prefix=2</pre>
</li>
</ul>
</div>
<p>The system works as follows:</p>
<p>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.</p>
<p>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.</p>
<p>©</p>
<br />Posted in Uncategorized Tagged: IP Telephony <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/telogodog.wordpress.com/524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/telogodog.wordpress.com/524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/telogodog.wordpress.com/524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/telogodog.wordpress.com/524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/telogodog.wordpress.com/524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/telogodog.wordpress.com/524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/telogodog.wordpress.com/524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/telogodog.wordpress.com/524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/telogodog.wordpress.com/524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/telogodog.wordpress.com/524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/telogodog.wordpress.com/524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/telogodog.wordpress.com/524/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/telogodog.wordpress.com/524/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/telogodog.wordpress.com/524/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=telogodog.wordpress.com&amp;blog=6674117&amp;post=524&amp;subd=telogodog&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://telogodog.wordpress.com/2009/03/29/ip-telephony/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/497bf9708054bf3707509276e2eeac68?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">telogodog</media:title>
		</media:content>

		<media:content url="http://www.mikrotik.com/testdocs/ros/2.9/img/1.jpg" medium="image" />

		<media:content url="http://www.mikrotik.com/testdocs/ros/2.9/img/2.jpg" medium="image" />
	</item>
		<item>
		<title>Traffic Monitor</title>
		<link>http://telogodog.wordpress.com/2009/03/29/traffic-monitor/</link>
		<comments>http://telogodog.wordpress.com/2009/03/29/traffic-monitor/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 04:05:39 +0000</pubDate>
		<dc:creator>telogodog</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://telogodog.wordpress.com/?p=520</guid>
		<description><![CDATA[Bahasa Indonesia Traffic monitor executes scripts on a specific datarate throough an interface. Specifications Packages required: advanced-tools License required: Level1 Submenu level: /tool traffic-monitor Standards and Technologies: none Hardware usage: Not significant Related Documents Software Package Management Scripting Host Traffic Monitor Submenu level: /tool traffic-monitor Description The traffic monitor tool is used to execute console [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=telogodog.wordpress.com&amp;blog=6674117&amp;post=520&amp;subd=telogodog&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span id="more-520"></span></p>
<p><a title="Indonesian" href="http://translate.google.com/translate?hl=id&amp;langpair=en%7Cid&amp;u=http://telogodog.wordpress.com/2009/03/29/traffic-monitor/"><strong>Bahasa Indonesia</strong></a></p>
<p>Traffic monitor executes scripts on a specific datarate throough an interface.</p>
<p><a name="2.170.1.1"></a></p>
<h3>Specifications</h3>
<p>Packages required: <strong><em>advanced-tools</em></strong><br />
License required: <em>Level1</em><br />
Submenu level: <strong><em>/tool traffic-monitor</em></strong><br />
Standards and Technologies: none<br />
Hardware usage: <em>Not significant</em><br />
<a name="2.170.1.3"></a></p>
<h3>Related Documents</h3>
<div class="itemizedlist">
<ul>
<li> <a href="http://www.mikrotik.com/testdocs/ros/2.9/guide/packages.php" target="_top">Software Package Management</a></li>
<li> <a href="http://www.mikrotik.com/testdocs/ros/2.9/system/scripting.php" target="_top">Scripting Host</a></li>
</ul>
</div>
<p><a name="2.170.2"></a></p>
<h2>Traffic Monitor</h2>
<p><a name="2.170.2.1"></a> Submenu level: <strong><em>/tool traffic-monitor</em></strong><br />
<a name="2.170.2.2"></a></p>
<h3>Description</h3>
<p>The traffic monitor tool is used to execute console scripts when interface traffic crosses a given threshold. Each item in traffic monitor list consists of its name (which is useful if you want to disable or change properties of this item from another script), some parameters, specifying traffic condition, and the pointer to a script or scheduled event to execute when this condition is met.</p>
<p><a name="2.170.2.3"></a></p>
<h3>Property Description</h3>
<p><strong>interface</strong> (<em>name</em>) &#8211; interface to monitor<strong>name</strong> (<em>name</em>) &#8211; name of the traffic monitor item<strong>on-event</strong> (<em>name</em>) &#8211; script source. Must be present under <strong>/system script</strong> <strong>threshold</strong> (<em>integer</em>; default: <strong>0</strong>) &#8211; traffic threshold<strong>traffic</strong> (transmitted | received; default: <strong>transmitted</strong>) &#8211; type of traffic to monitor</p>
<div class="params"><strong>transmitted</strong> &#8211; transmitted traffic<br />
<strong>received</strong> &#8211; received traffic</div>
<p><strong>trigger</strong> (above | always | below; default: <strong>above</strong>) &#8211; condition on which to execute the script</p>
<div class="params"><strong>above</strong> &#8211; the script will be run each time the traffic exceeds the threshold<br />
<strong>always</strong> &#8211; triggers scripts on both &#8211; <strong>above</strong> and <strong>below</strong> condition<br />
<strong>below</strong> &#8211; triggers script in the opposite condition, when traffic reaches a value that is lower than the threshold</div>
<p><a name="2.170.2.4"></a></p>
<h3>Example</h3>
<p>In this example the traffic monitor enables the interface ether2, if the received treffic exceeds 15kbps on ether1, and disables the interface ether2, if the received traffic falls below 12kbps on ether1.</p>
<pre>[admin@MikroTik] system script&gt; add name=eth-up source={/interface enable ether2}
[admin@MikroTik] system script&gt; add name=eth-down source={/interface disable
{... ether2}
[admin@MikroTik] system script&gt; /tool traffic-monitor
[admin@MikroTik] tool traffic-monitor&gt; add name=turn_on interface=ether1 \
\... on-event=eth-up threshold=15000 trigger=above traffic=received
[admin@MikroTik] tool traffic-monitor&gt; add name=turn_off interface=ether1 \
\... on-event=eth-down threshold=12000 trigger=below traffic=received
[admin@MikroTik] tool traffic-monitor&gt; print
Flags: X - disabled, I - invalid
  #   NAME           INTERFACE     TRAFFIC     TRIGGER THRESHOLD  ON-EVENT
  0   turn_on        ether1        received    above   15000      eth-up
  1   turn_off       ether1        received    below   12000      eth-down
[admin@MikroTik] tool traffic-monitor&gt;</pre>
<p>©</p>
<br />Posted in Uncategorized  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/telogodog.wordpress.com/520/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/telogodog.wordpress.com/520/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/telogodog.wordpress.com/520/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/telogodog.wordpress.com/520/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/telogodog.wordpress.com/520/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/telogodog.wordpress.com/520/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/telogodog.wordpress.com/520/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/telogodog.wordpress.com/520/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/telogodog.wordpress.com/520/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/telogodog.wordpress.com/520/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/telogodog.wordpress.com/520/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/telogodog.wordpress.com/520/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/telogodog.wordpress.com/520/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/telogodog.wordpress.com/520/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=telogodog.wordpress.com&amp;blog=6674117&amp;post=520&amp;subd=telogodog&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://telogodog.wordpress.com/2009/03/29/traffic-monitor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/497bf9708054bf3707509276e2eeac68?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">telogodog</media:title>
		</media:content>
	</item>
		<item>
		<title>Scheduler</title>
		<link>http://telogodog.wordpress.com/2009/03/29/scheduler/</link>
		<comments>http://telogodog.wordpress.com/2009/03/29/scheduler/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 04:03:08 +0000</pubDate>
		<dc:creator>telogodog</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Scheduler]]></category>

		<guid isPermaLink="false">http://telogodog.wordpress.com/?p=517</guid>
		<description><![CDATA[Bahasa Indonesia System Scheduler executes scripts at designated time. Specifications Packages required: system License required: Level1 Submenu level: /system scheduler Standards and Technologies: None Hardware usage: Not significant Related Documents Package Management Scripting Examples Scripting Examples Scheduler Configuration Description The scheduler can trigger script execution at a particular time moment, after a specified time interval, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=telogodog.wordpress.com&amp;blog=6674117&amp;post=517&amp;subd=telogodog&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span id="more-517"></span></p>
<p><a title="Indonesian" href="http://translate.google.com/translate?hl=id&amp;langpair=en%7Cid&amp;u=http://telogodog.wordpress.com/2009/03/29/scheduler/"><strong>Bahasa Indonesia</strong></a></p>
<p>System Scheduler executes scripts at designated time.</p>
<p><a name="2.70.1.2"></a></p>
<h3>Specifications</h3>
<p>Packages required: <strong><em>system</em></strong><br />
License required: <em>Level1</em><br />
Submenu level: <strong><em>/system scheduler</em></strong><br />
Standards and Technologies: None<br />
Hardware usage: <em>Not significant</em><br />
<a name="2.70.1.3"></a></p>
<h3>Related Documents</h3>
<div class="itemizedlist">
<ul>
<li> <a href="http://www.mikrotik.com/testdocs/ros/2.9/guide/packages.php" target="_top">Package Management</a></li>
<li> <a href="http://www.mikrotik.com/testdocs/ros/2.9/appex/scripting1.php" target="_top">Scripting Examples</a></li>
<li> <a href="http://www.mikrotik.com/testdocs/ros/2.9/system/scripting.php" target="_top">Scripting Examples</a></li>
</ul>
</div>
<p><a name="2.70.14"></a></p>
<h2>Scheduler Configuration</h2>
<p><a name="2.70.14.2"></a></p>
<h3>Description</h3>
<p>The scheduler can trigger script execution at a particular time moment, after a specified time interval, or both.</p>
<p><a name="2.70.14.3"></a></p>
<h3>Property Description</h3>
<p><strong>interval</strong> (<em>time</em>; default: <strong>0s</strong>) &#8211; interval between two script executions, if time <strong>interval</strong> is set to zero, the script is only executed at its start time, otherwise it is executed repeatedly at the time interval is specified 			<strong>name</strong> (<em>name</em>) &#8211; name of the task 			<strong>on-event</strong> (<em>name</em>) &#8211; name of the script to execute. It must be presented at <strong>/system script</strong> <strong>run-count</strong> (<em>read-only: </em><em>integer</em>) &#8211; to monitor script usage, this counter is incremented each time the script is executed 			<strong>start-date</strong> (<em>date</em>) &#8211; date of the first script execution 			<strong>start-time</strong> (<em>time</em>) &#8211; time of the first script execution</p>
<div class="params"><strong>startup</strong> &#8211; execute the script 3 seconds after the system startup.</div>
<p><a name="2.70.14.4"></a></p>
<h3>Notes</h3>
<p><a name="2.70.14.4.1"></a></p>
<p>Rebooting the router will reset <strong>run-count</strong> counter.</p>
<p><a name="2.70.14.4.2"></a></p>
<p>If more than one script has to be executed simultaneously, they are executed in the order they appear in the scheduler configuration. This can be important if one scheduled script is used to disable another one. The order of scripts can be changed with the <strong>move</strong> command.</p>
<p><a name="2.70.14.4.3"></a></p>
<p>If a more complex execution pattern is needed, it can usually be done by scheduling several scripts, and making them enable and disable each other.</p>
<p><a name="2.70.14.4."></a></p>
<p>if scheduler item has <strong>start-time</strong> set to <strong>startup</strong>, it behaves as if <strong>start-time</strong> and <strong>start-date</strong> were set to time 3 seconds after console starts up. It means that all scripts having <strong>start-time=startup</strong> and <strong>interval=0</strong> will be executed once each time router boots.</p>
<p><a name="2.70.14.5"></a></p>
<h3>Example</h3>
<p>We will add a task that executes the script <strong>log-test</strong> every hour:</p>
<pre>[admin@MikroTik] system script&gt; add name=log-test source=:log message=test
[admin@MikroTik] system script&gt; print
    0 name="log-test" source=":log messgae=test" owner=admin run-count=0
[admin@MikroTik] system script&gt; .. scheduler
[admin@MikroTik] system scheduler&gt; add name=run-1h interval=1h
on-event=log-test
[admin@MikroTik] system scheduler&gt; print

Flags: X - disabled
 #   NAME      ON-EVENT  START-DATE  START-TIME INTERVAL     RUN-COUNT
 0   run-1h    log-test  mar/30/2004 06:11:35   1h           0
[admin@MikroTik] system scheduler&gt;</pre>
<p>In another example there will be two scripts added that will change the bandwidth setting of a queue rule &#8220;Cust0&#8243;. Every day at 9AM the queue will be set to 64Kb/s and at 5PM the queue will be set to 128Kb/s. The queue rule, the scripts, and the scheduler tasks are below:</p>
<pre>[admin@MikroTik] queue simple&gt; add name=Cust0 interface=ether1 \
\... dst-address=192.168.0.0/24 limit-at=64000
[admin@MikroTik] queue simple&gt; print
Flags: X - disabled, I - invalid
  0   name="Cust0" target-address=0.0.0.0/0 dst-address=192.168.0.0/24
      interface=ether1 limit-at=64000 queue=default priority=8 bounded=yes

[admin@MikroTik] queue simple&gt; /system script
[admin@MikroTik] system script&gt; add name=start_limit source={/queue simple set \
\... Cust0 limit-at=64000}
[admin@MikroTik] system script&gt; add name=stop_limit source={/queue simple set \
\... Cust0 limit-at=128000}
[admin@MikroTik] system script&gt; print
  0 name="start_limit" source="/queue simple set Cust0 limit-at=64000"
    owner=admin run-count=0

  1 name="stop_limit" source="/queue simple set Cust0 limit-at=128000"
    owner=admin run-count=0

[admin@MikroTik] system script&gt; .. scheduler
[admin@MikroTik] system scheduler&gt; add interval=24h name="set-64k" \
\... start-time=9:00:00 on-event=start_limit
[admin@MikroTik] system scheduler&gt; add interval=24h name="set-128k" \
\... start-time=17:00:00 on-event=stop_limit
[admin@MikroTik] system scheduler&gt; print
Flags: X - disabled
  #   NAME      ON-EVENT START-DATE  START-TIME INTERVAL             RUN-COUNT
  0   set-64k   start... oct/30/2008 09:00:00   1d                   0
  1   set-128k  stop_... oct/30/2008 17:00:00   1d                   0
[admin@MikroTik] system scheduler&gt;</pre>
<p>The following example schedules a script that sends each week a backup of router configuration by e-mail.</p>
<pre>[admin@MikroTik] system script&gt; add name=e-backup source={/system backup
{... save name=email; /tool e-mail send to="root@host.com" subject=([/system
{... identity get name] . " Backup") file=email.backup}
[admin@MikroTik] system script&gt; print
  0 name="e-backup" source="/system backup save name=ema... owner=admin
    run-count=0

[admin@MikroTik] system script&gt; .. scheduler
[admin@MikroTik] system scheduler&gt; add interval=7d name="email-backup" \
\... on-event=e-backup
[admin@MikroTik] system scheduler&gt; print
Flags: X - disabled
  #   NAME      ON-EVENT START-DATE  START-TIME INTERVAL             RUN-COUNT
  0   email-... e-backup oct/30/2008 15:19:28   7d                   1
[admin@MikroTik] system scheduler&gt;</pre>
<p>Do not forget to set the e-mail settings, i.e., the SMTP server and From: address under <strong>/tool e-mail</strong>. For example:</p>
<pre>[admin@MikroTik] tool e-mail&gt; set server=159.148.147.198 from=SysAdmin@host.com
[admin@MikroTik] tool e-mail&gt; print
    server: 159.148.147.198
      from: SysAdmin@host.com
[admin@MikroTik] tool e-mail&gt;</pre>
<p>Example below will put &#8216;x&#8217; in logs each hour from midnight till noon:</p>
<pre>[admin@MikroTik] system script&gt; add name=enable-x source={/system scheduler
{... enable x}
[admin@MikroTik] system script&gt; add name=disable-x source={/system scheduler
{... disable x}
[admin@MikroTik] system script&gt; add name=log-x source={:log message=x}
[admin@MikroTik] system script&gt; .. scheduler
[admin@MikroTik] system scheduler&gt; add name=x-up start-time=00:00:00 \
\... interval=24h on-event=enable-x
[admin@MikroTik] system scheduler&gt; add name=x-down start-time=12:00:00
\... interval=24h on-event=disable-x
[admin@MikroTik] system scheduler&gt; add name=x start-time=00:00:00 interval=1h \
\... on-event=log-x
[admin@MikroTik] system scheduler&gt; print
Flags: X - disabled
  #   NAME      ON-EVENT START-DATE  START-TIME INTERVAL             RUN-COUNT
  0   x-up      enable-x oct/30/2008 00:00:00   1d                   0
  1   x-down    disab... oct/30/2008 12:00:00   1d                   0
  2   x         log-x    oct/30/2008 00:00:00   1h                   0
[admin@MikroTik] system scheduler&gt;</pre>
<p>©</p>
<br />Posted in Uncategorized Tagged: Scheduler <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/telogodog.wordpress.com/517/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/telogodog.wordpress.com/517/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/telogodog.wordpress.com/517/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/telogodog.wordpress.com/517/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/telogodog.wordpress.com/517/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/telogodog.wordpress.com/517/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/telogodog.wordpress.com/517/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/telogodog.wordpress.com/517/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/telogodog.wordpress.com/517/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/telogodog.wordpress.com/517/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/telogodog.wordpress.com/517/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/telogodog.wordpress.com/517/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/telogodog.wordpress.com/517/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/telogodog.wordpress.com/517/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=telogodog.wordpress.com&amp;blog=6674117&amp;post=517&amp;subd=telogodog&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://telogodog.wordpress.com/2009/03/29/scheduler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/497bf9708054bf3707509276e2eeac68?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">telogodog</media:title>
		</media:content>
	</item>
		<item>
		<title>Scripting Host</title>
		<link>http://telogodog.wordpress.com/2009/03/29/scripting-host/</link>
		<comments>http://telogodog.wordpress.com/2009/03/29/scripting-host/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 03:57:50 +0000</pubDate>
		<dc:creator>telogodog</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Scripting Host]]></category>

		<guid isPermaLink="false">http://telogodog.wordpress.com/?p=514</guid>
		<description><![CDATA[Bahasa Indonesia This manual provides introduction to RouterOS built-in powerful scripting language. Scripting host provides a way to automate some router maintenance tasks by means of executing user-defined scripts bounded to some event occurence. A script consists of configuration commands and expressions (ICE &#8211; internal console expression). The configuration commands are standard RouterOS commands, e.g. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=telogodog.wordpress.com&amp;blog=6674117&amp;post=514&amp;subd=telogodog&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span id="more-514"></span></p>
<p><a title="Indonesian" href="http://translate.google.com/translate?hl=id&amp;langpair=en%7Cid&amp;u=http://telogodog.wordpress.com/2009/03/29/scripting-host/"><strong>Bahasa Indonesia</strong></a></p>
<p>This manual provides introduction to RouterOS built-in powerful scripting language.</p>
<p>Scripting host provides a way to automate some router maintenance tasks by means of executing user-defined scripts bounded to some event occurence. A script consists of configuration commands and expressions (ICE &#8211; internal console expression). The configuration commands are standard RouterOS commands, e.g. <code>/ip firewall filter add chain=forward protocol=gre action=drop</code> that are described in the relevant manuals, while expressions are prefixed with <strong>:</strong> and are accessible from all submenus.</p>
<p>The events used to trigger script execution include, but are not limited to the System Scheduler, the Traffic Monitoring Tool, and the Netwatch Tool generated events.</p>
<p><a name="2.173.1.2"></a></p>
<h3>Specifications</h3>
<p>Packages required: <strong><em>system</em></strong><br />
License required: <em>Level1</em><br />
Submenu level: <strong><em>/system script</em></strong><br />
Standards and Technologies: None<br />
Hardware usage: <em>Not significant</em><br />
<a name="2.173.1.3"></a></p>
<h3>Related Documents</h3>
<div class="itemizedlist">
<ul>
<li> <a href="http://www.mikrotik.com/testdocs/ros/2.9/guide/packages.php" target="_top">Software Package Management</a></li>
<li> <a href="http://www.mikrotik.com/testdocs/ros/2.9/system/scheduler.php" target="_top">System Scheduler</a></li>
<li> <a href="http://www.mikrotik.com/testdocs/ros/2.9/tools/netwatch.php" target="_top">Network Monitor</a></li>
<li> <a href="http://www.mikrotik.com/testdocs/ros/2.9/tools/trafmon.php" target="_top">Traffic Monitor</a></li>
<li> <a href="http://www.mikrotik.com/testdocs/ros/2.9/tools/sigwatch.php" target="_top">Serial Port Monitor</a></li>
</ul>
</div>
<p><a name="2.173.2"></a></p>
<h2>Console Command Syntax</h2>
<p><a name="2.173.2.1"></a></p>
<h3>Description</h3>
<p>Console commands are made of the following parts, listed in the order you type them in console:</p>
<div class="itemizedlist">
<ul>
<li><strong>prefix</strong> &#8211; indicates whether the command is an ICE, like <strong>:</strong> in <code>:put</code> or that the command path starts from the root menu level, like <strong>/</strong> in
<pre>[admin@MikroTik] ip firewall mangle&gt; /ping 10.0.0.1</pre>
</li>
<li><strong>path</strong> &#8211; a relative path to the desired menu level, like <strong>.. filter</strong> in
<pre>[admin@MikroTik] ip firewall mangle&gt; .. filter print</pre>
</li>
<li><strong>path_args</strong> &#8211; this part is required to select some menu levels, where the actual path can vary across different user inputs, like <strong>mylist</strong> in
<pre>[admin@MikroTik] ip firewall mangle&gt; /routeing prefix-list list mylist</pre>
</li>
<li><strong>action</strong> &#8211; one of the actions available at the specified menu level, like <strong>add</strong> in
<pre>[admin@MikroTik] ip firewall mangle&gt; /ip firewall filter add chain=forward action=drop</pre>
</li>
<li><strong>unnamed parameter</strong> &#8211; these are required by some actions and should be entered in fixed order after the action name, like in <strong>10.0.0.1</strong> in
<pre>[admin@MikroTik] ip firewall mangle&gt; /ping 10.0.0.1</pre>
</li>
<li><strong>name[=value]</strong> &#8211; a sequence of parameter names followed by respective values, if required, like <strong>ssid=myssid</strong> in
<pre>/interface wireless set wlan1 ssid=myssid</pre>
</li>
</ul>
</div>
<p><a name="2.173.2.2"></a></p>
<h3>Notes</h3>
<p><a name="2.173.2.2.1"></a></p>
<p>Variable substitution, command substitution and expressions are allowed only for <strong>path_args</strong> and <strong>unnamed parameter</strong> values. <strong>prefix</strong>, <strong>path</strong>, <strong>action</strong> and <strong>name[=value]</strong> pairs can be given only directly, as a word. Therefore, <code>:put (1 + 2)</code> is valid and <code> <img src='http://s0.wp.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> "pu" . "t") 3</code> is not.</p>
<p><a name="2.173.2.3"></a></p>
<h3>Example</h3>
<p>The parts of internal console commands are futher explained in the following examples:</p>
<pre>/ping 10.0.0.1 count=5</pre>
<table border="1" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<td>prefix</td>
<td>/</td>
</tr>
<tr>
<td>action</td>
<td>ping</td>
</tr>
<tr>
<td>unnamed parameter</td>
<td>10.0.0.1</td>
</tr>
<tr>
<td>name[=value]</td>
<td>count=5</td>
</tr>
</tbody>
</table>
<pre>.. ip firewall rule input</pre>
<table border="1" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<td>path</td>
<td>.. ip firewall rule</td>
</tr>
<tr>
<td>path_args</td>
<td>input</td>
</tr>
</tbody>
</table>
<pre>:for i from=1 to=10 do={:put $i}</pre>
<table border="1" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<td>prefix</td>
<td>:</td>
</tr>
<tr>
<td>action</td>
<td>for</td>
</tr>
<tr>
<td>unnamed parameter</td>
<td>i</td>
</tr>
<tr>
<td>pname[=value]</td>
<td>from=1 to=10 do={:put $i}</td>
</tr>
</tbody>
</table>
<pre>/interface monitor-traffic ether1,ether2,ipip1</pre>
<table border="1" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<td>prefix</td>
<td>/</td>
</tr>
<tr>
<td>path</td>
<td>interface</td>
</tr>
<tr>
<td>action</td>
<td>monitor-traffic</td>
</tr>
<tr>
<td>unnamed parameter</td>
<td>ether1,ether2,ipip1</td>
</tr>
</tbody>
</table>
<p><a name="2.173.3"></a></p>
<h2>Expression Grouping</h2>
<p><a name="2.173.3.1"></a></p>
<h3>Description</h3>
<p>This feature provides an easy way to execute commands from within one command level, by enclosing them in braces &#8216;{ }&#8217;.</p>
<p><a name="2.173.3.2"></a></p>
<h3>Notes</h3>
<p><a name="2.173.3.2.1"></a></p>
<p>Subsequent script commands are executed from the same menu level as the entire script. Consider the following example:</p>
<pre>[admin@MikroTik] ip route&gt; /user {
{... /ip route
{... print}
Flags: X - disabled
 #   NAME                                                              GROUP ADDRESS
 0   ;;; system default user
     admin                                                             full  0.0.0.0/0
 1   uuu                                                               full  0.0.0.0/0
[admin@MikroTik] ip route&gt;</pre>
<p>Although the current command level is changed to <strong>/ip route</strong>, it has no effect on next commands entered from prompt, therefore <strong>print</strong> command is still considered to be <strong>/user print</strong>.</p>
<p><a name="2.173.3.3"></a></p>
<h3>Example</h3>
<p>The example below demonstrates how to add two users to the <strong>user</strong> menu.</p>
<pre>[admin@MikroTik] ip route&gt; /user {
{... add name=x password=y group=write
{... add name=y password=z group=read
{... print}
Flags: X - disabled
 #   NAME                                                      GROUP ADDRESS
 0   ;;; system default user
     admin                                                     full  0.0.0.0/0
 1   x                                                         write 0.0.0.0/0
 2   y                                                         read  0.0.0.0/0
[admin@MikroTik] ip route&gt;</pre>
<p><a name="2.173.4"></a></p>
<h2>Variables</h2>
<p><a name="2.173.4.1"></a></p>
<h3>Description</h3>
<p>RouterOS scripting language suports two types of variables, which are global (system wide) and local (accessible only within the current script), respectively. A variable can be referenced by &#8216;$&#8217; (dollar) sign followed by the name of the variable with the exception of <strong>set</strong> and <strong>unset</strong> commands that take variable name without preceding dollar sign. Variable names should be composed of contain letters, digits and &#8216;-&#8217; character. A variable must be declared prior to using it in scripts. There are four types of declaration available:</p>
<div class="itemizedlist">
<ul>
<li> <strong>global</strong> &#8211; defined by <strong>global</strong> keyword, global variables can be accessed by all scripts and console logins on the same router. However, global variables are not kept across reboots.</li>
<li> <strong>local</strong> &#8211; defined by <strong>local</strong> keyword, local variables are not shared with any other script, other instance of the same script or other console logins. The value of local variable value is lost when script finishes.</li>
<li> <strong>loop index variables</strong> &#8211; defined within <strong>for</strong> and <strong>foreach</strong> statements, these variables are used only in <strong>do</strong> block of commands and are removed after command completes.</li>
<li> <strong>monitor variables</strong> &#8211; some <strong>monitor</strong> commands that have <strong>do</strong> part can also introduce variables. You can obtain a list of available variables by placing <strong>:environment print</strong> statement inside the <strong>do</strong> block of commands.</li>
</ul>
</div>
<p>You can assign a new value to variable using <strong>set</strong> action. It takes two unnamed parameters: the name of the variable and the new value of the variable. If a variable is no longer needed, it&#8217;s name can be freed by <strong>:unset</strong> command. If you free local variable, it&#8217;s value is lost. If you free global variable, it&#8217;s value is still kept in router, it just becomes inaccessible from current script.</p>
<p><a name="2.173.4.2"></a></p>
<h3>Notes</h3>
<p><a name="2.173.4.2.1"></a></p>
<p>Loop variables &#8220;shadows&#8221; already introduced variables with the same name.</p>
<p><a name="2.173.4.3"></a></p>
<h3>Example</h3>
<pre>[admin@MikroTik] ip route&gt; /
[admin@MikroTik] &gt; :global g1 "this is global variable"
[admin@MikroTik] &gt; :put $g1
this is global variable
[admin@MikroTik] &gt;</pre>
<p><a name="2.173.5"></a></p>
<h2>Command Substitution and Return Values</h2>
<p><a name="2.173.5.1"></a></p>
<h3>Description</h3>
<p>Some console commands are most useful if their output can be feed to other commands as an argument value. In RouterOS console this is done by using the return values from commands. Return values are not displayed on the screen. To get the return value from a command, it should be enclosed in square brackets &#8216;[ ]&#8216;. Upon execution the return value of the the command will become the value of these brackets. This is called command substitution.</p>
<p>The commands that produce return values are, but not limited to: <strong>find</strong>, which returns a reference to a particular item, <strong>ping</strong>, which returns the number of sucessful pings, <strong>time</strong>, which returns the measured time value, <strong>incr</strong> and <strong>decr</strong>, which return the new value of a variable, and <strong>add</strong>, which returns the internal number of newly created item.</p>
<p><a name="2.173.5.2"></a></p>
<h3>Example</h3>
<p>Consider the usage of <strong>find</strong> command:</p>
<pre>[admin@MikroTik] &gt; /interface
[admin@MikroTik] interface&gt; find type=ether
[admin@MikroTik] interface&gt;
[admin@MikroTik] interface&gt; :put [find type=ether]
*1,*2
[admin@MikroTik] interface&gt;</pre>
<p>This way you can see internal console numbers of items. Naturally, you can use them as arguments in other commands:</p>
<pre>[admin@MikroTik] interface&gt; enable [find type=ether]
[admin@MikroTik] interface&gt;</pre>
<p><a name="2.173.6"></a></p>
<h2>Operators</h2>
<p><a name="2.173.6.1"></a></p>
<h3>Description</h3>
<p>RouterOS console can do simple calculations with numbers, time values, IP addresses, strings and lists. To get result from an expression with operators, enclose it in parentheses &#8216;(&#8216; and &#8216;)&#8217;. The expression result serves as a return value for the parentheses.</p>
<p><a name="2.173.6.2"></a></p>
<h3>Command Description</h3>
<p><strong>-</strong> &#8211; unary minus. Inverts given number value.<strong>-</strong> &#8211; binary minus. Substracts two numbers, two time values, two IP addresses or an IP address and a number<strong>!</strong> &#8211; logical <strong>NOT</strong>. Unary operator, which inverts given boolean value<strong>/</strong> &#8211; division. Binary operator. Divides one number by another (gives number) or a time value by a number (gives time value).<strong>.</strong> &#8211; concatenation. Binary operator, concatenates two string or append one list to another or appends an element to a list.<strong>^</strong> &#8211; bitwise <strong>XOR</strong>. The argumens and the result are both IP addresses<strong>~</strong> &#8211; bit inversion. Unary operator, which inverts bits in IP address<strong>*</strong> &#8211; multiplication. Binary operator, which can multiply two numbers or a time value by a number.<strong>&amp;</strong> &#8211; bitwise <strong>AND</strong> The argumens and the result are both IP addresses<strong>&amp;&amp;</strong> &#8211; logical <strong>AND</strong>. Binary operator. The argumens and the result are both logical values<strong>+</strong> &#8211; binary plus. Adds two numbers, two time values or a number and an IP address.<strong>&lt;</strong> &#8211; less. Binary operator which compares two numbers, two time values or two IP addresses. Returns boolean value<strong>&lt;&lt;</strong> &#8211; left shift. Binary operator, which shifts IP address by a given amount of bits. The first argument is an IP address, the second is an integer and the result is an IP address.<strong>&lt;=</strong> &#8211; less or equal. Binary operator which compares two numbers, two time values or two IP addresses. Returns boolean value<strong>&gt;</strong> &#8211; greater. Binary operator which compares two numbers, two time values or two IP addresses. Returns boolean value<strong>&gt;=</strong> &#8211; greater or equal. Binary operator which compares two numbers, two time values or two IP addresses. Returns boolean value<strong>&gt;&gt;</strong> &#8211; right shift. Binary operator, which shifts IP address by a given amount of bits. The first argument is an IP address, the second is an integer and the result is an IP address.<strong>|</strong> &#8211; bitwise <strong>OR</strong>. The argumens and the result are both IP addresses<strong>||</strong> &#8211;  logical <strong>OR</strong>. Binary operator. The argumens and the result are both logical values 			 			 			 			 			 			 			 			 			 			 			 			 			 			 			 			 			 			 		 		<a name="2.173.6.3"></a></p>
<h3>Notes</h3>
<p><a name="2.173.6.3.1"></a></p>
<p>When comparing two arrays note, that two arrays are equal only if their respective elements are equal.</p>
<p><a name="2.173.6.4"></a></p>
<h3>Example</h3>
<p>Operator priority and evaluation order</p>
<pre>[admin@MikroTik] ip firewall rule forward&gt; :put (10+1-6*2=11-12=2+(-3)=-1)
false
[admin@MikroTik] ip firewall rule forward&gt; :put (10+1-6*2=11-12=(2+(-3)=-1))
true
[admin@MikroTik] ip firewall rule forward</pre>
<p>logical NOT</p>
<pre>[admin@MikroTik] interface&gt; :put (!true)
false
[admin@MikroTik] interface&gt; :put (!(2&gt;3))
true
[admin@MikroTik] interface&gt;</pre>
<p>unary minus</p>
<pre>[admin@MikroTik] interface&gt; :put (-1&lt;0)
true
[admin@MikroTik] &gt;
1</pre>
<p>bit inversion</p>
<pre>[admin@MikroTik] interface&gt; :put (~255.255.0.0)
0.0.255.255
[admin@MikroTik] interface&gt;</pre>
<p>sum</p>
<pre>[admin@MikroTik] interface&gt; :put (3ms + 5s)
00:00:05.003
[admin@MikroTik] interface&gt; :put (10.0.0.15 + 0.0.10.0)
cannot add ip address to ip address
[admin@MikroTik] interface&gt; :put (10.0.0.15 + 10)
10.0.0.25
[admin@MikroTik] interface&gt;</pre>
<p>subtraction</p>
<pre>[admin@MikroTik] interface&gt; :put (15 - 10)
5
[admin@MikroTik] interface&gt; :put (10.0.0.15 - 10.0.0.3)
12
[admin@MikroTik] interface&gt; :put (10.0.0.15 - 12)
10.0.0.3
[admin@MikroTik] interface&gt; :put (15h - 2s)
14:59:58
[admin@MikroTik] interface&gt;</pre>
<p>multiplication</p>
<pre>[admin@MikroTik] interface&gt; :put (12s * 4)
00:00:48
[admin@MikroTik] interface&gt; :put (-5 * -2)
10
[admin@MikroTik] interface&gt;</pre>
<p>division</p>
<pre>[admin@MikroTik] interface&gt; :put (10s / 3)
00:00:03.333
[admin@MikroTik] interface&gt; :put (5 / 2)
2
[admin@MikroTik] interface&gt;
[admin@MikroTik] &gt; :put (0:0.10 / 3)
00:00:02
[admin@MikroTik] &gt;</pre>
<p>comparison</p>
<pre>[admin@MikroTik] interface&gt; :put (10.0.2.3&lt;=2.0.3.10)
false
[admin@MikroTik] interface&gt; :put (100000s&gt;27h)
true
[admin@MikroTik] interface&gt; :put (60s,1d!=1m,3600s)
true
[admin@MikroTik] interface&gt; :put (bridge=routing)
false
[admin@MikroTik] interface&gt; :put (yes=false)
false
[admin@MikroTik] interface&gt; :put (true=aye)
false
[admin@MikroTik] interface&gt;</pre>
<p>logical AND, logical OR</p>
<pre>[admin@MikroTik] interface&gt; :put ((yes &amp;&amp; yes) || (yes &amp;&amp; no))
true
[admin@MikroTik] interface&gt; :put ((no || no) &amp;&amp; (no || yes))
false
[admin@MikroTik] interface&gt;</pre>
<p>bitwise AND, bitwise OR, bitwise XOR</p>
<pre>[admin@MikroTik] interface&gt; :put (10.16.0.134 &amp; ~255.255.255.0)
0.0.0.134
[admin@MikroTik] interface&gt;</pre>
<p>shift operators</p>
<pre>[admin@MikroTik] interface&gt; :put (~((0.0.0.1 &lt;&lt; 7) - 1))
255.255.255.128
[admin@MikroTik] interface&gt;</pre>
<p>Concatenation</p>
<pre>[admin@MikroTik] interface&gt; :put (1 . 3)
13
[admin@MikroTik] interface&gt; :put (1,2 . 3)
1,2,3
[admin@MikroTik] interface&gt; :put (1 . 3,4)
13,4
[admin@MikroTik] interface&gt; :put (1,2 . 3,4)
1,2,3,4
[admin@MikroTik] interface&gt; :put ((1 . 3) + 1)
14
[admin@MikroTik] interface&gt;</pre>
<p><a name="2.173.7"></a></p>
<h2>Data types</h2>
<p><a name="2.173.7.1"></a></p>
<h3>Description</h3>
<p>The RouterOS console differentiates between several data types, which are string, boolean, number, time interval, IP address, internal number and list. The console tries to convert any value to the most specific type first, backing if it fails. The order in which the console attempts to convert an entered value is presented below:</p>
<div class="itemizedlist">
<ul>
<li> list</li>
<li> internal number</li>
<li> number</li>
<li> IP address</li>
<li> time</li>
<li> boolean</li>
<li> string</li>
</ul>
</div>
<p>Internal scripting language supplies special functions to explicitly control type conversion. The <strong>toarray</strong>, <strong>tobool</strong>, <strong>toid</strong>, <strong>toip</strong>, <strong>tonum</strong>, <strong>tostr</strong> and <strong>totime</strong> functions convert a value accordingly to <strong>list</strong>, <strong>boolean</strong>, <strong>internal number</strong>, <strong>IP address</strong>, <strong>number</strong>, <strong>string</strong> or <strong>time</strong>.</p>
<p>The number type is internally represented as 64 bit signed integer, so the value a number type variable can take is in range from -9223372036854775808 to 9223372036854775807. It is possible to input number value in hexadecimal form, by prefixing it with <strong>0x</strong>, e.g.:</p>
<pre>[admin@MikroTik] &gt; :global MyVar 0x10
[admin@MikroTik] &gt; :put $MyVar
16
[admin@MikroTik] &gt;</pre>
<p>Lists are treated as comma separated sequence of values. Putting whitespaces around commas is not recommended, because it might confuse console about words&#8217; boundaries.</p>
<p>Boolean values can be either <strong>true</strong> or <strong>false</strong>. Console also accepts <strong>yes</strong> for <strong>true</strong>, and <strong>no</strong> for <strong>false</strong>.</p>
<p>Internal numbers are preceided <strong>*</strong> sign.</p>
<p>Time intervals can be entered either using  HH:MM:SS.MS notation, e.g.:</p>
<pre>[admin@MikroTik] &gt; :put 01:12:1.01
01:12:01.010
[admin@MikroTik] &gt;</pre>
<p>or as sequence of numbers, optionally followed by letters specifying the units of time measure (<strong>d</strong> dor days, <strong>h</strong> for hours, <strong>m</strong> for minutes, <strong>s</strong> for seconds and <strong>ms</strong> for milliseconds), e.g.:</p>
<pre>[admin@MikroTik] &gt; :put 2d11h12
2d11:00:12
[admin@MikroTik] &gt;</pre>
<p>As can bee seen, time values with omitted unit specificators are treated as expressed in seconds.</p>
<div class="itemizedlist">
<p>Possible aliases for time units:</p>
<ul>
<li> <strong>d, day, days</strong> &#8211; one day, or 24 hours</li>
<li> <strong>h, hour, hours</strong> &#8211; one hour</li>
<li> <strong>m, min</strong> &#8211; one minute</li>
<li> <strong>s</strong> &#8211; one second</li>
<li> <strong>ms</strong> &#8211; one millisecond, <em>id est</em> 0.001 second</li>
</ul>
</div>
<p>The console also accepts time values with decimal point:</p>
<pre>[admin@MikroTik] &gt; :put 0.1day1.2s
02:24:01.200
[admin@MikroTik] &gt;</pre>
<p><a name="2.173.8"></a></p>
<h2>Command Reference</h2>
<p><a name="2.173.8.1"></a></p>
<h3>Description</h3>
<p>RouterOS has a number of built-in console commands and expressions (ICE) that do not depend on the current menu level. These commands do not change configuration directly, but they are useful for automating various maintenance tasks. The full ICE list can be accessed by typing &#8216;?&#8217; after the &#8216;:&#8217; prefix (therefore it can be safely assumed that all ICE have &#8216;:&#8217; prefix), for example:</p>
<pre>[admin@MikroTik] &gt; :
beep         execute  global  list     pick     time     toip    typeof
delay        find     if      local    put      toarray  tonum   while
do           for      led     log      resolve  tobool   tostr
environment  foreach  len     nothing  set      toid     totime
[admin@MikroTik] &gt;</pre>
<p><a name="2.173.8.2"></a></p>
<h3>Command Description</h3>
<p><strong>beep</strong> &#8211; forces the built-in PC beeper to produce a signal for <strong>length</strong> seconds at <strong>frequency</strong> Hz.</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<strong>frequency</strong> (<em>integer</em>; default: <strong>1000</strong>) 					 &#8211; signal frequency measured in Hz<br />
<strong>length</strong> (<em>time</em>; default: <strong>100ms</strong>) 					 &#8211; signal length</div>
<div class="example">
<pre>[admin@MikroTik] &gt; :beep length=2s frequency=10000

[admin@MikroTik] &gt;</pre>
</div>
<p><strong>delay</strong> &#8211; does nothing for a given amount of time.</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<strong>delay-time</strong> (<em>time</em>) 					 &#8211; amount of time to wait</p>
<li><strong>omitted</strong> &#8211; delay forever</li>
</div>
<p><strong>do</strong> &#8211; executes commands repeatedly until given conditions are met. If no parameters are given, <strong>do</strong> just executes its payload once, which does not make much use. If a logical condition is specified for the <strong>while</strong> parameter, it will be evaluated after executing commands, and in case it is <em>true</em>, <strong>do</strong> statement is executed again and again until <em>false</em>. The <strong>if</strong> parameter, if present, is evaluated only once before doing anything else, and if it is <em>false</em> then no action is taken</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em> (<em>text</em>) 					 &#8211; actions to execute repeatedly<br />
<strong>while</strong> (yes | no) 					 &#8211; condition, which is evaluated each time after the execution of enclosed statements<br />
<strong>if</strong> (yes | no) 					 &#8211; condition, which is evaluated once before the execution of enclosed statements</div>
<div class="example">
<pre>[admin@MikroTik] &gt; {:global i 10; :do {:put $i; :set i ($i - 1);} \
\... while (($i &lt; 11) &amp;&amp; ($i &gt; 0)); :unset i;}
10
9
8
7
6
5
4
3
2
1
[admin@MikroTik] &gt;</pre>
</div>
<p><strong>environment print</strong> &#8211; prints information about variables that are currently initialised. All global variables in the system are listed under the heading <strong>Global Variables</strong>. All variables that are introduced in the current script (variables introduced by <strong>:local</strong> or created by <strong>:for</strong> or <strong>:foreach</strong> statements) are listed under the heading <strong>Local Variables.</strong></p>
<div class="example"><span>Creating variables and displaying a list of them</span></p>
<pre>[admin@MikroTik] &gt; :local A "This is a local variable"
[admin@MikroTik] &gt; :global B "This is a global one"
[admin@MikroTik] &gt; :environment print
Global Variables
B=This is a global one
Local Variables
A=This is a local variable
[admin@MikroTik] &gt;</pre>
</div>
<p><strong>find</strong> &#8211; searches for substring inside a string or for an element with particular value inside an array, depending on argument types and returns position at which the value is found. The elements in list and characters in string are numbered from 0 upwards</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em>(<em>text</em> | <em>list</em>) &#8211; the string or value list the search will be performed in<br />
<em>unnamed</em>(<em>text</em>) &#8211; value to be searched for<br />
<em>unnamed</em>(<em>integer</em>) &#8211; position after which the search is started</div>
<div class="example">
<pre>[admin@MikroTik] interface pppoe-server&gt; :put [:find "13sdf1sdfss1sfsdf324333"  ]
0
[admin@MikroTik] interface pppoe-server&gt; :put [:find "13sdf1sdfss1sfsdf324333" 3  ]
1
[admin@MikroTik] interface pppoe-server&gt; :put [:find "13sdf1sdfss1sfsdf324333" 3  3]
17
[admin@MikroTik] interface pppoe-server&gt; :put [:find "1,1,1,2,3,3,4,5,6,7,8,9,0,1,2,3" 3 ]
4
[admin@MikroTik] interface pppoe-server&gt; :put [:find "1,1,1,2,3,3,4,5,6,7,8,9,0,1,2,3" 3 3]
4
[admin@MikroTik] interface pppoe-server&gt; :put [:find "1,1,1,2,3,3,4,5,6,7,8,9,0,1,2,3" 3 4]
5
[admin@MikroTik] interface pppoe-server&gt; :put [:find "1,1,1,2,3,3,4,5,6,7,8,9,0,1,2,3" 3 5]
15
[admin@MikroTik]</pre>
</div>
<p><strong>for</strong> &#8211; executes supplied commands over a given number of iterations, which is explicity set through <strong>from</strong> and <strong>to</strong></p>
<p>parameters</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em> (<em>name</em>) 					 &#8211; the name of the loop counter variable<br />
<strong>from</strong> (<em>integer</em>) 					 &#8211; start value of the loop counter variable<br />
<strong>to</strong> (<em>integer</em>) 					 &#8211; end value of the loop counter variable<br />
<strong>step</strong> (<em>integer</em>; default: <strong>1</strong>) 					 &#8211; increment value. Depending on the loop counter variable start and end values, <strong>step</strong> parameter can be treated also as decrement<br />
<strong>do</strong> (<em>text</em>) 					 &#8211; contains the command to be executed repeatedly</div>
<div class="example">
<pre>[admin@MikroTik] &gt; :for i from=1 to=100 step=37  do={:put ($i . " - " . 1000/$i)}
1 - 1000
38 - 26
75 - 13
[admin@MikroTik] &gt;</pre>
</div>
<p><strong>foreach</strong> &#8211; executes supplied commands for each element in list</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em> (<em>name</em>) 					 &#8211; the name of the loop counter variable<br />
<strong>in</strong> (<em>list</em>) 					 &#8211; list of values over which to iterate<br />
<strong>do</strong> (<em>text</em>) 					 &#8211; contains the command to be executed repeatedly</div>
<div class="example"><span>Printing a list of available interfaces with their respective IP addresses</span></p>
<pre>:foreach i in=[/interface find type=ether ] \
\... do={:put ("+--" . [/interface get $i name]); \
\... :foreach j in=[/ip address find interface=$i]
\... do={:put ("|  `--" . [/ip address get $j address])}}
+--ether1
|  `--1.1.1.3/24
|  `--192.168.50.1/24
|  `--10.0.0.2/24
+--ether2
|  `--10.10.0.2/24
[admin@MikroTik] &gt;</pre>
</div>
<p><strong>global</strong> &#8211; declares global variable</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em>(<em>name</em>) &#8211; name of the variable<br />
<em>unnamed</em>(<em>text</em>) &#8211; value, which should be assigned to the variable</div>
<div class="example">
<pre>[admin@MikroTik] &gt; :global MyString "This is a string"
[admin@MikroTik] &gt; :global IPAddr 10.0.0.1
[admin@MikroTik] &gt; :global time   0:10
[admin@MikroTik] &gt; :environment print
Global Variables
IPAddr=10.0.0.1
time=00:10:00
MyString=This is a string
Local Variables
[admin@MikroTik] &gt;</pre>
</div>
<p><strong>if</strong> &#8211; conditional statement. If a given logical condition evaluates to true then the <strong>do</strong> block of commands is executed. Otherwice an optional <strong>else</strong> block is executed.</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em>(yes | no) &#8211; logical condition, which is evaluated once before the execution of enclosed statements<br />
<strong>do</strong>(<em>text</em>) &#8211; this block of commands is executed if the logical condition evaluates to <em>true</em><br />
<strong>else</strong>(<em>text</em>) &#8211; this block of commands is executed if the logical condition evaluates to <em>false</em></div>
<div class="example"><span>Check if the firewall has any rules added</span></p>
<pre>[admin@MikroTik] &gt; :if ([:len [/ip firewall filter find]] &gt; 0) do={:put true} else={:put false}
true
[admin@MikroTik] &gt;</pre>
<p><span>Check whether the gateway is reachable. In this example, the IP address of the gateway is <strong>10.0.0.254</strong> </span></p>
<pre>[admin@MikroTik] &gt; :if ([/ping 10.0.0.254 count=1] = 0) do {:put "gateway unreachable"}
10.0.0.254 ping timeout
1 packets transmitted, 0 packets received, 100% packet loss
gateway unreachable
[admin@MikroTik] &gt;</pre>
</div>
<p><strong>led</strong> &#8211; allows to control the LEDs (Light Emitting Diodes) of the RouterBOARD 200 series embedded boards. This command is available only on RouterBoard 200 platform with the <strong>routerboard</strong> package installed</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<strong>led1</strong>(yes | no) &#8211; controls first LED<br />
<strong>led2</strong>(yes | no) &#8211; controls second LED<br />
<strong>led3</strong>(yes | no) &#8211; controls third LED<br />
<strong>led4</strong>(yes | no) &#8211; controls fourth LED<br />
<strong>length</strong>(<em>time</em>) &#8211; specifies the length of the action</p>
<li><strong>omitted</strong> &#8211; altar LED state forever</li>
</div>
<div class="example"><span>Switch on LEDs 2 and 3 for 5 seconds</span></p>
<pre>[admin@MikroTik] &gt; :led led2=yes led3=yes length=5s</pre>
</div>
<p><strong>len</strong> &#8211; returns the number of characters in string or the number of elements in list depending on the type of the argument</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em>(<em>name</em>) &#8211; string or list the length of which should be returned</div>
<div class="example">
<pre>[admin@MikroTik] &gt; :put [:len gvejimezyfopmekun]
17
[admin@MikroTik] &gt; :put [:len gve,jim,ezy,fop,mek,un]
6
[admin@MikroTik] &gt;</pre>
</div>
<p><strong>list</strong> &#8211; displays a list of all available console commands that match given search key(s)</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em>(<em>text</em>) &#8211; first search key<br />
<em>unnamed</em>(<em>text</em>) &#8211; second search key<br />
<em>unnamed</em>(<em>text</em>) &#8211; third search key</div>
<div class="example"><span>Display console commands that have <strong>hotspot</strong>, <strong>add</strong> and <strong>user</strong> parts in the command&#8217;s name and path</span></p>
<pre>[admin@MikroTik] &gt; :list user hotspot "add "
List of console commands under "/" matching "user" and "hotspot" and "add ":

ip hotspot profile add name= hotspot-address= dns-name= \
\... html-directory= rate-limit= http-proxy= smtp-server= \
\... login-by= http-cookie-lifetime= ssl-certificate= split-user-domain= \
\... use-radius= radius-accounting= radius-interim-update= copy-from=
ip hotspot user add server= name= password= address= mac-address= \
\... profile= routes= limit-uptime= limit-bytes-in= limit-bytes-out= \
\... copy-from= comment= disabled=
ip hotspot user profile add name= address-pool= session-timeout= \
\... idle-timeout= keepalive-timeout= status-autorefresh= \
\... shared-users= rate-limit= incoming-filter= outgoing-filter= \
\... incoming-mark= outgoing-mark= open-status-page= on-login= on-logout= copy-from=
[admin@MikroTik] &gt;</pre>
</div>
<p><strong>local</strong> &#8211; declares local variable</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em>(<em>name</em>) &#8211; name of the variable<br />
<em>unnamed</em>(<em>text</em>) &#8211; value, which should be assigned to the variable</div>
<div class="example">
<pre>[admin@MikroTik] &gt; :local MyString "This is a string"
[admin@MikroTik] &gt; :local IPAddr 10.0.0.1
[admin@MikroTik] &gt; :local time   0:10
[admin@MikroTik] &gt; :environment print
Global Variables
Local Variables
IPAddr=10.0.0.1
time=00:10:00
MyString=This is a string
[admin@MikroTik] &gt;</pre>
</div>
<p><strong>log</strong> &#8211; adds a message specified by <strong>message</strong> parameter to the system logs.</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em>(<em>name</em>) &#8211; name of the logging facility to send message to<br />
<em>unnamed</em>(<em>text</em>) &#8211; the text of the message to be logged</div>
<div class="example"><span>Send message to <strong>info</strong> log</span></p>
<pre>[admin@MikroTik] &gt; :log info "Very Good thing happened. We have received our first packet!"
[admin@MikroTik] &gt; /log print follow
...
19:57:46 script,info Very Good thing happened. We have received our first packet!
...</pre>
</div>
<p><strong>nothing</strong> &#8211; has no action, and returns value of type &#8220;nothing&#8221;. In conditions nothing behaves as &#8220;false&#8221;</p>
<div class="example"><span>Pick a symbol that does not exist from a string</span></p>
<pre>[admin@MikroTik] &gt; :local string qwerty
[admin@MikroTik] &gt; :if ([:pick $string 10]=[:nothing]) do={
{... :put "pick and nothing commands return the same value"}
pick and nothing commands return the same value
[admin@MikroTik] &gt;</pre>
</div>
<p><strong>pick</strong> &#8211; returns a range of elements or a substring depending on the type of input value</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em>(<em>text</em> | <em>list</em>) &#8211; the string or value list from which a substring or a subrange should be returned<br />
<em>unnamed</em>(<em>integer</em>) &#8211; start position of substring or subrange<br />
<em>unnamed</em>(<em>integer</em>) &#8211; end position for substring or subrange</div>
<div class="example">
<pre>[admin@MikroTik] &gt; :set a 1,2,3,4,5,6,7,8
[admin@MikroTik] &gt; :put [:len $a]
8
[admin@MikroTik] &gt; :put [:pick $a]
1
[admin@MikroTik] &gt; :put [:pick $a 0 4]
1,2,3,4
[admin@MikroTik] &gt; :put [:pick $a 2 4]
3,4
[admin@MikroTik] &gt; :put [:pick $a 2]
3
[admin@MikroTik] &gt; :put [:pick $a 5 1000000]
6,7,8
[admin@MikroTik] &gt; :set a abcdefghij
[admin@MikroTik] &gt; :put [:len $a]
10
[admin@MikroTik] &gt; :put [:pick $a]
a
[admin@MikroTik] &gt; :put [:pick $a 0 4]
abcd
[admin@MikroTik] &gt; :put [:pick $a 2 4]
cd
[admin@MikroTik] &gt; :put [:pick $a 2]
c
[admin@MikroTik] &gt; :put [:pick $a 5 1000000]
fghij</pre>
</div>
<p><strong>put</strong> &#8211; echoes supplied argument to the console</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em>(<em>text</em>) &#8211; the text to be echoed to the console</div>
<div class="example"><span>Display the MTU of <strong>ether1</strong> interface</span></p>
<pre>[admin@MikroTik] &gt; :put [/interface get ether1 mtu]
1500
[admin@MikroTik] &gt;</pre>
</div>
<p><strong>resolve</strong> &#8211; returns IP address of the host resolved from the DNS name. The DNS settings should be configured on the router (<strong>/ip dns</strong> submenu) prior to using this command.</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em>(<em>text</em>) &#8211; domain name to be resolved into an IP address</div>
<div class="example"><span>DNS configuration and <strong>resolve</strong> command example</span></p>
<pre>[admin@MikroTik] ip route&gt; /ip dns set primary-dns=159.148.60.2
[admin@MikroTik] ip route&gt; :put [:resolve www.example.com]
192.0.34.166</pre>
</div>
<p><strong>set</strong> &#8211; assigns new value to a variable</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em>(<em>name</em>) &#8211; the name of the variable<br />
<em>unnamed</em>(<em>text</em>) &#8211; the new value of the variable</div>
<div class="example"><span>Measuring time needed to resolve www.example.com</span></p>
<pre>[admin@MikroTik] &gt; :put [:time [:resolve www.example.com ]]
00:00:00.006
[admin@MikroTik] &gt;</pre>
</div>
<p><strong>time</strong> &#8211; measures the amount of time needed to execute given console commands</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em>(<em>text</em>) &#8211; the console commands to measure execution time of</div>
<div class="example"><span>Measuring time needed to resolve www.example.com</span></p>
<pre>[admin@MikroTik] &gt; :put [:time [:resolve www.example.com ]]
00:00:00.006
[admin@MikroTik] &gt;</pre>
</div>
<p><strong>while</strong> &#8211; executes given console commands repeatedly while the logical conditions is <em>true</em></p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em>(yes | no) &#8211; condition, which is evaluated each time before the execution of enclosed statements<br />
<strong>do</strong>(<em>text</em>) &#8211; console commands that should be executed repeatedly</div>
<div class="example">
<pre>[admin@MikroTik] &gt; :set i 0; :while ($i &lt; 10) do={:put $i; :set i ($i + 1)};
0
1
2
3
4
5
6
7
8
9
[admin@MikroTik] &gt;</pre>
</div>
<p><a name="2.173.9"></a></p>
<h2>Special Commands</h2>
<p><a name="2.173.9.1"></a></p>
<h3>Description</h3>
<p><a name="2.173.9.1.1"></a> <strong class="title"><span style="text-decoration:underline;">Monitor</span></strong></p>
<p>It is possible to access values that are shown by most <strong>monitor</strong> actions from scripts. A <strong>monitor</strong> command that has a <strong>do</strong> parameter can be supplied either script name (see <strong>/system scripts</strong>), or console commands to execute.</p>
<p><a name="2.173.9.1.2"></a> <strong class="title"><span style="text-decoration:underline;">Get</span></strong></p>
<p>Most <strong>print</strong> commands produce values that are accessible from scripts. Such <strong>print</strong> commands have a corresponding <strong>get</strong> command on the same menu level. The <strong>get</strong> command accepts one parameter when working with regular values or two parameters when working with lists.</p>
<p><a name="2.173.9.2"></a></p>
<h3>Notes</h3>
<p><a name="2.173.9.2.1"></a></p>
<p>Monitor command with <strong>do</strong> argument can also be called directly from scripts. It will not print anything then, just execute the given script.</p>
<p><a name="2.173.9.2.2"></a></p>
<p>The names of the properties that can be accessed by <strong>get</strong> are the same as shown by <strong>print</strong> command, plus names of item flags (like the disabled in the example below). You can use [T ab] key completions to see what properties any particular <strong>get</strong> action can return.</p>
<p><a name="2.173.9.3"></a></p>
<h3>Example</h3>
<p>In the example below <strong>monitor</strong> action will execute given script each time it prints stats on the screen, and it will assign all printed values to local variables with the same name:</p>
<pre>[admin@MikroTik] interface&gt; monitor-traffic ether2 once do={:environment print}
    received-packets-per-second: 0
       received-bits-per-second: 0bps
        sent-packets-per-second: 0
           sent-bits-per-second: 0bps

Global Variables
i=1
Local Variables
sent-bits-per-second=0
received-packets-per-second=0
received-bits-per-second=0
sent-packets-per-second=0
[admin@MikroTik] interface&gt;</pre>
<p><a name="2.173.10"></a></p>
<h2>Additional Features</h2>
<p><a name="2.173.10.1"></a></p>
<h3>Description</h3>
<p>To include comment in the console script prefix it with &#8216;#&#8217;. In a line of script that starts with &#8216;#&#8217; all characters until the newline character are ignored.</p>
<p>To put multiple commands on a single line separate them with &#8216;;&#8217;. Console treats &#8216;;&#8217; as the end of line in scripts.</p>
<p>Any of the <strong>{}[]&#8220;&#8216;\$</strong> characters should be escaped in a reqular string with &#8216;\&#8217; character. Console takes any character following &#8216;\&#8217; literally, without assigning any special meaning to it, except for such cases:</p>
<pre>\a     bell (alarm), character code 7
\b     backspace, character code 8
\f     form feed, character code 12
\n     newline, character code 10
\r     carriage return, character code 13
\t     tabulation, character code 9
\v     vertical tabulation, character code 11
\_     space, character code 32</pre>
<p><strong>Note</strong> that &#8216;\&#8217;, followed by any amount of whitespace characters (spaces, newlines, carriage returns, tabulations), followed by newline is treated as a single whitespace, except inside quotes, where it is treated as nothing. This is used by console to break up long lines in scripts generated by export commands.</p>
<p><a name="2.173.11"></a></p>
<h2>Script Repository</h2>
<p><a name="2.173.11.1"></a> Submenu level: <strong><em>/system script</em></strong><br />
<a name="2.173.11.2"></a></p>
<h3>Description</h3>
<p>All scripts are stored in the <strong>/system script</strong> menu along with some service information such as script name, script owner, number of times the script was executed and permissions for particular script.</p>
<div class="itemizedlist">
<p>In RouterOS, a script may be automatically started in three different ways:</p>
<ul>
<li> via the scheduler</li>
<li> on event occurence &#8211; for example, the netwatch tool generates an event if a network host it is configured to monitor becomes unaccessible</li>
<li> by another script</li>
</ul>
</div>
<p>It is also possible to start a script manually via <strong>/system script run</strong> command.</p>
<p><a name="2.173.11.3"></a></p>
<h3>Property Description</h3>
<p><strong>last-started</strong> (<em>time</em>) &#8211; date and time when the script has been last invoked. The argument is shown only if the <strong>run-count</strong>!=<strong>0</strong>.<strong>owner</strong> (<em>name</em>; default: <strong>admin</strong>) &#8211; the name of the user who created the script<strong>policy</strong> (<em>multiple choice: </em>ftp | local | policy | read | reboot | ssh | telnet | test | web | write; default: <strong>reboot,read,write,policy,test</strong>) &#8211; the list of the policies applicable:</p>
<div class="params"><strong>ftp</strong> &#8211; user can log on remotely via ftp and send and retrieve files from the router<br />
<strong>local</strong> &#8211; user can log on locally via console<br />
<strong>policy</strong> &#8211; manage user policies, add and remove user<br />
<strong>read</strong> &#8211; user can retrieve the configuration<br />
<strong>reboot</strong> &#8211; user can reboot the router<br />
<strong>ssh</strong> &#8211; user can log on remotely via secure shell<br />
<strong>telnet</strong> &#8211; user can log on remotely via telnet<br />
<strong>test</strong> &#8211; user can run ping, traceroute, bandwidth test<br />
<strong>web</strong> &#8211; user can log on remotely via http<br />
<strong>write</strong> &#8211; user can retrieve and change the configuration</div>
<p><strong>run-count</strong> (<em>integer</em>; default: <strong>0</strong>) &#8211; script usage counter. This counter is incremented each time the script is executed. The counter will reset after reboot.<strong>source</strong> (<em>text</em>; default: <strong>&#8220;&#8221;</strong>) &#8211; the script source code itself 			 			 			 			 			 			 			 		 		 		<a name="2.173.11.4"></a></p>
<h3>Command Description</h3>
<p><strong>run</strong> (<em>name</em>) &#8211; executes a given script</p>
<div class="params"><strong><span style="text-decoration:underline;">Input Parameters</span></strong><br />
<em>unnamed</em>(<em>name</em>) &#8211; the name of the script to execute</div>
<p><a name="2.173.11.5"></a></p>
<h3>Notes</h3>
<p><a name="2.173.11.5.1"></a></p>
<p>You cannot do more in scripts than you are allowed to do by your current user rights, that is, you cannot use disabled policies. For example, if there is a policy group in <strong>/user group</strong> which allows you <strong>ssh,local,telnet,read,write,policy,test,web</strong> and this group is assigned to your user name, then you cannot make a script that reboots the router.</p>
<p><a name="2.173.11.6"></a></p>
<h3>Example</h3>
<p>The following example is a script for writing message &#8220;Hello World!&#8221; to the <strong>info</strong> log:</p>
<pre>[admin@MikroTik] system script&gt; add name="log-test" source={:log info "Hello World!"}
[admin@MikroTik] system script&gt; run log-test

[admin@MikroTik] system script&gt; print
 0 name="log-test" owner="admin" policy=ftp,reboot,read,write,policy,test,winbox,password last-started=mar/20/2001 22:51:41
   run-count=1 source=:log info "Hello World!"
[admin@MikroTik] system script&gt;</pre>
<p><a name="2.173.12"></a></p>
<h2>Task Management</h2>
<p><a name="2.173.12.1"></a> Submenu level: <strong><em>/system script job</em></strong><br />
<a name="2.173.12.2"></a></p>
<h3>Description</h3>
<p>This facility is used to manage the active or scheduled tasks.</p>
<p><a name="2.173.12.3"></a></p>
<h3>Property Description</h3>
<p><strong>name</strong> (<em>read-only: </em><em>name</em>) &#8211; the name of the script to be referenced when invoking it<strong>owner</strong> (<em>text</em>) &#8211; the name of the user who created the script<strong>source</strong> (<em>read-only: </em><em>text</em>) &#8211; the script source code itself 			 			 			 		 		 		<a name="2.173.12.4"></a></p>
<h3>Example</h3>
<pre>[admin@MikroTik] system script&gt; job print
  # SCRIPT  OWNER                   STARTED
  0 DelayeD admin                   dec/27/2003 11:17:33

[admin@MikroTik] system script&gt;</pre>
<p>You can cancel execution of a script by removing it from the job list</p>
<pre>[admin@MikroTik] system script&gt; job remove 0
[admin@MikroTik] system script&gt; job print

[admin@MikroTik] system script&gt;</pre>
<p><a name="2.173.13"></a></p>
<h2>Script Editor</h2>
<p><a name="2.173.13.1"></a> Command name: <strong><em>/system script edit</em></strong><br />
<a name="2.173.13.2"></a></p>
<h3>Description</h3>
<p>RouterOS console has a simple full-screen editor for scripts with support for multiline script writing.</p>
<p><a name="2.173.13.2.1"></a> <strong class="title"><span style="text-decoration:underline;">Keyboard Shortcuts</span></strong></p>
<div class="itemizedlist">
<ul>
<li> <strong>Delete</strong> &#8211; deletes character at cursor position</li>
<li> <strong>Ctrl+h, backspase</strong> &#8211; deletes character before cursor. Unindents line</li>
<li> <strong>Tab</strong> &#8211; indents line</li>
<li> <strong>Ctrl+b, LeftArrow</strong> &#8211; moves cursor left</li>
<li> <strong>Ctrl+f, RightArrow</strong> &#8211; moves cursor right</li>
<li> <strong>Ctrl+p, UpArrow</strong> &#8211; moves cursor up</li>
<li> <strong>Ctrl+n, DownArrow</strong> &#8211; moves cursor down</li>
<li> <strong>Ctrl+a, Home</strong> &#8211; moves cursor to the beginning of line or script</li>
<li> <strong>Ctrl+e, End</strong> &#8211; moves cursor to the end of line or script</li>
<li> <strong>Ctrl+y</strong> &#8211; inserts contents of buffer at cursor position</li>
<li> <strong>Ctrl+k</strong> &#8211; deletes characters from cursor position to the end of line</li>
<li> <strong>Ctrl+u</strong> &#8211; undoes last action</li>
<li> <strong>Ctrl+o</strong> &#8211; exits editor accepting changes</li>
<li> <strong>Ctrl+x</strong> &#8211; exits editor discarding changes</li>
</ul>
</div>
<p><a name="2.173.13.3"></a></p>
<h3>Command Description</h3>
<p><strong>edit</strong> (<em>name</em>) &#8211; opens the script specified by the <strong>name</strong> argument in full-screen editor 		 		<a name="2.173.13.4"></a></p>
<h3>Notes</h3>
<p><a name="2.173.13.4.1"></a></p>
<p>All characters that are deleted by <strong>backspace, delete</strong> or <strong>Ctrl+k</strong> keys are accumulated in the buffer. Pressing any other key finishes adding to this buffer (<strong>Ctrl+y</strong> can paste it&#8217;s contents), and the next delete operation will replace it&#8217;s contents. Undo doesn&#8217;t change contents of cut buffer.</p>
<p><a name="2.173.13.4.2"></a></p>
<p>Script editor works only on VT102 compatible terminals (terminal names &#8220;vt102&#8243;, &#8220;linux&#8221;, &#8220;xterm&#8221;, &#8220;rxvt&#8221; are recognized as VT102 at the moment). Delete, backspace and cursor keys might not work with all terminal programs, use &#8216;Ctrl&#8217; alternatives in such cases.</p>
<p><a name="2.173.13.5"></a></p>
<h3>Example</h3>
<p>The following example shows the script editor window with a sample script open:</p>
<p><img src="http://www.mikrotik.com/testdocs/ros/2.9/img/" alt="Script Editor window" /></p>
<p>This script is used for writing message &#8220;hello&#8221; and 3 messages &#8220;kuku&#8221; to the system log.</p>
<p>©</p>
<br />Posted in Uncategorized Tagged: Scripting Host <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/telogodog.wordpress.com/514/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/telogodog.wordpress.com/514/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/telogodog.wordpress.com/514/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/telogodog.wordpress.com/514/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/telogodog.wordpress.com/514/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/telogodog.wordpress.com/514/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/telogodog.wordpress.com/514/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/telogodog.wordpress.com/514/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/telogodog.wordpress.com/514/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/telogodog.wordpress.com/514/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/telogodog.wordpress.com/514/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/telogodog.wordpress.com/514/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/telogodog.wordpress.com/514/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/telogodog.wordpress.com/514/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=telogodog.wordpress.com&amp;blog=6674117&amp;post=514&amp;subd=telogodog&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://telogodog.wordpress.com/2009/03/29/scripting-host/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/497bf9708054bf3707509276e2eeac68?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">telogodog</media:title>
		</media:content>

		<media:content url="http://www.mikrotik.com/testdocs/ros/2.9/img/" medium="image">
			<media:title type="html">Script Editor window</media:title>
		</media:content>
	</item>
		<item>
		<title>Serial Port Monitor</title>
		<link>http://telogodog.wordpress.com/2009/03/29/serial-port-monitor/</link>
		<comments>http://telogodog.wordpress.com/2009/03/29/serial-port-monitor/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 03:52:17 +0000</pubDate>
		<dc:creator>telogodog</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Serial Port Monitor]]></category>

		<guid isPermaLink="false">http://telogodog.wordpress.com/?p=510</guid>
		<description><![CDATA[Bahasa Indonesia Serial port monitoring utility monitors state of attached asynchronous serial ports and generates system events upon state change. Specifications Packages required: advanced-tools License required: Level1 Submenu level: /tool sigwatch Standards and Technologies: none Hardware usage: Not significant Related Documents Software Package Management Scripting Host Sigwatch Description Sigwatch monitors state of the serial port [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=telogodog.wordpress.com&amp;blog=6674117&amp;post=510&amp;subd=telogodog&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span id="more-510"></span></p>
<p><a title="Indonesian" href="http://translate.google.com/translate?hl=id&amp;langpair=en%7Cid&amp;u=http://telogodog.wordpress.com/2009/03/29/serial-port-monitor/"><strong>Bahasa Indonesia</strong></a></p>
<p>Serial port monitoring utility monitors state of attached asynchronous serial ports and generates system events upon state change.</p>
<p><a name="2.171.1.2"></a></p>
<h3>Specifications</h3>
<p>Packages required: <strong><em>advanced-tools</em></strong><br />
License required: <em>Level1</em><br />
Submenu level: <strong><em>/tool sigwatch</em></strong><br />
Standards and Technologies: none<br />
Hardware usage: <em>Not significant</em><br />
<a name="2.171.1.3"></a></p>
<h3>Related Documents</h3>
<div class="itemizedlist">
<ul>
<li> <a href="http://www.mikrotik.com/testdocs/ros/2.9/guide/packages.php" target="_top">Software Package Management</a></li>
<li> <a href="http://www.mikrotik.com/testdocs/ros/2.9/system/scripting.php" target="_top">Scripting Host</a></li>
</ul>
</div>
<p><a name="2.171.2"></a></p>
<h2>Sigwatch</h2>
<p><a name="2.171.2.1"></a></p>
<h3>Description</h3>
<p>Sigwatch monitors state of the serial port pins.</p>
<p><a name="2.171.2.2"></a></p>
<h3>Property Description</h3>
<p><strong>count</strong> (<em>read-only: </em><em>integer</em>) &#8211; how many times the event for this item was triggered. Count is reset on reboot and on most item configuration changes<strong>log</strong> (yes | no; default: <strong>no</strong>) &#8211; whether to add a message in form of <em>name-of-sigwatch-item: signal changed [to high | to low]</em> to System-Info facility whenever this sigwatch item is triggered<strong>name</strong> (<em>name</em>) &#8211; name of the sigwatch item<strong>on-condition</strong> (on | off | change; default: <strong>on</strong>) &#8211; on what condition to trigger action of this item</p>
<div class="params"><strong>on</strong> &#8211; trigger when state of pin changes to high<br />
<strong>off</strong> &#8211; trigger when state of pin changes to low<br />
<strong>change</strong> &#8211; trigger whenever state of pin changes. If state of pin changes rapidly, there might be triggered only one action for several state changes</div>
<p><strong>port</strong> (<em>name</em>) &#8211; serial port name to monitor<strong>script</strong> (<em>name</em>) &#8211; script to execute when this item is trigered<strong>signal</strong> (dtr | rts | cts | dcd | ri | dsr; default: <strong>rts</strong>) &#8211; name of signal of number of pin (for standard 9-pin connector) to monitor</p>
<div class="params"><strong>dtr</strong> &#8211; Data Terminal Ready (pin #4)<br />
<strong>rts</strong> &#8211; Request To Send (pin #7)<br />
<strong>cts</strong> &#8211; Clear To Send (pin #8)<br />
<strong>dcd</strong> &#8211; Data Carrier Detect (pin #1)<br />
<strong>ri</strong> &#8211; Ring Indicator (pin #9)<br />
<strong>dsr</strong> &#8211; Data Set Ready (pin #6)</div>
<p><strong>state</strong> (<em>read-only: </em><em>text</em>) &#8211; last remembered state of monitored signal 			 			 			 			 			 			 			 			 			 			 			 			 			 		 		 		<a name="2.171.2.3"></a></p>
<h3>Notes</h3>
<p><a name="2.171.2.3.1"></a></p>
<p>You can type actual script source instead of the script name from <strong>/system script</strong> list.</p>
<p><a name="2.171.2.4"></a></p>
<h3>Example</h3>
<p>In the following example we will add a new sigwatch item that monitors whether the port <strong>serial1</strong> has cts signal.</p>
<pre>[admin@10.179] tool sigwatch&gt; pr
Flags: X - disabled
  #   NAME                                  PORT    SIGNAL     ON-CONDITION LOG
  0   test                                  serial1 cts        change       no
[admin@MikroTik] tool sigwatch&gt;</pre>
<p>By typing a command <strong>print detail interval=1s</strong>, we can check whether a cable is connected or it is not. See the <strong>state</strong> argument &#8211; if the cable is connected to the serial port, it shows <strong>on</strong>, otherwise it will be <strong>off</strong>.</p>
<pre>[admin@MikroTik] tool sigwatch&gt; print detail
Flags: X - disabled
  0   name="test" port=serial1 signal=cts on-condition=change log=no script=""
      count=1 state=on

[admin@MikroTik] tool sigwatch&gt; print detail
Flags: X - disabled
  0   name="test" port=serial1 signal=cts on-condition=change log=no script=""
      count=1 state=on

[admin@MikroTik] tool sigwatch&gt; print detail
Flags: X - disabled
  0   name="test" port=serial1 signal=cts on-condition=change log=no script=""
      count=2 state=off

[admin@MikroTik] tool sigwatch&gt; print detail
Flags: X - disabled
  0   name="test" port=serial1 signal=cts on-condition=change log=no script=""
      count=2 state=off

[admin@MikroTik] tool sigwatch&gt;</pre>
<p>In the <strong>port</strong> menu you can see what <strong>signal</strong> is used by serial cable. For example, without any cables it looks like this:</p>
<pre>[admin@MikroTik] port&gt; print stats
  0 name="serial0" line-state=dtr,rts

  1 name="serial1" line-state=dtr,rts
[admin@MikroTik] port&gt;</pre>
<p>But after adding a serial cable to the serial port:</p>
<pre>[admin@MikroTik] port&gt; print stats
  0 name="serial0" line-state=dtr,rts

  1 name="serial1" line-state=dtr,rts,cts
[admin@MikroTik] port&gt;</pre>
<p>This means that the line-state besides the <strong>dtr</strong> and <strong>rts</strong> signals has also <strong>cts</strong> when a serial cable is connected.</p>
<p>The example below will execute a script whenever <strong>on-condition</strong> changes to <strong>off</strong>:</p>
<pre>[admin@10.MikroTik] tool sigwatch&gt; pr detail
Flags: X - disabled
  0   name="cts_rest" port=serial1 signal=cts on-condition=off log=no
      script=/system shutdown count=0 state=on
[admin@10.MikroTik] tool sigwatch&gt;</pre>
<p>It means that if a serial cable is connected to the serial port, all works fine, but as soon as it is disconnected, the router shuts down. It will continue all the time until the serial cable will not be connected again.</p>
<p>©</p>
<br />Posted in Uncategorized Tagged: Serial Port Monitor <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/telogodog.wordpress.com/510/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/telogodog.wordpress.com/510/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/telogodog.wordpress.com/510/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/telogodog.wordpress.com/510/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/telogodog.wordpress.com/510/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/telogodog.wordpress.com/510/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/telogodog.wordpress.com/510/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/telogodog.wordpress.com/510/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/telogodog.wordpress.com/510/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/telogodog.wordpress.com/510/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/telogodog.wordpress.com/510/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/telogodog.wordpress.com/510/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/telogodog.wordpress.com/510/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/telogodog.wordpress.com/510/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=telogodog.wordpress.com&amp;blog=6674117&amp;post=510&amp;subd=telogodog&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://telogodog.wordpress.com/2009/03/29/serial-port-monitor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/497bf9708054bf3707509276e2eeac68?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">telogodog</media:title>
		</media:content>
	</item>
		<item>
		<title>Network Monitor</title>
		<link>http://telogodog.wordpress.com/2009/03/29/network-monitor/</link>
		<comments>http://telogodog.wordpress.com/2009/03/29/network-monitor/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 03:47:38 +0000</pubDate>
		<dc:creator>telogodog</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Network Monitor]]></category>

		<guid isPermaLink="false">http://telogodog.wordpress.com/?p=507</guid>
		<description><![CDATA[Bahasa Indonesia The Netwatch tool monitors network host by means of ping and generates events on status change. Specifications Packages required: system License required: Level1 Submenu level: /tool netwatch Standards and Technologies: None Hardware usage: Not significant Related Documents Software Package Management Scripting Host Network Watching Tool Specifications Packages required: advanced-tools License required: Level1 Submenu [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=telogodog.wordpress.com&amp;blog=6674117&amp;post=507&amp;subd=telogodog&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span id="more-507"></span></p>
<p><a title="Indonesian" href="http://translate.google.com/translate?hl=id&amp;langpair=en%7Cid&amp;u=http://telogodog.wordpress.com/2009/03/29/network-monitor/"><strong>Bahasa Indonesia</strong></a></p>
<p>The Netwatch tool monitors network host by means of ping and generates events on status change.</p>
<p><a name="2.172.1.2"></a></p>
<h3>Specifications</h3>
<p>Packages required: <strong><em>system</em></strong><br />
License required: <em>Level1</em><br />
Submenu level: <strong><em>/tool netwatch</em></strong><br />
Standards and Technologies: None<br />
Hardware usage: <em>Not significant</em><br />
<a name="2.172.1.3"></a></p>
<h3>Related Documents</h3>
<div class="itemizedlist">
<ul>
<li> <a href="http://www.mikrotik.com/testdocs/ros/2.9/guide/packages.php" target="_top">Software Package Management</a></li>
<li> <a href="http://www.mikrotik.com/testdocs/ros/2.9/system/scripting.php" target="_top">Scripting Host</a></li>
</ul>
</div>
<p><a name="2.172.2"></a></p>
<h2>Network Watching Tool</h2>
<p><a name="2.172.2.1"></a></p>
<h3>Specifications</h3>
<p>Packages required: <strong><em>advanced-tools</em></strong><br />
License required: <em>Level1</em><br />
Submenu level: <strong><em>/tool netwatch</em></strong><br />
Standards and Technologies: none<br />
Hardware usage: <em>Not significant</em><br />
<a name="2.172.2.2"></a></p>
<h3>Description</h3>
<p>Netwatch monitors state of hosts on the network. It does so by sending ICMP pings to the list of specified IP addresses. For each entry in netwatch table you can specify IP address, ping interval and console scripts. The main advantage of netwatch is it&#8217;s ability to issue arbitrary console commands on host state changes.</p>
<p><a name="2.172.2.3"></a></p>
<h3>Property Description</h3>
<p><strong>down-script</strong> (<em>name</em>) &#8211; a console script that is executed once when state of a host changes from <strong>unknown</strong> or <strong>up</strong> to <strong>down</strong> <strong>host</strong> (<em>IP address</em>; default: <strong>0.0.0.0</strong>) &#8211; IP address of host that should be monitored<strong>interval</strong> (<em>time</em>; default: <strong>1s</strong>) &#8211; the time between pings. Lowering this will make state changes more responsive, but can create unnecessary traffic and consume system resources<strong>since</strong> (<em>read-only: </em><em>time</em>) &#8211; indicates when state of the host changed last time<strong>status</strong> (<em>read-only: </em>up | down | unknown) &#8211; shows the current status of the host</p>
<div class="params"><strong>up</strong> &#8211; the host is up<br />
<strong>down</strong> &#8211; the host is down<br />
<strong>unknown</strong> &#8211; after any properties of this list entry were changed, or the item is enabled or disabled</div>
<p><strong>timeout</strong> (<em>time</em>; default: <strong>1s</strong>) &#8211; timeout for each ping. If no reply from a host is received during this time, the host is considered unreachable (<strong>down</strong>)<strong>up-script</strong> (<em>name</em>) &#8211; a console script that is executed once when state of a host changes from <strong>unknown</strong> or <strong>down</strong> to <strong>up</strong> <a name="2.172.2.4"></a></p>
<h3>Example</h3>
<p>This example will run the scripts gw_1 or gw_2 which change the default gateway depending on the status of one of the gateways:</p>
<pre>[admin@MikroTik] system script&gt; add name=gw_1 source={/ip route set
{... [/ip route find dst 0.0.0.0] gateway 10.0.0.1}
[admin@MikroTik] system script&gt; add name=gw_2 source={/ip route set
{.. [/ip route find dst 0.0.0.0] gateway 10.0.0.217}
[admin@MikroTik] system script&gt; /tool netwatch
[admin@MikroTik] tool netwatch&gt; add host=10.0.0.217 interval=10s timeout=998ms \
\... up-script=gw_2 down-script=gw_1
[admin@MikroTik] tool netwatch&gt; print
Flags: X - disabled
  #   HOST	      TIMEOUT		   INTERVAL		STATUS
  0   10.0.0.217      997ms		   10s			up
[admin@MikroTik] tool netwatch&gt; print detail
Flags: X - disabled
  0   host=10.0.0.217 timeout=997ms interval=10s since=feb/27/2003 14:01:03
      status=up up-script=gw_2 down-script=gw_1

[admin@MikroTik] tool netwatch&gt;</pre>
<p>Without scripts, netwatch can be used just as an information tool to see which links are up, or which specific hosts are running at the moment.</p>
<p>Let&#8217;s look at the example above &#8211; it changes default route if gateway becomes unreachable. How it&#8217;s done? There are two scripts. The script &#8220;gw_2&#8243; is executed once when status of host changes to <strong>up</strong>. In our case, it&#8217;s equivalent to entering this console command:</p>
<pre>[admin@MikroTik] &gt; /ip route set [/ip route find dst 0.0.0.0] gateway 10.0.0.217</pre>
<p>The <strong>/ip route find dst 0.0.0.0</strong> command returns list of all routes whose <strong>dst-address</strong> value is <strong>0.0.0.0</strong>. Usually, that is the default route. It is substituted as first argument to <strong>/ip route set</strong> command, which changes gateway of this route to 10.0.0.217</p>
<p>The script &#8220;gw_1&#8243; is executed once when status of host becomes <strong>down</strong>. It does the following:</p>
<pre>[admin@MikroTik] &gt; /ip route set [/ip route find dst 0.0.0.0] gateway 10.0.0.1</pre>
<p>It changes the default gateway if 10.0.0.217 address has become unreachable.</p>
<p>Here is another example, that sends e-mail notification whenever the 10.0.0.215 host goes down:</p>
<pre>[admin@MikroTik] system script&gt; add name=e-down source={/tool e-mail send
{... from="rieks@mt.lv" server="159.148.147.198" body="Router down"
{... subject="Router at second floor is down" to="rieks@latnet.lv"}
[admin@MikroTik] system script&gt; add name=e-up source={/tool e-mail send
{... from="rieks@mt.lv" server="159.148.147.198" body="Router up"
{.. subject="Router at second floor is up" to="rieks@latnet.lv"}
[admin@MikroTik] system script&gt;
[admin@MikroTik] system script&gt; /tool netwatch
[admin@MikroTik] system netwatch&gt; add host=10.0.0.215 timeout=999ms \
\... interval=20s up-script=e-up down-script=e-down
[admin@MikroTik] tool netwatch&gt; print detail
Flags: X - disabled
  0   host=10.0.0.215 timeout=998ms interval=20s since=feb/27/2003 14:15:36
      status=up up-script=e-up down-script=e-down

[admin@MikroTik] tool netwatch&gt;</pre>
<p>©</p>
<br />Posted in Uncategorized Tagged: Network Monitor <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/telogodog.wordpress.com/507/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/telogodog.wordpress.com/507/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/telogodog.wordpress.com/507/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/telogodog.wordpress.com/507/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/telogodog.wordpress.com/507/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/telogodog.wordpress.com/507/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/telogodog.wordpress.com/507/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/telogodog.wordpress.com/507/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/telogodog.wordpress.com/507/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/telogodog.wordpress.com/507/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/telogodog.wordpress.com/507/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/telogodog.wordpress.com/507/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/telogodog.wordpress.com/507/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/telogodog.wordpress.com/507/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=telogodog.wordpress.com&amp;blog=6674117&amp;post=507&amp;subd=telogodog&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://telogodog.wordpress.com/2009/03/29/network-monitor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/497bf9708054bf3707509276e2eeac68?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">telogodog</media:title>
		</media:content>
	</item>
		<item>
		<title>Traceroute</title>
		<link>http://telogodog.wordpress.com/2009/03/29/traceroute/</link>
		<comments>http://telogodog.wordpress.com/2009/03/29/traceroute/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 03:42:43 +0000</pubDate>
		<dc:creator>telogodog</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Traceroute]]></category>

		<guid isPermaLink="false">http://telogodog.wordpress.com/?p=501</guid>
		<description><![CDATA[Bahasa Indonesia Traceroute determines how packets are being routed to a particular host. Specifications Packages required: system License required: Level1 Submenu level: /tool Standards and Technologies: ICMP, UDP, Traceroute Hardware usage: Not significant Related Documents Software Package Management IP Addresses and ARP Firewall Filters Ping Description Traceroute is a TCP/IP protocol-based utility, which allows user [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=telogodog.wordpress.com&amp;blog=6674117&amp;post=501&amp;subd=telogodog&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span id="more-501"></span></p>
<p><a title="Indonesian" href="http://translate.google.com/translate?hl=id&amp;langpair=en%7Cid&amp;u=http://telogodog.wordpress.com/2009/03/29/traceroute/"><strong>Bahasa Indonesia</strong></a></p>
<p>Traceroute determines how packets are being routed to a particular host.</p>
<p><a name="10.84.1.2"></a></p>
<h3>Specifications</h3>
<p>Packages required: <strong><em>system</em></strong><br />
License required: <em>Level1</em><br />
Submenu level: <strong><em>/tool</em></strong><br />
Standards and Technologies: <a href="http://www.faqs.org/rfcs/rfc792.html" target="new">ICMP</a>,  			<a href="http://www.faqs.org/rfcs/rfc768.html" target="new">UDP</a>,  			<a href="http://www.faqs.org/rfcs/rfc2925.html" target="new">Traceroute</a><br />
Hardware usage: <em>Not significant</em><br />
<a name="10.84.1.3"></a></p>
<h3>Related Documents</h3>
<div class="itemizedlist">
<ul>
<li> <a href="http://www.mikrotik.com/testdocs/ros/2.9/guide/packages.php" target="_top">Software Package Management</a></li>
<li> <a href="http://www.mikrotik.com/testdocs/ros/2.9/ip/address.php" target="_top">IP Addresses and ARP</a></li>
<li> <a href="http://www.mikrotik.com/testdocs/ros/2.9/ip/firewall.php" target="_top">Firewall Filters</a></li>
<li> <a href="http://www.mikrotik.com/testdocs/ros/2.9/root/ping.php" target="_top">Ping</a></li>
</ul>
</div>
<p><a name="10.84.1.4"></a></p>
<h3>Description</h3>
<p>Traceroute is a TCP/IP protocol-based utility, which allows user to determine how packets are being routed to a particular host. Traceroute works by increasing the time-to-live value of packets and seeing how far they get until they reach the given destination; thus, a lengthening trail of hosts passed through is built up.</p>
<p>Traceroute shows the number of hops to the given host address of every passed gateway. Traceroute utility sends packets three times to each passed gateway so it shows three timeout values for each gateway in ms.</p>
<p><a name="10.84.2"></a></p>
<h2>The Traceroute Command</h2>
<p><a name="10.84.2.1"></a> Command name: <strong><em>/tool traceroute</em></strong><br />
<a name="10.84.2.2"></a></p>
<h3>Property Description</h3>
<p>(<em>IP address</em>) &#8211; IP address of the host you are tracing route to 			<strong>port</strong> (<em>integer</em>: 0..65535) &#8211; UDP port number 			<strong>protocol</strong> (UDP | ICMP) &#8211; type of protocol to use. If one fails (for example, it is blocked by a firewall), try the other 			<strong>size</strong> (<em>integer</em>: 28..1500; default: <strong>64</strong>) &#8211; packet size in bytes 			<strong>timeout</strong> (<em>time</em>: 1s..8s; default: <strong>1s</strong>) &#8211; response waiting timeout, i.e. delay between messages 			<strong>tos</strong> (<em>integer</em>: 0..255; default: <strong>0</strong>) &#8211; Type Of Service &#8211; parameter of IP packet 			<strong>use-dns</strong> (yes | no; default: <strong>no</strong>) &#8211; specifies whether to use DNS server, which can be set in <strong>/ip dns</strong> menu 			<strong>src-address</strong> (<em>IP address</em>) &#8211; change the source address of the packet 			<strong>max-hops</strong> (<em>integer</em>) &#8211; utmost hops through which packet can be reached 		 		<a name="10.84.2.3"></a></p>
<h3>Notes</h3>
<p><a name="10.84.2.3."></a></p>
<p>Traceroute session may be stopped by pressing [Ctrl]+[C].</p>
<p><a name="10.84.2.4"></a></p>
<h3>Example</h3>
<p>To trace the route to 216.239.39.101 host using ICMP protocol with packet size of 64 bytes, setting ToS field to 8 and extending the timeout to 4 seconds:</p>
<pre>[admin@MikroTik] tool&gt; traceroute 216.239.39.101 protocol=icmp size=64 tos=8 timeout=4s
     ADDRESS					STATUS
   1 159.148.60.227	  3ms	   3ms	    3ms
   2 195.13.173.221	 80ms	 169ms	   14ms
   3 195.13.173.28	  6ms	   4ms	    4ms
   4 195.158.240.21	111ms	 110ms	  110ms
   5 213.174.71.49	124ms	 120ms	  129ms
   6 213.174.71.134	139ms	 146ms	  135ms
   7 213.174.70.245	132ms	 131ms	  136ms
   8 213.174.70.58	211ms	 215ms	  215ms
   9 195.158.229.130	225ms	 239ms	     0s
  10 216.32.223.114	283ms	 269ms	  281ms
  11 216.32.132.14	267ms	 260ms	  266ms
  12 209.185.9.102	296ms	 296ms	  290ms
  13 216.109.66.1	288ms	 297ms	  294ms
  14 216.109.66.90	297ms	 317ms	  319ms
  15 216.239.47.66	137ms	 136ms	  134ms
  16 216.239.47.46	135ms	 134ms	  134ms
  17 216.239.39.101	134ms	 134ms	  135ms
[admin@MikroTik] tool&gt;</pre>
<p>©</p>
<br />Posted in Uncategorized Tagged: Traceroute <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/telogodog.wordpress.com/501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/telogodog.wordpress.com/501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/telogodog.wordpress.com/501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/telogodog.wordpress.com/501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/telogodog.wordpress.com/501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/telogodog.wordpress.com/501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/telogodog.wordpress.com/501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/telogodog.wordpress.com/501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/telogodog.wordpress.com/501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/telogodog.wordpress.com/501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/telogodog.wordpress.com/501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/telogodog.wordpress.com/501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/telogodog.wordpress.com/501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/telogodog.wordpress.com/501/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=telogodog.wordpress.com&amp;blog=6674117&amp;post=501&amp;subd=telogodog&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://telogodog.wordpress.com/2009/03/29/traceroute/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/497bf9708054bf3707509276e2eeac68?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">telogodog</media:title>
		</media:content>
	</item>
	</channel>
</rss>
