Browse code

examples are included now (better than copy'n'paste)

Jiri Kuthan authored on 04/10/2002 21:22:47
Showing 1 changed files
... ...
@@ -1,9 +1,21 @@
1 1
 <!-- $Id$ -->
2
-<!DOCTYPE Book PUBLIC "-//OASIS//DTD DocBook V4.2//EN">
3
-<!-- DOCTYPE Book SYSTEM "/usr/share/sgml/docbook/dtd-4.2/docbook.dtd" -->
2
+<!-- DOCTYPE Book SYSTEM "/usr/share/sgml/docbook/dtd-4.2/docbook.dtd" [ -->
3
+<!DOCTYPE Book PUBLIC "-//OASIS//DTD DocBook V4.2//EN" [ 
4
+
5
+
6
+<!ENTITY execexample SYSTEM "../../examples/exec.cfg">
7
+<!ENTITY redirectexample SYSTEM "../../examples/redirect.cfg">
8
+<!ENTITY replyexample SYSTEM "../../examples/onr.cfg">
9
+<!ENTITY statefuluaexample SYSTEM "../../examples/uas.cfg">
10
+
11
+]>
12
+
4 13
 
5 14
 <book label="seruser" id="seruser" lang="EN">
15
+
6 16
 <?dbhtml filename="index.html">
17
+
18
+
7 19
     <title>iptel.org SIP Express Router v0.8.8 -- User's Guide</title>
8 20
     <bookinfo>
9 21
 	<authorgroup>
... ...
@@ -821,84 +833,9 @@ t_relay_to("192.168.99.100", "5060");
821 833
 		<example>
822 834
 		    <title>Stateful UA</title>
823 835
 		    <programlisting format="linespecific">
824
-#
825
-# $Id$
826
-#
827
-# this example shows usage of ser as user agent
828
-# server which does some functionality (in this
829
-# example, 'log' is used to print a notification
830
-# on a new transaction) and behaves statefully
831
-# (e.g., it retransmits replies on request
832
-# retransmissions)
833
-
834
-# ----------- global configuration parameters ------------------------
835
-
836
-debug=3
837
-fork=no
838
-#children=2
839
-log_stderror=yes        # (cmd line: -E)
840
-check_via=yes     # (cmd. line: -v)
841
-dns=0           # (cmd. line: -r)
842
-rev_dns=0      # (cmd. line: -R)
843
-port=5068
844
-reply_to_via=no
845
-
846
-
847
-# ------------------ module loading ----------------------------------
848
-
849
-loadmodule "/usr/lib/ser/modules/sl.so"
850
-loadmodule "/usr/lib/ser/modules/print.so"
851
-loadmodule "/usr/lib/ser/modules/tm.so"
852
-loadmodule "/usr/lib/ser/modules/usrloc.so"
853
-
854
-# ----------------- setting module-specific parameters ---------------
855
-
856
-# -- usrloc params --
857
-
858
-modparam("usrloc", "use_database",   0)
859
-modparam("usrloc", "flush_interval", 3600)
860
-# -------------------------  request routing logic -------------------
861
-
862
-# main routing logic
863
-
864
-route {
865
-    # for testing purposes, simply okay all REGISTERs
866
-    if (method=="REGISTER") {
867
-        log("REGISTER");
868
-        sl_send_reply("200", "ok");
869
-        #t_replicate("localhost", "9");
870
-        break;
871
-    };
872
-		
873
-    # print a message if a call was missed
874
-
875
-    if ( t_newtran())
876
-    {
877
-        if (method=="ACK") {
878
-            log("oops--ACK to a non-existent transaction");
879
-            drop;
880
-        };
881
-
882
-        log("New Transaction Arrived\n");
883
-        # do what you want to do as a sever
884
-        if (uri=~"a@") {
885
-            if (!t_reply("409", "Bizzar Error")) {
886
-                sl_reply_error();
887
-            };
888
-        } else if (uri=~"b@") {
889
-            if (!t_reply("979", "You did not expect this did you")) {
890
-                sl_reply_error();
891
-            };
892
-        } else {
893
-            if (!t_reply("699", "I don't want to chat with you")) {
894
-                sl_reply_error();
895
-            };
896
-        } ;
897
-    } else {
898
-        sl_reply_error();
899
-    };
900
-}
901
-</programlisting>
836
+			<!-- ../../examples/uas.cfg -->
837
+			&statefuluaexample;
838
+		    </programlisting>
902 839
 		</example>
903 840
 	    </section> <!-- Stateful UAS -->
904 841
 
... ...
@@ -929,44 +866,9 @@ route {
929 866
 		<example>
930 867
 		    <title>Redirect Server</title>
931 868
 		    <programlisting format="linespecific">
932
-#
933
-# $Id$
934
-#
935
-# this example shows use of ser as stateless redirect server
936
-#
937
-
938
-# ----------- global configuration parameters ------------------------
939
-
940
-debug=3
941
-fork=no
942
-log_stderror=yes        # (cmd line: -E)
943
-check_via=no # (cmd. line: -v)
944
-dns=no # (cmd. line: -r)
945
-syn_branch=1
946
-reply_to_via=0
947
-
948
-# ------------------ module loading ----------------------------------
949
-
950
-loadmodule "/usr/lib/ser/modules/sl.so"
951
-loadmodule "/usr/lib/ser/modules/print.so"
952
-
953
-
954
-# -------------------------  request routing logic -------------------
955
-
956
-# main routing logic
957
-
958
-route{
959
-    # for testing purposes, simply okay all REGISTERs
960
-    if (method=="REGISTER") {
961
-        log("REGISTER");
962
-        sl_send_reply("200", "ok");
963
-        break;
964
-    };
965
-    append_branch("sip:parallel@iptel.org:9");
966
-    append_branch("sip:redirect@iptel.org:9");
967
-    sl_send_reply("300", "Redirect");
968
-}
969
-</programlisting>
869
+			<!-- ../../examples/redirect.cfg -->
870
+			&redirectexample;
871
+		    </programlisting>
970 872
 		</example>
971 873
 	    </section> <!-- redirect server-->
972 874
 	    
... ...
@@ -1004,56 +906,9 @@ route{
1004 906
 		<example>
1005 907
 		    <title>Executing External Script</title>
1006 908
 		    <programlisting format="linespecific">
1007
-#
1008
-# $Id$
1009
-#
1010
-# this example shows use of ser as stateless redirect server
1011
-# which rewrites URIs using an external utility
1012
-#
1013
-
1014
-# ----------- global configuration parameters ------------------------
1015
-
1016
-debug=4
1017
-fork=1
1018
-log_stderror=yes        # (cmd line: -E)
1019
-check_via=no # (cmd. line: -v)
1020
-dns=no # (cmd. line: -r)
1021
-syn_branch=1
1022
-reply_to_via=0
1023
-
1024
-# ------------------ module loading ----------------------------------
1025
-
1026
-loadmodule "/usr/lib/ser/modules/sl.so"
1027
-loadmodule "/usr/lib/ser/modules/print.so"
1028
-loadmodule "/usr/lib/ser/modules/exec_mod.so"
1029
-loadmodule "/usr/lib/ser/modules/ext.so"
1030
-
1031
-# -------------------------  request routing logic -------------------
1032
-
1033
-# main routing logic
1034
-
1035
-route{
1036
-    # for testing purposes, simply okay all REGISTERs
1037
-    if (method=="REGISTER") {
1038
-        log("REGISTER");
1039
-        sl_send_reply("200", "ok");
1040
-        break;
1041
-    };
1042
-
1043
-    # first dump the message to a file using cat command
1044
-    exec_msg("printenv SRCIP > /tmp/exectest.txt; cat >> /tmp/exectest.txt")
1045
-    # and then rewrite URI using external utility
1046
-    # note that the last echo command trashes input parameter
1047
-    if (exec_uri("echo sip:mra@iptel.org;echo sip:mrb@iptel.org;echo>/dev/null")) {
1048
-
1049
-    if (exec_uri("/tmp/sh.sh")) {
1050
-        sl_send_reply("300", "Redirect");
1051
-    } else {
1052
-        sl_reply_error();
1053
-        log(1, "alas, rewriting failed\n");
1054
-    };
1055
-}
1056
-</programlisting>
909
+			<!-- ../../examples/exec.cfg -->
910
+			&execexample;
911
+		    </programlisting>
1057 912
 		</example>
1058 913
 	    </section> <!-- exec example -->
1059 914
 	    
... ...
@@ -1073,74 +928,9 @@ route{
1073 928
 		<example>
1074 929
 		    <title>Reply Processing</title>
1075 930
 		    <programlisting format="linespecific">
1076
-#
1077
-# example script showing both types of forking;
1078
-# incoming message is forked in parallel to
1079
-# 'nobody' and 'parallel', if no positive reply
1080
-# appears with final_response timer, nonsense
1081
-# is retried (serial forking); than, destination
1082
-# 'foo' is given last chance
1083
-
1084
-# ----------- global configuration parameters ------------------------
1085
-
1086
-debug=3
1087
-fork=no
1088
-log_stderror=yes        # (cmd line: -E)
1089
-check_via=no # (cmd. line: -v)
1090
-dns=no # (cmd. line: -r)
1091
-syn_branch=1
1092
-reply_to_via=0
1093
-
1094
-
1095
-# ------------------ module loading ----------------------------------
1096
-
1097
-loadmodule "/usr/lib/ser/modules/sl.so"
1098
-loadmodule "/usr/lib/ser/modules/print.so"
1099
-loadmodule "/usr/lib/ser/modules/tm.so"
1100
-
1101
-# ----------------- setting module-specific parameters ---------------
1102
-
1103
-# -- tm params --
1104
-modparam("tm", "fr_timer", 10 )
1105
-modparam("tm", "fr_inv_timer", 5 )
1106
-
1107
-# -------------------------  request routing logic -------------------
1108
-
1109
-# main routing logic
1110
-
1111
-route {
1112
-    # for testing purposes, simply okay all REGISTERs
1113
-    if (method=="REGISTER") {
1114
-        log("REGISTER");
1115
-        sl_send_reply("200", "ok");
1116
-        break;
1117
-    };
1118
-    # print a message if a call was missed
1119
-    seturi("sip:nobody@iptel.org");
1120
-    /* parallel branch to sink port -- that will make it
1121
-       wait until timer hits
1122
-     */
1123
-
1124
-    append_branch("sip:parallel@iptel.org:9");
1125
-    t_on_negative("1");
1126
-    # start parallel forking to nobody and wer.xmla 
1127
-    log(1,"about to relay\n");
1128
-    t_relay();
1129
-}
1130
-
1131
-reply_route[1] {
1132
-    rewriteuri("sip:nonsense@iptel.org");
1133
-    append_branch();
1134
-    log(1,"first redirection\n");
1135
-    t_on_negative("2");
1136
-}
1137
-
1138
-reply_route[2] {
1139
-    rewriteuri("sip:foo@iptel.org");
1140
-    log(1, "second redirection\n");
1141
-    append_branch();
1142
-}
1143
-</programlisting>
931
+			<!-- ../../examples/onr.cfg -->
932
+			&replyexample;
933
+		    </programlisting>
1144 934
 
1145 935
 		</example>
1146 936
 	    </section> <!-- reply processing -->
... ...
@@ -2327,9 +2117,6 @@ Domain Registered Expired
2327 2117
     <!-- TODO
2328 2118
 
2329 2119
 
2330
-    INCLUDING
2331
-    - the examples and license should be better included
2332
-
2333 2120
     MISSING
2334 2121
     - route
2335 2122
     - modules