-
Notifications
You must be signed in to change notification settings - Fork 909
/
curlapi.cfg
67 lines (51 loc) · 1.98 KB
/
curlapi.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Test of the new http_client API module
#
# (C) 2016 Edvina AB, Sollentuna, Sweden. All rights reserved.
#
#
debug=2
log_stderror=yes
fork=no
# ------------------ module loading ----------------------------------
# Set a path to known locations for modules
#
mpath="/usr/local/lib64/kamailio/modules:/usr/local/lib/kamailio/modules:/usr/lib64/kamailio/modules:/usr/lib/kamailio/modules"
loadmodule "pv.so" # For pseudo-variable support in log messages etc
loadmodule "xlog.so" # For extended logging with pseudovariables
loadmodule "kex.so" # Kamailio extensions:
# Script flags and basic mi commands (version, pwd, get_statistics)
#
#
loadmodule "sl.so" # Stateless replies - needed by registrar.so
loadmodule "rtimer.so" # For ticks
loadmodule "htable.so" # For init event route
loadmodule "cfgutils.so" # Memory debugging
loadmodule "http_client.so" # The HTTP client module
loadmodule "httpapitest.so" # The HTTP client API test module -using the API to http_client.so
# main routing logic
modparam("http_client", "connection_timeout", 42);
modparam("http_client", "keep_connections", 1);
modparam("http_client", "maxdatasize", 1000);
modparam("http_client", "useragent", "Olle's Peace and Restful little HTTP grabber 42.3");
#user and password
modparam("http_client", "httpcon", "lisa=>https://www.kamailio.org/w/");
# ------------------------- request routing logic -------------------
route {
sl_send_reply(400, "Do not wake me up");
exit;
}
onreply_route {
xlog("L_INFO", "<-- Incoming response: $rs $rr - from $si\n");
}
onsend_route
{
xlog("ONSEND --> Sending from $sndfrom(proto):$sndfrom(ip):$sndfrom(port) to $sndto(proto):$sndto(ip):$sndto(port) \n");
}
# This route is executed at Kamailio start
event_route[htable:mod-init]
{
xlog("L_ERR", "### Kamailio starting $timef(%HH:%mm) \n");
$var(html) = "";
$var(res) = test_http_connect("lisa", "", "$avp(html)");
xlog("L_ERR", "-- Lisa http_client connection: Result $var(res) Response:\n--------\n$avp(html)\n------\n");
}