Parcourir la source

Merge branch 'master' of ssh://git.sip-router.org/sip-router

Jason Penton il y a 12 ans
Parent
commit
e84eedfb31

+ 1 - 1
modules/sca/sca_call_info.c

@@ -1444,7 +1444,7 @@ sca_call_info_invite_handler( sip_msg_t *msg, sca_call_info *call_info,
 	LM_DBG( "sca_call_info_invite_handler: Contact header is empty. "
 	LM_DBG( "sca_call_info_invite_handler: Contact header is empty. "
 		"(From: %.*s To: %.*s)", STR_FMT( from_aor ),
 		"(From: %.*s To: %.*s)", STR_FMT( from_aor ),
 		 STR_FMT( to_aor ));
 		 STR_FMT( to_aor ));
-	return( -1 );
+	return( 1 );
     }
     }
 
 
     if ( msg->first_line.type == SIP_REQUEST ) {
     if ( msg->first_line.type == SIP_REQUEST ) {

+ 34 - 0
modules/snmpstats/snmpSIPPortTable.c

@@ -5,6 +5,9 @@
  * Copyright (C) 2006 SOMA Networks, INC.
  * Copyright (C) 2006 SOMA Networks, INC.
  * Written by: Jeffrey Magder ([email protected])
  * Written by: Jeffrey Magder ([email protected])
  *
  *
+ * Copyright (C) 2013 Edvina AB, Sollentuna, Sweden
+ * Modifications by: Olle E. Johansson ([email protected])
+ *
  * This file is part of Kamailio, a free SIP server.
  * This file is part of Kamailio, a free SIP server.
  *
  *
  * Kamailio is free software; you can redistribute it and/or modify it
  * Kamailio is free software; you can redistribute it and/or modify it
@@ -25,6 +28,7 @@
  * History:
  * History:
  * --------
  * --------
  * 2006-11-23 initial version (jmagder)
  * 2006-11-23 initial version (jmagder)
+ * 2013-02-24 Added WS, WSS and SCTP support (oej)
  * 
  * 
  * Originally Generated with mib2c using mib2c.array-user.conf
  * Originally Generated with mib2c using mib2c.array-user.conf
  *
  *
@@ -183,6 +187,18 @@ void createRowsFromIPList(int *theList, int listSize, int protocol,
 	{
 	{
 		valueToAssign = TC_TRANSPORT_PROTOCOL_TLS;
 		valueToAssign = TC_TRANSPORT_PROTOCOL_TLS;
 	}
 	}
+	else if (protocol == PROTO_WS)
+	{
+		valueToAssign = TC_TRANSPORT_PROTOCOL_WS;
+	}
+	else if (protocol == PROTO_WSS)
+	{
+		valueToAssign = TC_TRANSPORT_PROTOCOL_WSS;
+	}
+	else if (protocol == PROTO_SCTP)
+	{
+		valueToAssign = TC_SIP_TRANSPORT_PROTOCOL_SCTP;
+	}
 	else 
 	else 
 	{
 	{
 		valueToAssign = TC_TRANSPORT_PROTOCOL_OTHER;
 		valueToAssign = TC_TRANSPORT_PROTOCOL_OTHER;
@@ -224,15 +240,24 @@ void init_kamailioSIPPortTable(void)
 	int *UDPList = NULL;
 	int *UDPList = NULL;
 	int *TCPList = NULL;
 	int *TCPList = NULL;
 	int *TLSList = NULL;
 	int *TLSList = NULL;
+	int *WSList = NULL;
+	int *WSSList = NULL;
+	int *SCTPList = NULL;
 
 
 	int numUDPSockets;
 	int numUDPSockets;
 	int numTCPSockets; 
 	int numTCPSockets; 
 	int numTLSSockets;
 	int numTLSSockets;
+	int numWSSockets;
+	int numWSSSockets;
+	int numSCTPSockets;
 	
 	
 	/* Retrieve the list of the number of UDP and TCP sockets. */
 	/* Retrieve the list of the number of UDP and TCP sockets. */
 	numUDPSockets = get_socket_list_from_proto(&UDPList, PROTO_UDP);
 	numUDPSockets = get_socket_list_from_proto(&UDPList, PROTO_UDP);
 	numTCPSockets = get_socket_list_from_proto(&TCPList, PROTO_TCP);
 	numTCPSockets = get_socket_list_from_proto(&TCPList, PROTO_TCP);
 	numTLSSockets = get_socket_list_from_proto(&TLSList, PROTO_TLS);
 	numTLSSockets = get_socket_list_from_proto(&TLSList, PROTO_TLS);
+	numWSSockets = get_socket_list_from_proto(&WSList, PROTO_WS);
+	numWSSSockets = get_socket_list_from_proto(&WSSList, PROTO_WSS);
+	numSCTPSockets = get_socket_list_from_proto(&SCTPList, PROTO_SCTP);
 
 
 	/* Generate all rows, using all retrieved interfaces. */
 	/* Generate all rows, using all retrieved interfaces. */
 	createRowsFromIPList(UDPList, numUDPSockets, PROTO_UDP, &curSNMPIndex);
 	createRowsFromIPList(UDPList, numUDPSockets, PROTO_UDP, &curSNMPIndex);
@@ -243,6 +268,15 @@ void init_kamailioSIPPortTable(void)
 
 
 	curSNMPIndex = 0;
 	curSNMPIndex = 0;
 	createRowsFromIPList(TLSList, numTLSSockets, PROTO_TLS, &curSNMPIndex);
 	createRowsFromIPList(TLSList, numTLSSockets, PROTO_TLS, &curSNMPIndex);
+
+	curSNMPIndex = 0;
+	createRowsFromIPList(WSList, numWSSockets, PROTO_WS, &curSNMPIndex);
+
+	curSNMPIndex = 0;
+	createRowsFromIPList(WSSList, numWSSSockets, PROTO_WSS, &curSNMPIndex);
+
+	curSNMPIndex = 0;
+	createRowsFromIPList(SCTPList, numSCTPSockets, PROTO_SCTP, &curSNMPIndex);
 }
 }
 
 
  
  

+ 28 - 13
modules/snmpstats/snmpstats.c

@@ -49,7 +49,7 @@
  * 4) mod_init() will initialize some interprocess communication buffers, as
  * 4) mod_init() will initialize some interprocess communication buffers, as
  *    well as callback mechanisms for the usrloc module.  To understand what the
  *    well as callback mechanisms for the usrloc module.  To understand what the
  *    interprocess buffer and callbacks are and are for, please see the comments
  *    interprocess buffer and callbacks are and are for, please see the comments
- *    at the beginning of kamailioSIPRegUserTable.c
+ *    at the beginning of snmpSIPRegUserTable.c
  */
  */
 
 
 /*!
 /*!
@@ -207,27 +207,35 @@ static struct sigaction old_sigchld_handler;
  *
  *
  *     http://en.wikipedia.org/wiki/SIP_Responses 
  *     http://en.wikipedia.org/wiki/SIP_Responses 
  *
  *
+ * Updated by oej to use the IETF reference page
+ *     http://www.iana.org/assignments/sip-parameters/sip-parameters.xml#sip-parameters-7
+ *
  * If there are more message codes added at a later time, they should be added
  * If there are more message codes added at a later time, they should be added
  * here, and to out_message_code_names below.  
  * here, and to out_message_code_names below.  
  *
  *
  * The array is used to register the statistics keeping track of the number of
  * The array is used to register the statistics keeping track of the number of
  * messages received with the response code X.
  * messages received with the response code X.
+ *
  */
  */
 char *in_message_code_names[] = 
 char *in_message_code_names[] = 
 {
 {
-	"100_in", "180_in", "181_in", "182_in", "183_in", 
+	"100_in", "180_in", "181_in", "182_in", "183_in", "199_in",
 	
 	
-	"200_in", "202_in", 
+	"200_in", "202_in", "204_in",
 	
 	
 	"300_in", "301_in", "302_in", "305_in", "380_in",
 	"300_in", "301_in", "302_in", "305_in", "380_in",
 	
 	
 	"400_in", "401_in", "402_in", "403_in", "404_in", "405_in", "406_in", 
 	"400_in", "401_in", "402_in", "403_in", "404_in", "405_in", "406_in", 
-	"407_in", "408_in", "410_in", "413_in", "414_in", "415_in", "416_in", 
-	"420_in", "421_in", "423_in", "480_in", "481_in", "482_in", "483_in", 
-	"484_in", "485_in", "486_in", "487_in", "488_in", "491_in", "492_in",	
-	"494_in", 
+	"407_in", "408_in", "410_in", "412_in", "413_in", "414_in", "415_in", 
+	"416_in", "417_in", "420_in", "421_in", "422_in", "423_in", "424_in",
+	"428_in", "429_in", "430_in", "433_in", "436_in", "437_in", "438_in",
+	"439_in", "440_in", "469_in", "470_in", "480_in", "481_in", "482_in",
+	"483_in", "484_in", "485_in", "486_in", "487_in", "488_in", "489_in",
+	"491_in", "492_in", "493_in", "494_in", 
 	
 	
 	"500_in", "501_in", "502_in", "503_in", "504_in", "505_in", "513_in",
 	"500_in", "501_in", "502_in", "503_in", "504_in", "505_in", "513_in",
+	"580_in",
+
 	"600_in", "603_in", "604_in", "606_in"
 	"600_in", "603_in", "604_in", "606_in"
 };
 };
 
 
@@ -235,6 +243,9 @@ char *in_message_code_names[] =
  *
  *
  *     http://en.wikipedia.org/wiki/SIP_Responses 
  *     http://en.wikipedia.org/wiki/SIP_Responses 
  *
  *
+ * Updated by oej to use the IETF reference page
+ *     http://www.iana.org/assignments/sip-parameters/sip-parameters.xml#sip-parameters-7
+ *
  * If there are more message codes added at a later time, they should be added
  * If there are more message codes added at a later time, they should be added
  * here, and to in_message_code_names above.
  * here, and to in_message_code_names above.
  *
  *
@@ -243,19 +254,23 @@ char *in_message_code_names[] =
  */
  */
 char *out_message_code_names[] = 
 char *out_message_code_names[] = 
 {
 {
-	"100_out", "180_out", "181_out", "182_out", "183_out", 
+	"100_out", "180_out", "181_out", "182_out", "183_out", "199_out",
 	
 	
-	"200_out", "202_out", 
+	"200_out", "202_out", "204_out",
 	
 	
 	"300_out", "301_out", "302_out", "305_out", "380_out",
 	"300_out", "301_out", "302_out", "305_out", "380_out",
 	
 	
 	"400_out", "401_out", "402_out", "403_out", "404_out", "405_out", "406_out", 
 	"400_out", "401_out", "402_out", "403_out", "404_out", "405_out", "406_out", 
-	"407_out", "408_out", "410_out", "413_out", "414_out", "415_out", "416_out", 
-	"420_out", "421_out", "423_out", "480_out", "481_out", "482_out", "483_out", 
-	"484_out", "485_out", "486_out", "487_out", "488_out", "491_out", "492_out",	
-	"494_out", 
+	"407_out", "408_out", "410_out", "412_out", "413_out", "414_out", "415_out",
+	"416_out", "417_out", "420_out", "421_out", "422_out", "423_out", "424_out",
+	"428_out", "429_out", "430_out", "433_out", "436_out", "437_out", "438_out", 
+	"439_out", "440_out", "469_out", "470_out", "480_out", "481_out", "482_out",
+	"483_out", "484_out", "485_out", "486_out", "487_out", "488_out", "489_out",
+	"491_out", "492_out", "493_out", "494_out", 
 	
 	
 	"500_out", "501_out", "502_out", "503_out", "504_out", "505_out", "513_out",
 	"500_out", "501_out", "502_out", "503_out", "504_out", "505_out", "513_out",
+	"580_out",
+
 	"600_out", "603_out", "604_out", "606_out"
 	"600_out", "603_out", "604_out", "606_out"
 };
 };
 
 

+ 25 - 2
modules/tm/t_msgbuilder.c

@@ -1475,11 +1475,34 @@ static inline char* print_callid(char* w, dlg_t* dialog, struct cell* t)
 	memapp(w, CRLF, CRLF_LEN);
 	memapp(w, CRLF, CRLF_LEN);
 	t->callid.s = w;
 	t->callid.s = w;
 	t->callid.len = CALLID_LEN + dialog->id.call_id.len + CRLF_LEN;
 	t->callid.len = CALLID_LEN + dialog->id.call_id.len + CRLF_LEN;
-
+	
 	w = print_callid_mini(w, dialog->id.call_id);
 	w = print_callid_mini(w, dialog->id.call_id);
 	return w;
 	return w;
 }
 }
 
 
