I asynchronously report registration info to application server.
```
loadmodule "jansson.so"
loadmodule "http_async_client.so"
loadmodule "http_client.so"
modparam("http_client", "httpredirect", 0)
modparam("http_client", "useragent", "E-CSCF")
modparam("http_client", "maxdatasize", 64535)
modparam("http_client", "connection_timeout", 2)
modparam("http_client", "tlsversion", 6)
modparam("http_client", "keep_connections", 1)
modparam("http_client", "httpcon",
"lisendpoint=>https://example.com/LIS")
# Sending regisration info to LIS server
route[SEND_REGISTRATION_TO_LIS] {
xlog("L_ALERT","DEBUG: Sending registration info to LIS for
$fu\n");
$var(payload)='{}';
$var(json_request)='{}';
jansson_set("string", "call_id", $ci,
"$var(payload)");
jansson_set("integer", "msg_timestamp", $Ts,
"$var(payload)");
jansson_set("integer", "expires", $xavp(ulrcd[0]=>expires),
"$var(payload)");
jansson_set("string", "network_address", $si,
"$var(payload)");
jansson_set("integer", "network_port", $sp,
"$var(payload)");
jansson_set("string", "from", $fu,
"$var(payload)");
jansson_set("string", "user_agent", $ua,
"$var(payload)");
jansson_set("string", "contact", $ct,
"$var(payload)");
jansson_set("obj", "registration_update",
"$var(payload)", "$var(json_request)");
$http_req(suspend) = 0;
$http_req(hdr) = "Content-Type: application/json";
$http_req(body) = $var(json_request);
http_async_query("LIS_URL", "LIS_REPLY");
}
route[LIS_REPLY] {
if ($http_ok) {
xlog("L_INFO", "route[HTTP_REPLY]: status $http_rs\n");
xlog("L_INFO", "route[HTTP_REPLY]: body $http_rb\n");
} else {
xlog("L_INFO", "route[HTTP_REPLY]: error $http_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/issues/1794#issuecomment-452397776