Browse code

ser command reference classified by command purposed, clarifications added to listen/fork config file options

Jiri Kuthan authored on 30/09/2002 22:26:28
Showing 1 changed files
... ...
@@ -1556,7 +1556,16 @@ P-hint: OUTBOUND.			    </programlisting>
1556 1556
 		<listitem>
1557 1557
 		    <para>
1558 1558
 			<varname>fork</varname> - If set to yes, the server will spawn children. If set to no, the main
1559
-			process will be processing all messages (this is mainly for debugging).
1559
+			process will be processing all messages.
1560
+			<note>
1561
+				<para>
1562
+					 Disabling child spawning is useful mainly for
1563
+					 debugging. When <varname>fork</varname> is turned off,
1564
+					 some features are unavailable: Server is able to listen
1565
+					 only at one address, there is no attendant process
1566
+					 and no pid file is generated.
1567
+				</para>
1568
+			</note>
1560 1569
 		    </para>
1561 1570
 		</listitem>
1562 1571
 		<listitem>
... ...
@@ -1569,6 +1578,19 @@ P-hint: OUTBOUND.			    </programlisting>
1569 1578
 		<listitem>
1570 1579
 		    <para>
1571 1580
 			<varname>listen</varname> - list of all IP addresses or hostnames SER should listen on.
1581
+			<note>
1582
+				<para>
1583
+					This parameter may repeat several times, then SER will
1584
+					listen on all addresses. For example, the following
1585
+					command-line options (equivalent to "listen" config
1586
+					option) may be used: 
1587
+					<command>
1588
+						ser -l foo  -l bar -p 5061 -l x -l y 
1589
+					</command>
1590
+					will listen on foo:5060, bar:5061 & x:5061 & y:5061
1591
+
1592
+				</para>
1593
+			</note>
1572 1594
 		    </para>
1573 1595
 		</listitem>
1574 1596
 		<listitem>
... ...
@@ -1693,64 +1715,40 @@ P-hint: OUTBOUND.			    </programlisting>
1693 1715
 	</section>
1694 1716
 	<section>
1695 1717
 	    <title>Core Commands</title>
1718
+
1719
+
1696 1720
 	    <itemizedlist>
1721
+		<title>Command Blocks</title>
1697 1722
 		<listitem>
1698 1723
 		    <para>
1699
-			<command>forward</command> - Forward the request to given destination.
1700
-		    </para>
1701
-		    <para>
1702
-			<emphasis>Example:</emphasis> forward("foo.bar.com");
1703
-		    </para>
1704
-		</listitem>
1705
-		<listitem>
1706
-		    <para>
1707
-			<command>drop</command> - Drop the request and stop processing.
1708
-		    </para>
1709
-		    <para>
1710
-			<emphasis>Example:</emphasis> drop();
1711
-		    </para>
1712
-		</listitem>
1713
-		<listitem>
1714
-		    <para>
1715
-			<command>send</command> - Send the message as is to the third party (without Via processing, good for
1716
-			spying).
1717
-		    </para>
1718
-		    <para>
1719
-			<emphasis>Example:</emphasis> send("foo.bar.com");
1720
-		    </para>
1721
-		</listitem>
1722
-		<listitem>
1723
-		    <para>
1724
-			<command>log</command> - Log a message.
1725
-		    </para>
1726
-		    <para>
1727
-			<emphasis>Example:</emphasis> log("This is a message\n");
1728
-		    </para>
1729
-		</listitem>
1730
-		<listitem>
1731
-		    <para>
1732
-			<command>error</command> - Report and error (same as log but in different log level).
1733
-		    </para>
1734
-		    <para>
1735
-			<emphasis>Example:</emphasis> error("This is an error message\n");
1736
-		    </para>
1737
-		</listitem>
1738
-		<listitem>
1739
-		    <para>
1740
-			<command>route</command> - This marks a route statement in the configuration file.
1724
+			<command>route</command> - This marks a "route block" in the configuration file. route blocks are basic building blocks of ser scrits. The contain sequences of 
1725
+<application>SER</application> commands enclosed in parenthesses. Configuration files
1726
+can include multiple route blocks, basic  all of them serving as a kind
1727
+of subroutines. By default, route block 0 is entered for received request. 
1728
+Other route blocks may be entered by calling the command <command>route(n)</command>, 
1729
+where n is number of the block.
1741 1730
 		    </para>
1742 1731
 		    <example>
1743 1732
 			<title>route</title>
1744 1733
 			<programlisting format="linespecific">