+/*
+* Find the first occurrence of find in s, where the search is limited to the
+* first slen characters of s.
+*/
+static
+char * _strnstr(const char* s, const char* find, size_t slen) {
+	char c, sc;
+	size_t len;
+
+	if ((c = *find++) != '\0') {
+		len = strlen(find);
+		do {
+			do {
+				if (slen-- < 1 || (sc = *s++) == '\0')
+					return (NULL);
+			} while (sc != c);
+			if (len > slen)
+				return (NULL);
+		} while (strncmp(s, find, len) != 0);
+		s--;
+	}
+	return ((char *)s);
+}
 
 
 /*
 /*
  * Create a request
  * Create a request
@@ -1542,7 +1565,7 @@ char* build_uac_req(str* method, str* headers, str* body, dlg_t* dialog, int bra
 	w = print_routeset(w, dialog);                        /* Route set */
 	w = print_routeset(w, dialog);                        /* Route set */
 
 
 	if(headers==NULL || headers->len<15
 	if(headers==NULL || headers->len<15
-			|| strnstr(headers->s, "Max-Forwards:", headers->len)==NULL)
+			|| _strnstr(headers->s, "Max-Forwards:", headers->len)==NULL)
 		memapp(w, MAXFWD_HEADER, MAXFWD_HEADER_LEN);      /* Max-forwards */
 		memapp(w, MAXFWD_HEADER, MAXFWD_HEADER_LEN);      /* Max-forwards */
 
 
      /* Content-Length */
      /* Content-Length */