Browse code

siputils: docs for hdr_date_check()

Daniel-Constantin Mierla authored on 16/06/2021 10:09:36
Showing 1 changed files
... ...
@@ -1354,6 +1354,37 @@ if (is_method("REGISTER") and src_ip == 1.2.3.4) {
1354 1354
     contact_param_rm("myparam");
1355 1355
 }
1356 1356
 ...
1357
+</programlisting>
1358
+		</example>
1359
+	</section>
1360
+	<section id="siputils.f.hdr_date_check">
1361
+		<title>
1362
+		<function moreinfo="none">hdr_date_check(tdiff)</function>
1363
+		</title>
1364
+		<para>
1365
+		Returns true if sip message has Date header and its value is lower
1366
+		than 'NOW() - tdiff'.
1367
+		</para>
1368
+		<para>Meaning of the parameters is as follows:</para>
1369
+		<itemizedlist>
1370
+		<listitem>
1371
+			<para><emphasis>tdiff</emphasis> - time difference in seconds,
1372
+			it can be a variable or static integer value.
1373
+			</para>
1374
+		</listitem>
1375
+		</itemizedlist>
1376
+		<para>
1377
+		This function can be used from ANY_ROUTE.
1378
+		</para>
1379
+		<example>
1380
+		<title><function>hdr_date_check</function> usage</title>
1381
+		<programlisting format="linespecific">
1382
+...
1383
+if (!hdr_date_check("10")) {
1384
+    sl_send_reply("403", "Outdated date");
1385
+    exit;
1386
+}
1387
+...
1357 1388
 </programlisting>
1358 1389
 		</example>
1359 1390
 	</section>