Browse code

clarifications on accounting and stateful UAS added

Jiri Kuthan authored on 07/01/2003 23:35:37
Showing 2 changed files
... ...
@@ -1689,7 +1689,7 @@ route{
1689 1689
 	    </section>
1690 1690
 
1691 1691
 	    <section id="statefulua">
1692
-		<title>Stateful User Agent</title>
1692
+		<title>Stateful User Agent Server</title>
1693 1693
 		<para>
1694 1694
 		    This examples shows how to make ser act as a stateful user
1695 1695
 		    agent (UA). Ability to act as as a stateful UA is essential
... ...
@@ -1723,8 +1723,22 @@ route{
1723 1723
 		    a reply for a request. It generates the reply statefully,
1724 1724
 		    i.e., it is kept for future retransmissions in memory.
1725 1725
 		</para>
1726
+		<note>
1727
+			<para>
1728
+				Applications that do not need stateful processing
1729
+				may act as stateless UA Server too. They just use
1730
+				the <command>sl_send_reply</command> action to
1731
+				send replies to requests without keeping any
1732
+				state. The benefit is memory cannot run out,
1733
+				the drawback is that each retransmission needs to
1734
+				be processed as a new request. An example of use
1735
+				of a stateless server is shown in
1736
+		    	<xref linkend="redirectserver"> and
1737
+		    	<xref linkend="executingscript">.
1738
+			</para>
1739
+		</note>
1726 1740
 		<example>
1727
-		    <title>Stateful UA</title>
1741
+		    <title>Stateful UA Server</title>
1728 1742
 		    <programlisting format="linespecific">
1729 1743
 			<!-- ../../examples/uas.cfg -->
1730 1744
 			&statefuluaexample;
... ...
@@ -1732,7 +1746,7 @@ route{
1732 1746
 		</example>
1733 1747
 	    </section> <!-- Stateful UAS -->
1734 1748
 
1735
-	    <section>
1749
+	    <section id="redirectserver">
1736 1750
 		<title>Redirect Server</title>
1737 1751
 		<para>
1738 1752
 		    The redirect example shows how to redirect a request
... ...
@@ -1768,7 +1782,7 @@ route{
1768 1782
 		</example>
1769 1783
 	    </section> <!-- redirect server-->
1770 1784
 	    
1771
-	    <section>
1785
+	    <section id="executingscript">
1772 1786
 		<title>Executing External Script</title>
1773 1787
 		<para>
1774 1788
 		    Like in the previous example, we show how to
... ...
@@ -1802,6 +1816,20 @@ route{
1802 1816
 		    is much easier: it prints fixed URIs on its output using
1803 1817
 		    shell script <command moreinfo="none">echo</command> command.
1804 1818
 		</para>
1819
+		<note>
1820
+			<para>
1821
+				This script works statelessly -- it uses this action for
1822
+				stateless replying, <command>sl_send_reply</command>.
1823
+				No transaction is kept in memory and each request retransmission
1824
+				is processed as a brand-new request. That may be a particular
1825
+				concern if the server logic (<command>exec</command> actions
1826
+				in this example) is too expensive. See 
1827
+		    	<xref linkend="statefulua"> for instructions on how
1828
+				to make server logic stateful, so that retransmissions
1829
+				are absorbed and do not cause re-execution of the logic.
1830
+			
1831
+			</para>
1832
+		</note>
1805 1833
 		<example id="execscript">
1806 1834
 		    <title>Executing External Script</title>
1807 1835
 		    <programlisting format="linespecific">
... ...
@@ -2550,7 +2578,24 @@ MySql Password:
2550 2578
 			<para>
2551 2579
 			    To enable call accounting, tm and acc modules need to be loaded,
2552 2580
 			    requests need to be processed statefuly and labeled for
2553
-			    accounting.
2581
+			    accounting. That means, if you want a transaction to be reported,
2582
+				the initial request must have taken the path 
2583
+				"<command>setflag(X)</command>, <command>t_relay</command>"
2584
+				in <application>ser</application> script. X must have the
2585
+				value configured in <varname>acc_flag</varname>
2586
+				configuration option.
2587
+			</para>
2588
+			<para>
2589
+				Also note, that by default only transactions that initiate
2590
+				a SIP dialog (typically INVITE) visit a proxy server.
2591
+				Subsequent transactions are exhanged directly between
2592
+				end-devices, do not visit proxy server and cannot be
2593
+				reported. To be able to report on subsequent transactions,
2594
+				you need to force them visit proxy server by turning 
2595
+				record-routing on. 
2596
+			</para>
2597
+			<para>
2598
+				
2554 2599
 			    <example>
2555 2600
 				<title>Configuration with Enabled Accounting</title>
2556 2601
 				<programlisting format="linespecific">
... ...
@@ -10,6 +10,7 @@ loadmodule "modules/tm/tm.so"
10 10
 loadmodule "modules/acc/acc.so"
11 11
 loadmodule "modules/sl/sl.so"
12 12
 loadmodule "modules/maxfwd/maxfwd.so"
13
+loadmodule "modules/rr/rr.so"
13 14
 
14 15
 # ----------------- setting module-specific parameters ---------------
15 16
 
... ...
@@ -39,10 +40,15 @@ route{
39 40
 		break;
40 41
 	};
41 42
 
42
-	# nummerical destinations will be labeled for accounting, others not
43
-	if (uri=~"sip:\+?[0-9]+@") {
44
-		setflag(1);
45
-	};
43
+    # Do strict routing if pre-loaded route headers present due to
44
+	# previous use of record-routing
45
+    rewriteFromRoute();
46
+
47
+	# labeled all transaction for accounting
48
+	setflag(1);
49
+
50
+	# record-route INVITES to make sure BYEs will visit our server too
51
+	if (method=="INVITE") addRecordRoute();
46 52
 
47 53
 	# forward the request statefuly now; (we need *stateful* forwarding,
48 54
 	# because the stateful mode correlates requests with replies and