Revision: 5986
http://openser.svn.sourceforge.net/openser/?rev=5986&view=rev
Author: miconda
Date: 2010-02-11 23:28:20 +0000 (Thu, 11 Feb 2010)
Log Message:
-----------
- safety checks to dlg match for MI cmds
- reported by Inaki Baz Castillo
Modified Paths:
--------------
branches/1.5/modules/dialog/dlg_hash.h
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5985
http://openser.svn.sourceforge.net/openser/?rev=5985&view=rev
Author: miconda
Date: 2010-02-11 23:19:45 +0000 (Thu, 11 Feb 2010)
Log Message:
-----------
- applied patch from Torben Friese
- memset to 0 local variable and safety check for faked reply
Modified Paths:
--------------
branches/1.5/modules/dialog/dlg_handlers.c
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Hi, according to a recent commit in OpenSIPS dialog module it seems that it
crashes when trying to match a dialog for a request with no From tag:
http://opensips.svn.sourceforge.net/opensips/?rev=6595&view=rev
I've checked the head version of the module in modules_k an the bug exists:
http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sip-
router;a=blob;f=modules_k/dialog/dlg_hash.h;h=bd1de8717bbfec5fd76a461f251f2bdbc9f5754b;hb=HEAD
I have to play a bit more with Git before commiting something so I'd ask if
somebody can fix it :)
--
Iñaki Baz Castillo <ibc(a)aliax.net>
Revision: 5984
http://openser.svn.sourceforge.net/openser/?rev=5984&view=rev
Author: juhe
Date: 2010-02-11 20:29:57 +0000 (Thu, 11 Feb 2010)
Log Message:
-----------
* modules/mediaproxy: Properly fix the IP in the RTCP line
(if present in the SDP). Patch provided by Saul Ibarra Corretge.
Modified Paths:
--------------
branches/1.5/modules/mediaproxy/mediaproxy.c
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Module: sip-router
Branch: kamailio_3.0
Commit: ef10212404b9bc5489683fc7429fee40b3495994
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=ef10212…
Author: Juha Heinanen <jh(a)tutpro.com>
Committer: Juha Heinanen <jh(a)tutpro.com>
Date: Thu Feb 11 22:22:12 2010 +0200
modules/mediaproxy: properly fix the IP in the RTCP line
- Properly fix the IP in the RTCP line (if present in the SDP). Patch
provided by Saul Ibarra Corretge.
(cherry picked from commit 2a95f9bf915cfc3cf11374f9b8f0f547d4eb4955)
---
modules/mediaproxy/mediaproxy.c | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/modules/mediaproxy/mediaproxy.c b/modules/mediaproxy/mediaproxy.c
index 3f44595..bf4764e 100644
--- a/modules/mediaproxy/mediaproxy.c
+++ b/modules/mediaproxy/mediaproxy.c
@@ -128,6 +128,7 @@ typedef struct {
str type; // stream type (`audio', `video', `image', ...)
str ip;
str port;
+ str rtcp_ip; // pointer to the rtcp IP if explicitly specified by stream
str rtcp_port; // pointer to the rtcp port if explicitly specified by stream
str direction;
Bool local_ip; // true if the IP is locally defined inside this media stream
@@ -872,6 +873,34 @@ get_rtcp_port_attribute(str *block)
}
+// will return the rtcp IP of the stream in the given block
+// if defined by the stream, otherwise will return {NULL, 0}.
+static str
+get_rtcp_ip_attribute(str *block)
+{
+ str zone, tokens[4], undefined = {NULL, 0};
+ char *ptr;
+ int count;
+
+ ptr = find_line_starting_with(block, "a=rtcp:", False);
+
+ if (!ptr)
+ return undefined;
+
+ zone.s = ptr + 7;
+ zone.len = findendline(zone.s, block->s + block->len - zone.s) - zone.s;
+
+ count = get_str_tokens(&zone, tokens, 4);
+
+ if (count != 4) {
+ LM_ERR("invalid `a=rtcp' line in SDP body\n");
+ return undefined;
+ }
+
+ return tokens[3];
+}
+
+
// will return the ip address present in a `c=' line in the given block
// returns: -1 on error, 0 if not found, 1 if found
static int
@@ -1118,6 +1147,7 @@ get_session_info(str *sdp, SessionInfo *session)
session->streams[i].local_ip = 1;
}
+ session->streams[i].rtcp_ip = get_rtcp_ip_attribute(&block);
session->streams[i].rtcp_port = get_rtcp_port_attribute(&block);
session->streams[i].direction = get_direction_attribute(&block, &session->direction);
}
@@ -1536,6 +1566,13 @@ use_media_proxy(struct sip_msg *msg, char *dialog_id)
}
}
+ if (stream.rtcp_ip.len > 0) {
+ if (!replace_element(msg, &stream.rtcp_ip, &tokens[0])) {
+ LM_ERR("failed to replace RTCP IP in media stream number %d\n", i+1);
+ return -1;
+ }
+ }
+
if (stream.local_ip && !isnulladdr(stream.ip)) {
if (!replace_element(msg, &stream.ip, &tokens[0])) {
LM_ERR("failed to replace IP address in media stream number %d\n", i+1);
Module: sip-router
Branch: master
Commit: 2a95f9bf915cfc3cf11374f9b8f0f547d4eb4955
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=2a95f9b…
Author: Juha Heinanen <jh(a)tutpro.com>
Committer: Juha Heinanen <jh(a)tutpro.com>
Date: Thu Feb 11 22:22:12 2010 +0200
modules/mediaproxy: properly fix the IP in the RTCP line
- Properly fix the IP in the RTCP line (if present in the SDP). Patch
provided by Saul Ibarra Corretge.
---
modules/mediaproxy/mediaproxy.c | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/modules/mediaproxy/mediaproxy.c b/modules/mediaproxy/mediaproxy.c
index 3f44595..bf4764e 100644
--- a/modules/mediaproxy/mediaproxy.c
+++ b/modules/mediaproxy/mediaproxy.c
@@ -128,6 +128,7 @@ typedef struct {
str type; // stream type (`audio', `video', `image', ...)
str ip;
str port;
+ str rtcp_ip; // pointer to the rtcp IP if explicitly specified by stream
str rtcp_port; // pointer to the rtcp port if explicitly specified by stream
str direction;
Bool local_ip; // true if the IP is locally defined inside this media stream
@@ -872,6 +873,34 @@ get_rtcp_port_attribute(str *block)
}
+// will return the rtcp IP of the stream in the given block
+// if defined by the stream, otherwise will return {NULL, 0}.
+static str
+get_rtcp_ip_attribute(str *block)
+{
+ str zone, tokens[4], undefined = {NULL, 0};
+ char *ptr;
+ int count;
+
+ ptr = find_line_starting_with(block, "a=rtcp:", False);
+
+ if (!ptr)
+ return undefined;
+
+ zone.s = ptr + 7;
+ zone.len = findendline(zone.s, block->s + block->len - zone.s) - zone.s;
+
+ count = get_str_tokens(&zone, tokens, 4);
+
+ if (count != 4) {
+ LM_ERR("invalid `a=rtcp' line in SDP body\n");
+ return undefined;
+ }
+
+ return tokens[3];
+}
+
+
// will return the ip address present in a `c=' line in the given block
// returns: -1 on error, 0 if not found, 1 if found
static int
@@ -1118,6 +1147,7 @@ get_session_info(str *sdp, SessionInfo *session)
session->streams[i].local_ip = 1;
}
+ session->streams[i].rtcp_ip = get_rtcp_ip_attribute(&block);
session->streams[i].rtcp_port = get_rtcp_port_attribute(&block);
session->streams[i].direction = get_direction_attribute(&block, &session->direction);
}
@@ -1536,6 +1566,13 @@ use_media_proxy(struct sip_msg *msg, char *dialog_id)
}
}
+ if (stream.rtcp_ip.len > 0) {
+ if (!replace_element(msg, &stream.rtcp_ip, &tokens[0])) {
+ LM_ERR("failed to replace RTCP IP in media stream number %d\n", i+1);
+ return -1;
+ }
+ }
+
if (stream.local_ip && !isnulladdr(stream.ip)) {
if (!replace_element(msg, &stream.ip, &tokens[0])) {
LM_ERR("failed to replace IP address in media stream number %d\n", i+1);
Hello
I am working on a patch that increases the verbosity of the
modules/debugger module . What I am doing is very simple, but in my
opinion effective :
I am also printing the action being run, not just the type(in the new
descr field)
Feb 9 16:46:03 marius ../../ser[32588]: ERROR: *** cfgtrace:
c=[../unit/30.cfg] l=26 a=17 descr=if (type<22>) {} else {};
Feb 9 16:46:03 marius ../../ser[32588]: ERROR: *** cfgtrace:
c=[../unit/30.cfg] l=30 a=17 descr=if (type<22>) {} else {};
Feb 9 16:46:03 marius ../../ser[32588]: ERROR: *** cfgtrace:
c=[../unit/30.cfg] l=26 a=28 descr=
external_module_call(f_ptr<0xb7d4dbf8>, 5, type<10>);
First off all the trace is not very informative because I don't have
that of a good example but you get the point.
I know it would be easy to read the cfg and get the line number, but
what if you have multiple commands per line. And printing the action
type for me is not really usefull (need to get back to header to check
the action type).
What do you think, it will be usefull as such? The patch(still some
lines to go) if fairly big but fullproof (the print_action()
print_expression() in route_struct.c will output data in a static buffer
instead of calling DBG()).
Cheers
Marius
Module: sip-router
Branch: master
Commit: 651603023f4fc46b25bc143d44415cd0acdf0a48
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=6516030…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu Feb 11 15:20:36 2010 +0100
dispatcher(k): weight based distribution
- new algorithm 9 for weight based distribution
- new column to hold attributes per destination
- for weight based distribution you have to set for each address in
destination set: weight=value, for example:
[setid address flags priority attributes]
2 sip:10.10.0.1:5080 0 2 weight=40
2 sip:10.10.0.2:5082 0 1 weight=60
- this will send 60% of the traffic to second address
- note that at startup the distribution is randomized, so traffic is
directed to first or second desintation alternatively but keeping
overall percentages
---
modules_k/dispatcher/dispatch.c | 248 ++++++++++++++++++++++++++++---------
modules_k/dispatcher/dispatch.h | 2 +
modules_k/dispatcher/dispatcher.c | 13 ++-
3 files changed, 203 insertions(+), 60 deletions(-)
Diff: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=651…
Module: sip-router
Branch: master
Commit: 54e17098b5efddf559e5b745e36a82f6027ffc91
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=54e1709…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Wed Feb 10 21:48:00 2010 +0100
core: use the prev. via branch id if it's 3261
When computing the via branch value in syn_branch==0 mode, use the
previous via branch id and not the to_tag, from_tag, callid, ruri,
cseq number, via port and host, if the previous via branch id is
in rfc3261 format (begins with the magic cookie).
See rfc3261/16.11 P116 for more informations.
To revert to the old behaviour, define BRANCH_IGNORE_3261_VIA.
---
char_msg_val.h | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/char_msg_val.h b/char_msg_val.h
index 9e20918..e78bd9d 100644
--- a/char_msg_val.h
+++ b/char_msg_val.h
@@ -22,7 +22,7 @@
* History:
* --------
* 2010-02-10 moved from parser/msg_parser.h and added tag only mode
- * by default (andrei)
+ * by default (andrei)
*/
/** compute the characteristic value of a message.
* @file
@@ -32,6 +32,9 @@
* BRANCH_INCLUDE_FROMTO_BODY - if defined the old (pre 3.1) mode of
* including the full from & to bodies will be used (instead of only the
* tags).
+ * BRANCH_IGNORE_3261_VIA - if defined, no check and special/simpler handling
+ * of messages with 3261 cookies in the via branch will be made (same
+ * behaviour as in pre 3.1 versions).
*/
#ifndef __char_msg_val_h
@@ -59,7 +62,15 @@ inline static int char_msg_val( struct sip_msg *msg, char *cv )
memset( cv, '0', MD5_LEN );
return 0;
}
-
+#ifndef BRANCH_IGNORE_3261_VIA
+ if (likely(msg->via1->branch && msg->via1->branch->value.len>MCOOKIE_LEN &&
+ memcmp(msg->via1->branch->value.s, MCOOKIE, MCOOKIE_LEN)==0)){
+ /* 3261 branch cookie present => hash only the received branch ID */
+ src[0]=msg->via1->branch->value;
+ MD5StringArray ( cv, src, 1 );
+ return 1; /* success */
+ }
+#endif /* BRANCH_IGNORE_3261_VIA */
#ifdef BRANCH_INCLUDE_FROMTO_BODY
/* use the from & to full bodies */
src[0]= msg->from->body;
@@ -77,7 +88,7 @@ inline static int char_msg_val( struct sip_msg *msg, char *cv )
/* use only the from & to tags */
src[0]=get_from(msg)->tag_value;
src[1]=get_to(msg)->tag_value;
-#endif
+#endif /* BRANCH_INCLUDE_FROMTO_BODY */
src[2]= msg->callid->body;
src[3]= msg->first_line.u.request.uri;
src[4]= get_cseq( msg )->number;
@@ -85,7 +96,7 @@ inline static int char_msg_val( struct sip_msg *msg, char *cv )
/* topmost Via is part of transaction key as well ! */
src[5]= msg->via1->host;
src[6]= msg->via1->port_str;
- if (msg->via1->branch) {
+ if (likely(msg->via1->branch)) {
src[7]= msg->via1->branch->value;
MD5StringArray ( cv, src, 8 );
} else {
Module: sip-router
Branch: master
Commit: 817b9c5cf1133cd9fe59624167b1af1da7461529
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=817b9c5…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Wed Feb 10 21:30:11 2010 +0100
core: include only from/to tags when computing via branch value
- use only the to & from tags when computing the via branch value
in syn_branch==0 mode. This should improve interoperability with
broken implementations that don't keep the from & to headers
unchanged. Defining BRANCH_INCLUDE_FROMTO_BODY will revert to
the old behaviour.
- moved char_msg_val from parser/msg_parser.h to its own file
(it has nothing to do with parsing).
---
char_msg_val.h | 101 ++++++++++++++++++++++++++++++++++++++++++++++
forward.c | 1 +
modules/tm/h_table.c | 1 +
modules_k/exec/exec_hf.c | 1 +
modules_s/exec/exec_hf.c | 1 +
parser/msg_parser.h | 34 ---------------
6 files changed, 105 insertions(+), 34 deletions(-)
diff --git a/char_msg_val.h b/char_msg_val.h
new file mode 100644
index 0000000..9e20918
--- /dev/null
+++ b/char_msg_val.h
@@ -0,0 +1,101 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2010 iptelorg GmbH
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+ * char_msg_val.h
+ */
+/*
+ * History:
+ * --------
+ * 2010-02-10 moved from parser/msg_parser.h and added tag only mode
+ * by default (andrei)
+*/
+/** compute the characteristic value of a message.
+ * @file
+ * @ingroup core
+ */
+/* Defines:
+ * BRANCH_INCLUDE_FROMTO_BODY - if defined the old (pre 3.1) mode of
+ * including the full from & to bodies will be used (instead of only the
+ * tags).
+*/
+
+#ifndef __char_msg_val_h
+#define __char_msg_val_h
+
+#include "comp_defs.h"
+#include "compiler_opt.h"
+#include "str.h"
+#include "parser/msg_parser.h"
+#include "parser/parse_to.h"
+#include "parser/parse_from.h"
+#include "md5utils.h"
+
+/*! \brief calculate characteristic value of a message -- this value
+ is used to identify a transaction during the process of
+ reply matching
+ */
+inline static int char_msg_val( struct sip_msg *msg, char *cv )
+{
+ str src[8];
+
+ if (unlikely(!check_transaction_quadruple(msg))) {
+ LOG(L_ERR, "ERROR: can't calculate char_value due "
+ "to a parsing error\n");
+ memset( cv, '0', MD5_LEN );
+ return 0;
+ }
+
+#ifdef BRANCH_INCLUDE_FROMTO_BODY
+ /* use the from & to full bodies */
+ src[0]= msg->from->body;
+ src[1]= msg->to->body;
+#else
+ /* to body is automatically parsed (via check_transactionquadruple /
+ parse_header), but the from body has to be parsed manually */
+ if (msg->from->parsed==0){
+ /* parse from body */
+ if (unlikely(parse_from_header(msg) == -1)){
+ LOG(L_ERR, "error while parsing From header\n");
+ return 0;
+ }
+ }
+ /* use only the from & to tags */
+ src[0]=get_from(msg)->tag_value;
+ src[1]=get_to(msg)->tag_value;
+#endif
+ src[2]= msg->callid->body;
+ src[3]= msg->first_line.u.request.uri;
+ src[4]= get_cseq( msg )->number;
+
+ /* topmost Via is part of transaction key as well ! */
+ src[5]= msg->via1->host;
+ src[6]= msg->via1->port_str;
+ if (msg->via1->branch) {
+ src[7]= msg->via1->branch->value;
+ MD5StringArray ( cv, src, 8 );
+ } else {
+ MD5StringArray( cv, src, 7 );
+ }
+ return 1;
+}
+
+
+
+#endif /*__char_msg_val_h*/
+
+/* vi: set ts=4 sw=4 tw=79:ai:cindent: */
diff --git a/forward.c b/forward.c
index 0971027..4b58f71 100644
--- a/forward.c
+++ b/forward.c
@@ -78,6 +78,7 @@
#include "hash_func.h"
#include "config.h"
#include "parser/msg_parser.h"
+#include "char_msg_val.h"
#include "route.h"
#include "events.h"
#include "dprint.h"
diff --git a/modules/tm/h_table.c b/modules/tm/h_table.c
index 2f18336..c860005 100644
--- a/modules/tm/h_table.c
+++ b/modules/tm/h_table.c
@@ -59,6 +59,7 @@
#include "../../ut.h"
#include "../../globals.h"
#include "../../error.h"
+#include "../../char_msg_val.h"
#include "defs.h"
#include "t_reply.h"
#include "t_cancel.h"
diff --git a/modules_k/exec/exec_hf.c b/modules_k/exec/exec_hf.c
index 58d10d5..37eaf27 100644
--- a/modules_k/exec/exec_hf.c
+++ b/modules_k/exec/exec_hf.c
@@ -49,6 +49,7 @@
#include "../../mem/mem.h"
#include "../../dprint.h"
#include "../../md5utils.h"
+#include "../../char_msg_val.h"
#include "exec_hf.h"
/* should be environment variables set by header fields ? */
diff --git a/modules_s/exec/exec_hf.c b/modules_s/exec/exec_hf.c
index f354190..b977834 100644
--- a/modules_s/exec/exec_hf.c
+++ b/modules_s/exec/exec_hf.c
@@ -57,6 +57,7 @@
#include "../../mem/mem.h"
#include "../../dprint.h"
#include "../../md5utils.h"
+#include "../../char_msg_val.h"
#include "exec_hf.h"
/* should be environment variables set by header fields ? */
diff --git a/parser/msg_parser.h b/parser/msg_parser.h
index c092f51..ca08284 100644
--- a/parser/msg_parser.h
+++ b/parser/msg_parser.h
@@ -398,40 +398,6 @@ inline static int check_transaction_quadruple( struct sip_msg* msg )
-/*! \brief calculate characteristic value of a message -- this value
- is used to identify a transaction during the process of
- reply matching
- */
-inline static int char_msg_val( struct sip_msg *msg, char *cv )
-{
- str src[8];
-
- if (!check_transaction_quadruple(msg)) {
- LOG(L_ERR, "ERROR: can't calculate char_value due "
- "to a parsing error\n");
- memset( cv, '0', MD5_LEN );
- return 0;
- }
-
- src[0]= msg->from->body;
- src[1]= msg->to->body;
- src[2]= msg->callid->body;
- src[3]= msg->first_line.u.request.uri;
- src[4]= get_cseq( msg )->number;
-
- /* topmost Via is part of transaction key as well ! */
- src[5]= msg->via1->host;
- src[6]= msg->via1->port_str;
- if (msg->via1->branch) {
- src[7]= msg->via1->branch->value;
- MD5StringArray ( cv, src, 8 );
- } else {
- MD5StringArray( cv, src, 7 );
- }
- return 1;
-}
-
-
/*! \brief returns a pointer to the begining of the msg's body
*/
inline static char* get_body(struct sip_msg *msg)