Hi all,
We are new to Kamailio world.
I have written a very small code, where we want to just receive INVITE and send
480 and trigger external application on http interface. I am only sending 1
INVITE/ACK request for now.
Code:
request_route {
t_newtran();
xlog("L_WARN", "APP-1 Receive Incoming call $rm\n");
t_send_reply("480", "Temporarily Unavailable");
jansson_set("string", "callingMSISDN", "calling", "$var(body)");
xlog(" OUT => BODY:\n$var(body)\n");
xlog("HTTP OUT => BODY:\n$http_req(body)\n");
$http_req(suspend) = 0;
$http_req(body) = $var(body);
http_async_query(http://10.20.10.120:7000/v1/mca-events, "HTTP_REPLY");
exit;
Output
loading modules under config path: /usr/local/lib64/kamailio/modules/
Listening on
udp: 10.20.10.119:5065
Aliases:
udp: signaling-server1:5065
*: 10.20.10.119:*
1(37861) WARNING: <script>: APP-1 Receive Incoming call INVITE
1(37861) ERROR: <script>: OUT => BODY:
{"callingMSISDN":"calling"}
1(37861) ERROR: <script>: HTTP OUT => BODY:
<null>
2(37862) WARNING: <script>: APP-1 Receive Incoming call ACK
2(37862) ERROR: <script>: OUT => BODY:
{"callingMSISDN":"calling"}
2(37862) ERROR: <script>: HTTP OUT => BODY:
<null>
8(37868) ERROR: <script>: HTTP request failed or returned error: <null>,
status: 400
8(37868) ERROR: <script>: HTTP request failed or returned error: <null>,
status: 400
We are not able to set the parameter in body. For now a dummy value in inserted.
As per
https://www.kamailio.org/docs/modules/stable/modules/http_async_client.html
http_req is allowed in async calls.
The following is the version.
root@signaling-server1:/usr/local/etc/kamailio# kamailio -v
version: kamailio 6.0.5 (x86_64/linux) 900efe
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE,
USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, MEM_JOIN_FREE, Q_MALLOC,
F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT,
USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLOCKLIST, HAVE_RESOLV_RES,
TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_SEND_BUFFER_SIZE
262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: 900efe
compiled on 17:28:47 Feb 6 2026 with gcc 13.3.0
Also, I want to maintain HTTP Connection so plan to use $http_hdr for
Connection: KeepAlive.
Please guide us in this matter.
Regards
Sarju
Important: keep the mailing list in the recipients, do not reply only to the
sender!
_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the
sender!