Browse code

- added retcode variable in script - pseudo-variable $rc represents last returned code in script - texops documentation updated

git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@65 689a6050-402a-0410-94f2-e92a70836424

Daniel-Constantin Mierla authored on 28/06/2005 12:42:09
Showing 2 changed files
... ...
@@ -163,11 +163,21 @@ replace_all("ser", "Sip Express Router");
163 163
      * '/re/repl/flags' - sed like regular expression. flags can
164 164
        be a combination of i (case insensitive), g (global) or s
165 165
        (match newline don't treat it as end of line).
166
+       're' - is regular expresion
167
+       'repl' - is replacement string - may contain
168
+       pseudo-varibales
169
+       'flags' - substitution flags (i - ignore case, g - global)
166 170
 
167 171
    Example 1-5. subst usage
168 172
 ...
169 173
 # replace the uri in to: with the message uri (just an example)
170 174
 if ( subst('/^To:(.*)sip:[^@]*@[a-zA-Z0-9.]+(.*)$/t:\1\u\2/ig') ) {};
175
+
176
+# replace the uri in to: with the value of avp sip_address (just an exa
177
+mple)
178
+if ( subst('/^To:(.*)sip:[^@]*@[a-zA-Z0-9.]+(.*)$/t:\1$avp(sip_address)
179
+\2/ig') ) {};
180
+
171 181
 ...
172 182
      _________________________________________________________
173 183
 
... ...
@@ -181,6 +191,10 @@ if ( subst('/^To:(.*)sip:[^@]*@[a-zA-Z0-9.]+(.*)$/t:\1\u\2/ig') ) {};
181 191
      * '/re/repl/flags' - sed like regular expression. flags can
182 192
        be a combination of i (case insensitive), g (global) or s
183 193
        (match newline don't treat it as end of line).
194
+       're' - is regular expresion
195
+       'repl' - is replacement string - may contain
196
+       pseudo-varibales
197
+       'flags' - substitution flags (i - ignore case, g - global)
184 198
 
185 199
    Example 1-6. subst_uri usage
186 200
 ...
... ...
@@ -189,6 +203,12 @@ if ( subst('/^To:(.*)sip:[^@]*@[a-zA-Z0-9.]+(.*)$/t:\1\u\2/ig') ) {};
189 203
 # as a parameter: orig_uri (just an example)
190 204
 if (subst_uri('/^sip:([0-9]+)@(.*)$/sip:3463\1@\2;orig_uri=\0/i')){$
191 205
 
206
+# adds the avp 'uri_prefix' as prefix to numeric uris, and save the ori
207
+ginal
208
+# uri (\0 match) as a parameter: orig_uri (just an example)
209
+if (subst_uri('/^sip:([0-9]+)@(.*)$/sip:$avp(uri_prefix)\1@\2;orig_uri=
210
+\0/i')){$
211
+
192 212
 ...
193 213
      _________________________________________________________
194 214
 
... ...
@@ -202,12 +222,21 @@ if (subst_uri('/^sip:([0-9]+)@(.*)$/sip:3463\1@\2;orig_uri=\0/i')){$
202 222
      * '/re/repl/flags' - sed like regular expression. flags can
203 223
        be a combination of i (case insensitive), g (global) or s
204 224
        (match newline don't treat it as end of line).
225
+       're' - is regular expresion
226
+       'repl' - is replacement string - may contain
227
+       pseudo-varibales
228
+       'flags' - substitution flags (i - ignore case, g - global)
205 229
 
206 230
    Example 1-7. subst usage
207 231
 ...
208 232
 # adds 3463 prefix to uris ending with 3642 (just an example)
209 233
 if (subst_user('/3642$/36423463/')){$
210 234
 
235
+...
236
+# adds avp 'user_prefix' as prefix to username in r-uri ending with 364
237
+2
238
+if (subst_user('/(.*)3642$/$avp(user_prefix)\13642/')){$
239
+
211 240
 ...
212 241
      _________________________________________________________
213 242
 
... ...
@@ -186,6 +186,15 @@ replace_all("ser", "Sip Express Router");
186 186
 				expression. flags can be a combination of i (case insensitive),
187 187
 				g (global) or s (match newline don't treat it as end of line).
188 188
 			</para>
189
+			<para>
190
+			're' - is regular expresion
191
+			</para>
192
+			<para>
193
+			'repl' - is replacement string - may contain pseudo-varibales
194
+			</para>
195
+			<para>
196
+			'flags' - substitution flags (i - ignore case, g - global)
197
+			</para>
189 198
 		</listitem>
190 199
 		</itemizedlist>
191 200
 		<example>
... ...
@@ -194,6 +203,10 @@ replace_all("ser", "Sip Express Router");
194 203
 ...
195 204
 # replace the uri in to: with the message uri (just an example)
196 205
 if ( subst('/^To:(.*)sip:[^@]*@[a-zA-Z0-9.]+(.*)$/t:\1\u\2/ig') ) {};
206
+
207
+# replace the uri in to: with the value of avp sip_address (just an example)
208
+if ( subst('/^To:(.*)sip:[^@]*@[a-zA-Z0-9.]+(.*)$/t:\1$avp(sip_address)\2/ig') ) {};
209
+
197 210
 ...
198 211
 </programlisting>
199 212
 		</example>
... ...
@@ -214,6 +227,15 @@ if ( subst('/^To:(.*)sip:[^@]*@[a-zA-Z0-9.]+(.*)$/t:\1\u\2/ig') ) {};
214 227
 				expression. flags can be a combination of i (case insensitive),
215 228
 				g (global) or s (match newline don't treat it as end of line).
216 229
 			</para>
230
+			<para>
231
+			're' - is regular expresion
232
+			</para>
233
+			<para>
234
+			'repl' - is replacement string - may contain pseudo-varibales
235
+			</para>
236
+			<para>
237
+			'flags' - substitution flags (i - ignore case, g - global)
238
+			</para>
217 239
 		</listitem>
218 240
 		</itemizedlist>
219 241
 		<example>
... ...
@@ -224,6 +246,10 @@ if ( subst('/^To:(.*)sip:[^@]*@[a-zA-Z0-9.]+(.*)$/t:\1\u\2/ig') ) {};
224 246
 # as a parameter: orig_uri (just an example)
225 247
 if (subst_uri('/^sip:([0-9]+)@(.*)$/sip:3463\1@\2;orig_uri=\0/i')){$
226 248
 
249
+# adds the avp 'uri_prefix' as prefix to numeric uris, and save the original
250
+# uri (\0 match) as a parameter: orig_uri (just an example)
251
+if (subst_uri('/^sip:([0-9]+)@(.*)$/sip:$avp(uri_prefix)\1@\2;orig_uri=\0/i')){$
252
+
227 253
 ...
228 254
 </programlisting>
229 255
 		</example>
... ...
@@ -244,6 +270,15 @@ if (subst_uri('/^sip:([0-9]+)@(.*)$/sip:3463\1@\2;orig_uri=\0/i')){$
244 270
 				expression. flags can be a combination of i (case insensitive),
245 271
 				g (global) or s (match newline don't treat it as end of line).
246 272
 			</para>
273
+			<para>
274
+			're' - is regular expresion
275
+			</para>
276
+			<para>
277
+			'repl' - is replacement string - may contain pseudo-varibales
278
+			</para>
279
+			<para>
280
+			'flags' - substitution flags (i - ignore case, g - global)
281
+			</para>
247 282
 		</listitem>
248 283
 		</itemizedlist>
249 284
 		<example>
... ...
@@ -253,6 +288,10 @@ if (subst_uri('/^sip:([0-9]+)@(.*)$/sip:3463\1@\2;orig_uri=\0/i')){$
253 288
 # adds 3463 prefix to uris ending with 3642 (just an example)
254 289
 if (subst_user('/3642$/36423463/')){$
255 290
 
291
+...
292
+# adds avp 'user_prefix' as prefix to username in r-uri ending with 3642
293
+if (subst_user('/(.*)3642$/$avp(user_prefix)\13642/')){$
294
+
256 295
 ...
257 296
 </programlisting>
258 297
 		</example>