[sr-dev] [kamailio/kamailio] extensions to lost and http_client modules (#2675)
Wolfgang Kampichler
notifications at github.com
Sun Apr 4 22:21:04 CEST 2021
@wkampich commented on this pull request.
> + </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,;});
@sergey-safarov: you may use the following to dereference multiple header fields:
```
## 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"
```
...
```
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");
}
}
}
}
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2675#discussion_r606849461
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20210404/b5672e9e/attachment.htm>
More information about the sr-dev
mailing list