[sr-dev] git:master: modules/sipcapture: added customization for X-CID header.

Alexandr Dubovikov alexandr.dubovikov at gmail.com
Fri Apr 5 21:23:45 CEST 2013


Module: sip-router
Branch: master
Commit: 6433c3b1c2d84d6a6168e7bdccf9c4f13dc50586
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=6433c3b1c2d84d6a6168e7bdccf9c4f13dc50586

Author: Alexandr Dubovikov <alexandr.dubovikov at gmail.com>
Committer: Alexandr Dubovikov <alexandr.dubovikov at gmail.com>
Date:   Fri Apr  5 21:21:33 2013 +0200

modules/sipcapture: added customization for X-CID header.
		thanks for the patch goes to Markus Monka <mmonka at gmail.com>

---

 modules/sipcapture/sipcapture.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/modules/sipcapture/sipcapture.c b/modules/sipcapture/sipcapture.c
index a68fb13..0dd855e 100644
--- a/modules/sipcapture/sipcapture.c
+++ b/modules/sipcapture/sipcapture.c
@@ -155,6 +155,7 @@ static str node_column 		= str_init("node");
 static str msg_column 		= str_init("msg");   
 static str capture_node 	= str_init("homer01");     	
 static str star_contact		= str_init("*");
+static str callid_aleg_header   = str_init("X-CID");
 
 int raw_sock_desc = -1; /* raw socket used for ip packets */
 unsigned int raw_sock_children = 1;
@@ -277,6 +278,7 @@ static param_export_t params[] = {
 	{"raw_interface",     		STR_PARAM, &raw_interface.s   },
         {"promiscious_on",  		INT_PARAM, &promisc_on   },		
         {"raw_moni_bpf_on",  		INT_PARAM, &bpf_on   },		
+        {"callid_aleg_header",          STR_PARAM, &callid_aleg_header.s},
 	{0, 0, 0}
 };
 
@@ -459,6 +461,7 @@ static int mod_init(void) {
 	node_column.len = strlen(node_column.s);  
 	msg_column.len = strlen(msg_column.s);   
 	capture_node.len = strlen(capture_node.s);     	
+	callid_aleg_header.len = strlen(callid_aleg_header.s);
 	
 	if(raw_socket_listen.s) 
 		raw_socket_listen.len = strlen(raw_socket_listen.s);     	
@@ -1158,9 +1161,8 @@ static int sip_capture(struct sip_msg *msg, str *_table)
 	    }
         }
 
-	/* get header x-cid: */
-	/* callid_aleg X-CID */
-	if((tmphdr[0] = get_hdr_by_name(msg,"X-CID", 5)) != NULL) {
+	/* callid_aleg - default is X-CID but configurable via modul params */
+        if((tmphdr[0] = get_hdr_by_name(msg, callid_aleg_header.s, callid_aleg_header.len)) != NULL) {	
 		sco.callid_aleg = tmphdr[0]->body;
         }
 	else { EMPTY_STR(sco.callid_aleg);}




More information about the sr-dev mailing list