To prepare for the kamailio 3.0 and sip-router 3.0 releases (according
to what we discussed at the sr meeting last week) I've created the
sr_3.0 and also enabled kamailio_3.0 (meaning that it can be created
anytime).
The "main" branches will look like:
master
|
* --- sr_3.0
|
* --- kamailio_3.0
Only fixes should be committed to sr_3.0. It should become a generic
stable branch, so it should not contain any specific changes (e.g. name
changes only for sr_3.0 a.s.o.). When we will release 3.0, we will
just create a sr_3.0_release branch and we will do any specific changes
there.
To minimize backporting/forwardporting work, if a bug is discovered on
master or on kamailio_3.0 it should be fixed in the sr_3.0 branch and
then latter sr_3.0 can be pulled (in master or kamailio_3.0):
fix
|
| (commit)
|
(merge) v (merge)
master <-------- sr_3.0 --------> kamailio_3.0
If by mistake a sr_3.0 relevant fix is committed first to another branch,
git cherry-pick -x can (and should) be used to backport it.
E.g.:
git checkout sr_3.0
git cherry-pick -x <fix_commit_id>
git pull origin sr_3.0:sr_3.0
If in any doubt, please create another branch (e.g. tmp/3.0_update
or <username>/3.0_proposed_updates) and request a pull/merge or commit
it into master.
Be especially carefully not to merge by mistake master or kamailio_3.0
into sr_3.0. It's ok only to merge sr_3.0 into master and sr_3.0 into
kamailio_3.0. Any other merge combination is bad.
The kamailio_3.0 branch is not yet created, but it can be created any time
the kamailio release managers decide it's best.
It should be created from sr_3.0. E.g.:
git checkout -b kamailio_3.0 origin/sr_3.0
git push origin HEAD:kamailio_3.0 # this command will create it
If you think we should have some commit restrictions on this branch
(IMHO to avoid mistakes is better to restrict the people who are allowed
to commit on release branches) or sr_3.0, let me know.
It would be better to avoid deleting files on the kamailio_3.0 branch.
If a file is deleted then any merge or git cherry-pick that would
involve changes to the deleted file will fail, requiring manual
patching.
Andrei
Module: sip-router
Branch: sr_3.0
Commit: 084ad8a010db913785d23ccaeba654464cfd05f7
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=084ad8a…
Author: Marius Zbihlei <marius.zbihlei(a)1and1.ro>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Mon Oct 12 15:10:55 2009 +0300
If the user parameter is "<null>" (e.g a empty username in the request URI), do not copy this value to the rewritten uri.
This is the case of a REGISTER request. Added statements that the parameters to the actually_rewrite func may not be null.
(cherry picked from commit e06a69d625d4c1293fceef13f9eca22e14662f9f)
---
modules/carrierroute/cr_func.c | 31 +++++++++++++++++++++----------
1 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/modules/carrierroute/cr_func.c b/modules/carrierroute/cr_func.c
index 607d7a2..316fde4 100644
--- a/modules/carrierroute/cr_func.c
+++ b/modules/carrierroute/cr_func.c
@@ -267,11 +267,10 @@ static struct route_rule * get_rule_by_hash(const struct route_flags * rf,
/**
* does the work for rewrite_on_rule, writes the new URI into dest
*
- * @param rs the route rule used for rewriting
- * @param dest the returned new destination URI
- * @param msg the sip message
- * @param user the localpart of the uri to be rewritten
- * @param descavp the name of the AVP where the description is stored
+ * @param rs the route rule used for rewriting, not NULL
+ * @param dest the returned new destination URI, not NULL
+ * @param msg the sip message, not NULL
+ * @param user the localpart of the uri to be rewritten, not NULL
*
* @return 0 on success, -1 on failure
*
@@ -284,11 +283,23 @@ static int actually_rewrite(const struct route_rule *rs, str *dest,
int_str avp_val;
int strip = 0;
+ str l_user = *user;
+
strip = (rs->strip > user->len ? user->len : rs->strip);
strip = (strip < 0 ? 0 : strip);
- len = rs->local_prefix.len + user->len + rs->local_suffix.len +
- AT_SIGN.len + rs->host.len - strip;
+ if ( strcmp(user->s, "<null>") == 0 || user->len == 0)
+ {
+ l_user.s = NULL;
+ l_user.len = 0;
+ len = rs->host.len;
+ strip = 0;
+ }
+ else{
+ len = rs->local_prefix.len + l_user.len + rs->local_suffix.len +
+ AT_SIGN.len + rs->host.len - strip;
+ }
+
if (msg->parsed_uri.type == SIPS_URI_T) {
len += SIPS_URI.len;
} else {
@@ -309,11 +320,11 @@ static int actually_rewrite(const struct route_rule *rs, str *dest,
memcpy(p, SIP_URI.s, SIP_URI.len);
p += SIP_URI.len;
}
- if (user->len) {
+ if (l_user.len) {
memcpy(p, rs->local_prefix.s, rs->local_prefix.len);
p += rs->local_prefix.len;
- memcpy(p, user->s + strip, user->len - strip);
- p += user->len - strip;
+ memcpy(p, l_user.s + strip, l_user.len - strip);
+ p += l_user.len - strip;
memcpy(p, rs->local_suffix.s, rs->local_suffix.len);
p += rs->local_suffix.len;
memcpy(p, AT_SIGN.s, AT_SIGN.len);