<p></p>
<p><b>@wkampich</b> commented on this pull request.</p>
<hr>
<p>In <a href="https://github.com/kamailio/kamailio/pull/2675#discussion_r606849461">src/modules/lost/doc/lost_admin.xml</a>:</p>
<pre style='color:#555'>> + </itemizedlist>
+ <para>
+ The return value is 200 on success, 400 if an internal error occured, or 500 if an
+ error code is returned in the HELD response.
+ </para>
+ <para>
+ This function can be used from REQUEST_ROUTE,
+ ONREPLY_ROUTE, FAILURE_ROUTE, and BRANCH_ROUTE.
+ </para>
+ <example>
+ <title><function>lost_held_dereference()</function> usage</title>
+ <programlisting format="linespecific">
+...
+# HELD location dereference
+if ($hdr(Geolocation)=~"^<http.*$") {
+ $var(url) = $(hdr(Geolocation){s.select,0,;});
</pre>
<p><a class="user-mention" data-hovercard-type="user" data-hovercard-url="/users/sergey-safarov/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/sergey-safarov">@sergey-safarov</a>: you may use the following to dereference multiple header fields:</p>
<pre><code>## response time in ms: 20000, or 'emergencyRouting' or 'emergencyDispatch'
#!substdef "!MY_LOC_TIME!emergencyDispatch!g"
## location type: 'any', 'civic', 'geodetic', or 'civic geodetic'
#!substdef "!MY_LOC_TYPE!any!g"
</code></pre>
<p>...</p>
<pre><code>if(is_present_hf("Geolocation")) {
$var(count) = 0;
while($var(count) < $hdrc(Geolocation)) {
$var(geo) = $(hdr(Geolocation)[$var(count)]);
if ($var(geo)=~"^<http.*$") {
$var(url) = $(var(geo){s.select,0,;});
xlog("L_INFO", "### HELD dereferencing location at: $(var(url){s.unbracket})\n");
$var(res) = lost_held_dereference("$(var(url){s.unbracket})", "MY_LOC_TIME", "MY_LOC_TYPE", "$var(pidf)", "$var(err)");
if ($var(res) == 200) {
xlog("L_INFO", "### HELD dereference request returned loc:\n$var(pidf)\n");
} else {
xlog("L_INFO", "### held request failed with $var(err)\n");
}
}
}
}
</code></pre>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/pull/2675#discussion_r606849461">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZOJMR3X3XDIVFXUI3LTHDC3BANCNFSM4ZGSJGLQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABO7UZNYJSOXGC6UI72H4X3THDC3BA5CNFSM4ZGSJGL2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOEVT7KTI.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/pull/2675#discussion_r606849461",
"url": "https://github.com/kamailio/kamailio/pull/2675#discussion_r606849461",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>