1745
-route {
1746
-    forward("host", "port");
1734
+route[1] {
1735
+	route(2);
1736
+}
1737
+
1738
+route[2] {
1739
+    forward("host.foo.bar", 5060);
1747 1740
 }
1748 1741
 </programlisting>
1749 1742
 		    </example>
1750 1743
 		</listitem>
1751 1744
 		<listitem>
1752 1745
 		    <para>
1753
-			<command>reply_route</command> - This marks a reply_route in the configuration statement.
1746
+			<command>reply_route</command> - This marks a reply_route block in the configuration statement. <command>reply_route</command> blocks, similarly to <command>route</command> blocks are basic building blocks
1747
+containing multiple <application>SER</application>commands. Unlike the <command>route</command> blocks, <command>reply_route</command> blocks are processed
1748
+on receipt of a reply, and continue in processing original requests. They can currently
1749
+be used only along with TM module and <command>t_on_negative</command> command. Only
1750
+selected actions may be called from <command>reply_route</command> blocks, such as
1751
+URI-rewriting actions.
1754 1752
 		    </para>
1755 1753
 		    <example>
1756 1754
 			<title>reply_route</title>
... ...
@@ -1763,14 +1761,9 @@ reply_route[1] {
1763 1761
 </programlisting>
1764 1762
 		    </example>
1765 1763
 		</listitem>
1766
-		<listitem>
1767
-		    <para>
1768
-			<command>exec</command> - Execute an external command.
1769
-		    </para>
1770
-		    <para>
1771
-			<emphasis>Example:</emphasis> exec("rm -rf /");
1772
-		    </para>
1773
-		</listitem>
1764
+	    </itemizedlist>
1765
+	    <itemizedlist>
1766
+		<title>Flag Manipulation</title>
1774 1767
 		<listitem>
1775 1768
 		    <para>
1776 1769
 			<command>setflag</command> - Set flag in the message.
... ...
@@ -1800,20 +1793,9 @@ if (isflagset(1)) {
1800 1793
 </programlisting>
1801 1794
 		    </example>
1802 1795
 		</listitem>
1803
-		<listitem>
1804
-		    <para>
1805
-			<command>len_gt</command> - If length of the message is greater than value given as parameter, the
1806
-			command will return 1 (indicating true). Otherwise -1 (indicating false) will be returned.
1807
-		    </para>
1808
-		    <example>
1809
-			<title>len_gt</title>
1810
-			<programlisting format="linespecific">
1811
-if (len_gt(1000)) {
1812
-    ....
1813
-};
1814
-</programlisting>
1815
-		    </example>
1816
-		</listitem>
1796
+	    </itemizedlist>
1797
+	    <itemizedlist>
1798
+		<title>URI Manipulation</title>
1817 1799
 		<listitem>
1818 1800
 		    <para>
1819 1801
 			<command>rewritehost | sethost | seth</command> - Rewrite host part of the Request URI.
... ...
@@ -1895,9 +1877,74 @@ if (len_gt(1000)) {
1895 1877
 			<emphasis>Example:</emphasis> append_branch("sip:foo.bar.com");
1896 1878
 		    </para>
1897 1879
 		</listitem>
1880
+	    </itemizedlist>
1881
+	    <itemizedlist>
1882
+		<title>Message Forwarding</title>
1883
+		<listitem>
1884
+		    <para>
1885
+			<command>forward(uri, port)</command> - Forward the request to given 
1886
+			destination.  The uri and port parameters may take values 'uri:host'
1887
+			and 'uri:port' respectively, in which case SER forwards to destination
1888
+			set in current URI.
1889
+		    </para>
1890
+		    <para>
1891
+			<emphasis>Example:</emphasis> forward("foo.bar.com");
1892
+		    </para>
1893
+		</listitem>
1894
+		<listitem>
1895
+		    <para>
1896
+			<command>send</command> - Send the message as is to the third party (without Via processing, good for
1897
+			spying).
1898
+		    </para>
1899
+		    <para>
1900
+			<emphasis>Example:</emphasis> send("foo.bar.com");
1901
+		    </para>
1902
+		</listitem>
1903
+	    </itemizedlist>
1904
+	    <itemizedlist>
1905
+		<title>Logging</title>
1906
+		<listitem>
1907
+		    <para>
1908
+			<command>log</command> - Log a message.
1909
+		    </para>
1910
+		    <para>
1911
+			<emphasis>Example:</emphasis> log("This is a message\n");
1912
+		    </para>
1913
+		</listitem>
1898 1914
 		<listitem>
1899 1915
 		    <para>
1900
-			<command>if</command> - If statement.
1916
+			<command>error</command> - Report and error (same as log but in different log level).
1917
+		    </para>
1918
+		    <para>
1919
+			<emphasis>Example:</emphasis> error("This is an error message\n");
1920
+		    </para>
1921
+		</listitem>
1922
+
1923
+
1924
+	    </itemizedlist>
1925
+	    <itemizedlist>
1926
+		<title>Processing Control</title>
1927
+
1928
+		<listitem>
1929
+		    <para>
1930
+			<command>drop</command> - Drop the request and stop processing.
1931
+		    </para>
1932
+		    <para>
1933
+			<emphasis>Example:</emphasis> drop();
1934
+		    </para>
1935
+		</listitem>
1936
+
1937
+		<listitem>
1938
+		    <para>
1939
+			<command>route(n)</command> - call routing block route[n]{...};
1940
+			when the routing block n finishes processing, control is passed
1941
+			back to current block and processing continues.
1942
+		    </para>
1943
+		</listitem>
1944
+
1945
+		<listitem>
1946
+		    <para>
1947
+			<command>if</command> - Conditional statement.
1901 1948
 		    </para>
1902 1949
 		    <example>
1903 1950
 			<title>if</title>
... ...
@@ -1920,6 +1967,24 @@ if (...) {
1920 1967
 } else {
1921 1968
     ...
1922 1969
 };
1970
+</programlisting>
1971
+		    </example>
1972
+		</listitem>
1973
+	    </itemizedlist>
1974
+	    <itemizedlist>
1975
+		<title>Miscellaneous</title>
1976
+		<listitem>
1977
+		    <para>
1978
+			<command>len_gt</command> - If length of the message is greater than value given as parameter, the
1979
+			command will return 1 (indicating true). Otherwise -1 (indicating false) will be returned. It may take 'max_len' as parameter, in which case message size is limited
1980
+to internal buffer size BUF_SIZE (3040 by default).
1981
+		    </para>
1982
+		    <example>
1983
+			<title>len_gt</title>
1984
+			<programlisting format="linespecific">
1985
+if (len_gt(1000)) {
1986
+    ....
1987
+};
1923 1988
 </programlisting>
1924 1989
 		    </example>
1925 1990
 		</listitem>