Module: sip-router
Branch: tmp/ruri_branch
Commit: 914a4c04220cb6ee569e45d6d37c141d38f206a3
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=914a4c0…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Thu May 27 10:55:18 2010 +0200
core: mark uri as new on new message or seturi()
Each time a new message is received the r-uri is marked as "new"
(available for forking). The same happens when the uri is changed
or modified in the script (seturi(), rewrite_uri(), setuser(),
sethost() a.s.o.).
---
action.c | 3 +++
receive.c | 1 +
2 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/action.c b/action.c
index 70cec69..5e1aed1 100644
--- a/action.c
+++ b/action.c
@@ -545,6 +545,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
msg->new_uri.len=0;
msg->new_uri.s=0;
msg->parsed_uri_ok=0; /* invalidate current parsed uri*/
+ ruri_mark_new(); /* available for forking */
};
ret=1;
break;
@@ -593,6 +594,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
memcpy(msg->new_uri.s, a->val[0].u.string, len);
msg->new_uri.s[len]=0;
msg->new_uri.len=len;
+ ruri_mark_new(); /* available for forking */
ret=1;
break;
@@ -870,6 +872,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
msg->new_uri.s=new_uri;
msg->new_uri.len=crt-new_uri;
msg->parsed_uri_ok=0;
+ ruri_mark_new(); /* available for forking */
ret=1;
break;
case IF_T:
diff --git a/receive.c b/receive.c
index df26196..7f49fdc 100644
--- a/receive.c
+++ b/receive.c
@@ -149,6 +149,7 @@ int receive_msg(char* buf, unsigned int len, struct receive_info* rcv_info)
clear_branches();
if (msg->first_line.type==SIP_REQUEST){
+ ruri_mark_new(); /* ruri is usable for forking (not consumed yet) */
if (!IS_SIP(msg)){
if ((ret=nonsip_msg_run_hooks(msg))!=NONSIP_MSG_ACCEPT){
if (unlikely(ret==NONSIP_MSG_ERROR))
Module: sip-router
Branch: tmp/ruri_branch
Commit: 4cf857a1180e14807b6d4085a5795a24cac262bc
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4cf857a…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Thu May 27 11:02:28 2010 +0200
tm: failure route start with r-uri marked as "consumed"
When the failure route starts, the main r-uri should not be reused
for forking, unless changed.
---
modules/tm/t_reply.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c
index 2e6fd55..4318886 100644
--- a/modules/tm/t_reply.c
+++ b/modules/tm/t_reply.c
@@ -718,6 +718,7 @@ static int _reply( struct cell *trans, struct sip_msg* p_msg,
/** create or restore a "fake environment" for running a failure_route.
*if msg is set -> it will fake the env. vars conforming with the msg; if NULL
* the env. will be restore to original.
+ * Side-effect: mark_ruri_consumed().
*/
void faked_env( struct cell *t, struct sip_msg *msg)
{
@@ -740,6 +741,11 @@ void faked_env( struct cell *t, struct sip_msg *msg)
*/
backup_route_type=get_route_type();
set_route_type(FAILURE_ROUTE);
+ /* don't bother backing up ruri state, since failure route
+ is called either on reply or on timer and in both cases
+ the ruri should not be used again for forking */
+ ruri_mark_consumed(); /* in failure route we assume ruri
+ should not be used again for forking */
/* also, tm actions look in beginning whether transaction is
* set -- whether we are called from a reply-processing
* or a timer process, we need to set current transaction;
Module: sip-router
Branch: tmp/ruri_branch
Commit: 22f1b9940dc6c0d162f11f6f82bbc33db21aecb2
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=22f1b99…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Thu May 27 10:58:36 2010 +0200
tm: use ruri for forking only if marked as "new"
The r-uri is now used for forking only if marked as "new".
After using it, it will be automatically marked as "consumed", so
that it won't be used in the future (unless re-marked as new by
changing the r-uri, dst_uri or path).
This will simplify a lot serial forking via the script
(only seturi(...); t_relay() is needed now, no messing with
append_branch() is required anymore, unless parallel forking is desired)
---
modules/tm/t_fwd.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/modules/tm/t_fwd.c b/modules/tm/t_fwd.c
index cc22096..5a8df8a 100644
--- a/modules/tm/t_fwd.c
+++ b/modules/tm/t_fwd.c
@@ -1328,11 +1328,9 @@ int t_forward_nonack( struct cell *t, struct sip_msg* p_msg ,
branch_route = 0;
}
- /* on first-time forwarding, use current uri, later only what
- is in additional branches (which may be continuously refilled
- */
- if (first_branch==0) {
#ifdef POSTPONE_MSG_CLONING
+ /* on first-time forwarding, update the lumps */
+ if (first_branch==0) {
/* update the shmem-ized msg with the lumps */
if ((is_route_type(REQUEST_ROUTE)) &&
save_msg_lumps(t->uas.request, p_msg)) {
@@ -1340,7 +1338,13 @@ int t_forward_nonack( struct cell *t, struct sip_msg* p_msg ,
"failed to save the message lumps\n");
return -1;
}
+ }
#endif
+ /* if ruri is not already consumed (by another invocation), use current
+ uri too. Else add only additional branches (which may be continuously
+ refilled).
+ */
+ if (ruri_get_forking_state()) {
try_new=1;
branch_ret=add_uac( t, p_msg, GET_RURI(p_msg), GET_NEXT_HOP(p_msg),
&p_msg->path_vec, proxy, p_msg->force_send_socket,
Module: sip-router
Branch: kamailio_3.0
Commit: 6dc77aa8801808211b42184c15712e6adf9b443d
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=6dc77aa…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu May 13 11:41:06 2010 +0200
registrar(k): reset dst uri in lookup
- upon lookup, dst uri is reset if no new dst uri is set from received
or path, otherwise the coordinates of selected contact are not
effective
- reported by Andreas Granig
(cherry picked from commit 53bb79cef5eb70e98472903ef84b5585cc798e65)
---
modules_k/registrar/lookup.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/modules_k/registrar/lookup.c b/modules_k/registrar/lookup.c
index 67accc7..944d410 100644
--- a/modules_k/registrar/lookup.c
+++ b/modules_k/registrar/lookup.c
@@ -105,6 +105,9 @@ int lookup(struct sip_msg* _m, char* _t, char* _s)
goto done;
}
+ /* reset next hop address */
+ reset_dst_uri(_m);
+
/* If a Path is present, use first path-uri in favour of
* received-uri because in that case the last hop towards the uac
* has to handle NAT. - agranig */