Browse code

modules_k/outbound: updated example

Peter Dunkley authored on 01/01/2013 20:46:18
Showing 2 changed files
... ...
@@ -23,7 +23,7 @@ Peter Dunkley
23 23
 
24 24
         3. Parameters
25 25
 
26
-              3.1. force_outbound_bflag (integer)
26
+              3.1. force_outbound_flag (integer)
27 27
               3.2. flow_token_key (string)
28 28
 
29 29
         4. Functions
... ...
@@ -34,7 +34,7 @@ Peter Dunkley
34 34
    1.1. Compiling Kamailio with STUN support
35 35
    1.2. Edge Proxy Configuration
36 36
    1.3. Registrar Configuration
37
-   1.4. Set force_outbound_bflag parameter
37
+   1.4. Set force_outbound_flag parameter
38 38
    1.5. Set flow_token_key parameter
39 39
 
40 40
 Chapter 1. Admin Guide
... ...
@@ -53,7 +53,7 @@ Chapter 1. Admin Guide
53 53
 
54 54
    3. Parameters
55 55
 
56
-        3.1. force_outbound_bflag (integer)
56
+        3.1. force_outbound_flag (integer)
57 57
         3.2. flow_token_key (string)
58 58
 
59 59
    4. Functions
... ...
@@ -116,19 +116,33 @@ modparam("websocket", "keepalive_timeout", FLOW_TIMER+5)
116 116
 ...
117 117
 modparam("outbound", "flow_token_key", "!!!Kamailio rocks!!!")
118 118
 ...
119
-###TBD###
120
-
121
-   Example 1.3. Registrar Configuration
119
+route {
122 120
 ...
123
-#!define FLOW_TIMER     20
121
+        if (is_method("INVITE|SUBSCRIBE"))
122
+                record_route();
123
+        else if (is_method("REGISTER"))
124
+                add_path();
124 125
 ...
125
-tcp_connection_lifetime=FLOW_TIMER+10
126
+}
127
+...
128
+onreply_route {
129
+        if (!t_check_trans()) {
130
+                drop;
131
+        }
132
+
133
+        if ($rm == "REGISTER" && $rs >= 200 && $rs <= 299)
134
+        {
135
+                if ($(hdr(Require)[*])=~"outbound")
136
+                        insert_hf("Flow-Timer: FLOW_TIMER\r\n", "Call-ID");
137
+        }
138
+}
139
+
140
+   Example 1.3. Registrar Configuration
126 141
 ...
127 142
 loadmodule "registrar.so"
128 143
 ...
129
-modparam("registrar", "flow_timer", FLOW_TIMER)
144
+modparam("registrar", "outbound_mode", 2)
130 145
 ...
131
-###TBD###
132 146
 
133 147
 2. Dependencies
134 148
 
... ...
@@ -148,19 +162,19 @@ modparam("registrar", "flow_timer", FLOW_TIMER)
148 162
 
149 163
 3. Parameters
150 164
 
151
-   3.1. force_outbound_bflag (integer)
165
+   3.1. force_outbound_flag (integer)
152 166
    3.2. flow_token_key (string)
153 167
 
154
-3.1. force_outbound_bflag (integer)
168
+3.1. force_outbound_flag (integer)
155 169
 
156
-   A branch flag which, if set for a request, will force path and rr to
157
-   add flow tokens to Path: and Record-Route: headers regardless of the
158
-   request contents.
170
+   A flag which, if set for a request, will force path and rr to add flow
171
+   tokens to Path: and Record-Route: headers regardless of the request
172
+   contents.
159 173
 
160 174
    Default value is -1.
161 175
 
162
-   Example 1.4. Set force_outbound_bflag parameter
163
-modparam("outbound", "force_outbound_bflag", 1)
176
+   Example 1.4. Set force_outbound_flag parameter
177
+modparam("outbound", "force_outbound_flag", 1)
164 178
 
165 179
 3.2. flow_token_key (string)
166 180
 
... ...
@@ -71,22 +71,36 @@ modparam("websocket", "keepalive_timeout", FLOW_TIMER+5)
71 71
 ...
72 72
 modparam("outbound", "flow_token_key", "!!!Kamailio rocks!!!")
73 73
 ...
74
-###TBD###
74
+route {
75
+...
76
+	if (is_method("INVITE|SUBSCRIBE"))
77
+		record_route();
78
+	else if (is_method("REGISTER"))
79
+		add_path();
80
+...
81
+}
82
+...
83
+onreply_route {
84
+	if (!t_check_trans()) {
85
+		drop;
86
+	}
87
+
88
+	if ($rm == "REGISTER" && $rs >= 200 && $rs <= 299)
89
+	{
90
+		if ($(hdr(Require)[*])=~"outbound")
91
+			insert_hf("Flow-Timer: FLOW_TIMER\r\n", "Call-ID");
92
+	}
93
+}
75 94
 ]]></programlisting>
76 95
 	</example>
77 96
 	<example>
78 97
 	<title>Registrar Configuration</title>
79 98
 	<programlisting><![CDATA[
80 99
 ...
81
-#!define FLOW_TIMER	20
82
-...
83
-tcp_connection_lifetime=FLOW_TIMER+10
84
-...
85 100
 loadmodule "registrar.so"
86 101
 ...
87
-modparam("registrar", "flow_timer", FLOW_TIMER)
102
+modparam("registrar", "outbound_mode", 2)
88 103
 ...
89
-###TBD###
90 104
 ]]></programlisting>
91 105
 	</example>
92 106
 	</section>
... ...
@@ -123,17 +137,17 @@ modparam("registrar", "flow_timer", FLOW_TIMER)
123 137
 	<section>
124 138
 	<title>Parameters</title>
125 139
 	<section>
126
-		<title><varname>force_outbound_bflag</varname> (integer)</title>
127
-		<para>A branch flag which, if set for a request, will force
140
+		<title><varname>force_outbound_flag</varname> (integer)</title>
141
+		<para>A flag which, if set for a request, will force
128 142
 		<emphasis>path</emphasis> and <emphasis>rr</emphasis> to add
129 143
 		flow tokens to Path: and Record-Route: headers regardless of
130 144
 		the request contents.</para>
131 145
 		<para><emphasis>Default value is -1.</emphasis></para>
132 146
 		<example>
133
-		<title>Set <varname>force_outbound_bflag</varname> parameter
147
+		<title>Set <varname>force_outbound_flag</varname> parameter
134 148
 		</title>
135 149
 		<programlisting format="linespecific">
136
-modparam("outbound", "force_outbound_bflag", 1)
150
+modparam("outbound", "force_outbound_flag", 1)
137 151
 </programlisting>
138 152
 		</example>
139 153
 	</section>