[sr-dev] git:master:526fb4cd: core: added msg_send_buffer() function to allow skipping execution of core events

Daniel-Constantin Mierla miconda at gmail.com
Wed Jan 6 10:06:16 CET 2016


Module: kamailio
Branch: master
Commit: 526fb4cdc2246284ecbd7de9ed65678da2dbe357
URL: https://github.com/kamailio/kamailio/commit/526fb4cdc2246284ecbd7de9ed65678da2dbe357

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-01-06T10:03:00+01:00

core: added msg_send_buffer() function to allow skipping execution of core events

- useful for non-sip messages sent out to skip execution of
  SREV_NET_DATA_OUT, like HEP packets for sipcapture
- msg_send() is now a defined alias for msg_send_buffer()

---

Modified: forward.h

---

Diff:  https://github.com/kamailio/kamailio/commit/526fb4cdc2246284ecbd7de9ed65678da2dbe357.diff
Patch: https://github.com/kamailio/kamailio/commit/526fb4cdc2246284ecbd7de9ed65678da2dbe357.patch

---

diff --git a/forward.h b/forward.h
index f1418d0..9c075b8 100644
--- a/forward.h
+++ b/forward.h
@@ -97,6 +97,7 @@ void forward_set_send_info(int v);
 
 int is_check_self_func_list_set(void);
 
+#define msg_send(_dst, _buf, _len) msg_send_buffer((_dst), (_buf), (_len), 0)
 
 /* params:
  * dst = struct dest_info containing:
@@ -109,9 +110,12 @@ int is_check_self_func_list_set(void);
  *        (useful for sending replies on  the same connection as the request
  *         that generated them; use 0 if you don't want this)
  * buf, len = buffer
+ * flags = control internal behavior
+ *    * 1 - skip executing event SREV_NET_DATA_OUT
  * returns: 0 if ok, -1 on error*/
 
-static inline int msg_send(struct dest_info* dst, char* buf, int len)
+static inline int msg_send_buffer(struct dest_info* dst, char* buf, int len,
+		int flags)
 {
 	struct dest_info new_dst;
 	str outb;
@@ -127,7 +131,9 @@ static inline int msg_send(struct dest_info* dst, char* buf, int len)
 	
 	outb.s = buf;
 	outb.len = len;
-	sr_event_exec(SREV_NET_DATA_OUT, (void*)&outb);
+	if(!(flags&1)) {
+		sr_event_exec(SREV_NET_DATA_OUT, (void*)&outb);
+	}
 
 	if(outb.s==NULL) {
 		LM_ERR("failed to update outgoing buffer\n");




More information about the sr-dev mailing list