Browse code

registrar: docs for reg_from_user() function

Daniel-Constantin Mierla authored on 20/05/2022 11:26:00
Showing 1 changed files
... ...
@@ -1813,6 +1813,52 @@ save("location", "0x2");
1813 1813
 ...
1814 1814
 reg_send_reply();
1815 1815
 ...
1816
+</programlisting>
1817
+		</example>
1818
+	</section>
1819
+	<section id="registrar.f.reg_from_user">
1820
+		<title>
1821
+		<function moreinfo="none">reg_from_user(ultable, uri, mode)</function>
1822
+		</title>
1823
+		<para>
1824
+			The function returns true if the SIP message comes from the user
1825
+			identified by 'uri' parameter by matching the associated location
1826
+			records. The matching is done with the field 'received' if it is set,
1827
+			otherwise with the contact address.
1828
+		</para>
1829
+		<para>Meaning of the parameters is as follows:</para>
1830
+		<itemizedlist>
1831
+		<listitem>
1832
+			<para>
1833
+			<emphasis>ultable</emphasis> - user location table (e.g., 'location')
1834
+			</para>
1835
+		</listitem>
1836
+		<listitem>
1837
+			<para>
1838
+			<emphasis>uri</emphasis> - SIP URI to identify the location records
1839
+			to match against.
1840
+			</para>
1841
+		</listitem>
1842
+		<listitem>
1843
+			<para>
1844
+			<emphasis>mode</emphasis> - matching mode (int) - host part (IP address)
1845
+			is matched always. If mode has bit 1 set (value 1), then the port is
1846
+			matched as well. If mode has bit 2 set (value 2), then the protocol
1847
+			is matched as well.
1848
+			</para>
1849
+		</listitem>
1850
+		</itemizedlist>
1851
+		<para>
1852
+		This function can be used from ANY_ROUTE.
1853
+		</para>
1854
+		<example>
1855
+		<title><function>reg_from_user</function> usage</title>
1856
+		<programlisting format="linespecific">
1857
+...
1858
+if(reg_from_user("location", "sip:alice@server.com", "0")) {
1859
+    # message coming from where 'alice' sent before a REGISTER request
1860
+}
1861
+...
1816 1862
 </programlisting>
1817 1863
 		</example>
1818 1864
 	</section>