Module: kamailio
Branch: master
Commit: d5e29886ccca6e4384859523e8b923761532c513
URL:
https://github.com/kamailio/kamailio/commit/d5e29886ccca6e4384859523e8b9237…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-04-08T19:15:26+02:00
core: enable updating received data via $rcv(buf)
- on event_route[core:msg-received]
---
Modified: src/core/ip_addr.h
Modified: src/core/receive.c
---
Diff:
https://github.com/kamailio/kamailio/commit/d5e29886ccca6e4384859523e8b9237…
Patch:
https://github.com/kamailio/kamailio/commit/d5e29886ccca6e4384859523e8b9237…
---
diff --git a/src/core/ip_addr.h b/src/core/ip_addr.h
index c3f423123e..2f7770f81d 100644
--- a/src/core/ip_addr.h
+++ b/src/core/ip_addr.h
@@ -203,6 +203,7 @@ typedef struct ksr_coninfo {
typedef struct sr_net_info {
str data;
+ unsigned int bufsize;
receive_info_t* rcv;
dest_info_t* dst;
} sr_net_info_t;
diff --git a/src/core/receive.c b/src/core/receive.c
index b3e6aee8b8..5ed35a584c 100644
--- a/src/core/receive.c
+++ b/src/core/receive.c
@@ -161,7 +161,7 @@ sr_net_info_t *ksr_evrt_rcvnetinfo_get(void)
/**
*
*/
-int ksr_evrt_received(char *buf, unsigned int len, receive_info_t *rcv_info)
+int ksr_evrt_received(char *buf, unsigned int *len, receive_info_t *rcv_info)
{
sr_kemi_eng_t *keng = NULL;
sr_net_info_t netinfo;
@@ -192,7 +192,8 @@ int ksr_evrt_received(char *buf, unsigned int len, receive_info_t
*rcv_info)
}
memset(&netinfo, 0, sizeof(sr_net_info_t));
netinfo.data.s = buf;
- netinfo.data.len = len;
+ netinfo.data.len = *len;
+ netinfo.bufsize = BUF_SIZE;
netinfo.rcv = rcv_info;
ksr_evrt_rcvnetinfo = &netinfo;
@@ -212,6 +213,7 @@ int ksr_evrt_received(char *buf, unsigned int len, receive_info_t
*rcv_info)
LM_DBG("dropping received message\n");
ret = -1;
}
+ *len = netinfo.data.len;
ksr_evrt_rcvnetinfo = NULL;
return ret;
@@ -312,7 +314,7 @@ int receive_msg(char *buf, unsigned int len, receive_info_t
*rcv_info)
}
if(ksr_evrt_received_mode!=0) {
- if(ksr_evrt_received(buf, len, rcv_info)<0) {
+ if(ksr_evrt_received(buf, &len, rcv_info)<0) {
LM_DBG("dropping the received message\n");
goto error00;
}