Browse code

siputils: docs - updates to is_first_hop() for mode parameter

Daniel-Constantin Mierla authored on 11/05/2021 13:38:14
Showing 1 changed files
... ...
@@ -1169,22 +1169,35 @@ if (is_supported("outbound")) { ... }
1169 1169
 	</section>
1170 1170
 	<section id="siputils.f.is_first_hop">
1171 1171
 		<title>
1172
-			<function moreinfo="none">is_first_hop()</function>
1172
+			<function moreinfo="none">is_first_hop([mode])</function>
1173 1173
 		</title>
1174 1174
 		<para>
1175 1175
 		The function returns true if the proxy is first hop after the
1176
-		original sender. For incoming SIP requests, it means there is only
1177
-		one Via header. For incoming SIP replies, it means that top
1178
-		Record-Route URI is 'myself' and source address is not matching it
1179
-		(to avoid detecting in case of local loops). The detection is done
1180
-		only when Record-Route has an IP address in its URI (for a domain,
1181
-		it returns -1/false).
1176
+		original sender based on a best effort estimation by checking Via
1177
+		and Record-Route headers.
1178
+		</para>
1179
+		<para>
1180
+		For incoming SIP requests, it means there is only one Via header.
1181
+		</para>
1182
+		<para>
1183
+		For incoming SIP replies, if mode==0, it means that top Record-Route
1184
+		URI is 'myself' and source address is not matching local IP (to avoid
1185
+		detecting in case of local loops). Therefore for mode==0 the detection
1186
+		is done only when Record-Route has an IP address in its URI (for a domain,
1187
+		it returns -1/false). If mode==1, then the check of local IP is no
1188
+		longer done, only if top Record-Route is myself, returning true also if
1189
+		there is a domain, assuming that is expected no looping can happen
1190
+		based on config rules.
1182 1191
 		</para>
1183 1192
 		<para>
1184 1193
 		Note that it does not detect spirals, which can have the condition
1185 1194
 		for replies true also in the case of additional SIP reply reception.
1186 1195
 		</para>
1187 1196
 		<para>
1197
+		Parameter mode is optional and can be an integer or a varaible holding
1198
+		an integer. If not provided, the behaviour is like mode==0.
1199
+		</para>
1200
+		<para>
1188 1201
 		This function can be used from ANY_ROUTE.
1189 1202
 		</para>
1190 1203
 		<example>
... ...
@@ -1193,6 +1206,8 @@ if (is_supported("outbound")) { ... }
1193 1206
 ...
1194 1207
 if(is_first_hop()) { ... }
1195 1208
 ...
1209
+if(is_first_hop_mode("1")) { ... }
1210
+...
1196 1211
 </programlisting>
1197 1212
 		</example>
1198 1213
 	</section>