Module: sip-router Branch: master Commit: 4cca625ce8229c5513451d135c09d9701c80dcd7 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4cca625c...
Author: Miklos Tirpak miklos@iptel.org Committer: Miklos Tirpak miklos@iptel.org Date: Wed May 26 11:31:51 2010 +0200
tm: support for changing the reply status in the script
The reply status code is re-read after the onreply_route block is executed which makes possile to change the status code from the script. The status code shall be rewritten directly in the message buffer and in the parsed structure, and the class of provisional and positive final replies cannot be changed.
---
modules/tm/t_reply.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c index 9ad1d0e..2e6fd55 100644 --- a/modules/tm/t_reply.c +++ b/modules/tm/t_reply.c @@ -2129,6 +2129,17 @@ int reply_received( struct sip_msg *p_msg ) stop_rb_timers(&uac->request); } #endif /* TM_ONREPLY_FINAL_DROP_OK */ + /* Re-read the status code, it can be changed in the route block. */ +#ifdef EXTRA_DEBUG + /* The class of provisional and positive final replies cannot be changed. */ + if (((msg_status < 300) || (p_msg->REPLY_STATUS < 300)) + && (msg_status/100 != p_msg->REPLY_STATUS/100) + ) { + LOG(L_ERR, "ERROR: The class of provisional and " + "positive final replies should not be changed!\n"); + } +#endif /* EXTRA_DEBUG */ + msg_status=p_msg->REPLY_STATUS; } #ifdef USE_DST_BLACKLIST /* add temporary to the blacklist the source of a 503 reply */
Hi Miklos!
How can the reply status be changed?
If it is changed in reply-route, will failure route have the changed-one?
Thanks Klaus
Am 26.05.2010 11:38, schrieb Miklos Tirpak:
Module: sip-router Branch: master Commit: 4cca625ce8229c5513451d135c09d9701c80dcd7 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4cca625c...
Author: Miklos Tirpakmiklos@iptel.org Committer: Miklos Tirpakmiklos@iptel.org Date: Wed May 26 11:31:51 2010 +0200
tm: support for changing the reply status in the script
The reply status code is re-read after the onreply_route block is executed which makes possile to change the status code from the
script.
The status code shall be rewritten directly in the message buffer and in the parsed structure, and the class of provisional and positive final replies cannot be changed.
modules/tm/t_reply.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c index 9ad1d0e..2e6fd55 100644 --- a/modules/tm/t_reply.c +++ b/modules/tm/t_reply.c @@ -2129,6 +2129,17 @@ int reply_received( struct sip_msg *p_msg ) stop_rb_timers(&uac->request); } #endif /* TM_ONREPLY_FINAL_DROP_OK */
/* Re-read the status code, it can be changed in the route block. */
+#ifdef EXTRA_DEBUG
/* The class of provisional and positive final replies cannot be
changed. */
if (((msg_status< 300) || (p_msg->REPLY_STATUS< 300))
&& (msg_status/100 != p_msg->REPLY_STATUS/100)
) {
LOG(L_ERR, "ERROR: The class of provisional and "
"positive final replies should not be changed!\n");
}
+#endif /* EXTRA_DEBUG */
} #ifdef USE_DST_BLACKLIST /* add temporary to the blacklist the source of a 503 reply */msg_status=p_msg->REPLY_STATUS;
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Hi Klaus,
On 05/26/2010 11:56 AM, Klaus Darilion wrote:
Hi Miklos!
How can the reply status be changed?
there should be some other function added, what tm module does is only checking for the change. If you need it then I can add the function to modules_s/textops for instance.
If it is changed in reply-route, will failure route have the changed-one?
Yes.
Miklos
Thanks Klaus
Am 26.05.2010 11:38, schrieb Miklos Tirpak:
Module: sip-router Branch: master Commit: 4cca625ce8229c5513451d135c09d9701c80dcd7 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4cca625c...
Author: Miklos Tirpakmiklos@iptel.org Committer: Miklos Tirpakmiklos@iptel.org Date: Wed May 26 11:31:51 2010 +0200
tm: support for changing the reply status in the script
The reply status code is re-read after the onreply_route block is executed which makes possile to change the status code from the
script.
The status code shall be rewritten directly in the message buffer and in the parsed structure, and the class of provisional and positive final replies cannot be changed.
modules/tm/t_reply.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c index 9ad1d0e..2e6fd55 100644 --- a/modules/tm/t_reply.c +++ b/modules/tm/t_reply.c @@ -2129,6 +2129,17 @@ int reply_received( struct sip_msg *p_msg ) stop_rb_timers(&uac->request); } #endif /* TM_ONREPLY_FINAL_DROP_OK */
/* Re-read the status code, it can be changed in the route
block. */
+#ifdef EXTRA_DEBUG
/* The class of provisional and positive final replies
cannot be changed. */
if (((msg_status< 300) || (p_msg->REPLY_STATUS< 300))
&& (msg_status/100 != p_msg->REPLY_STATUS/100)
) {
LOG(L_ERR, "ERROR: The class of provisional and "
"positive final replies should not be changed!\n");
}
+#endif /* EXTRA_DEBUG */
#ifdef USE_DST_BLACKLIST /* add temporary to the blacklist the source of a 503 reply */msg_status=p_msg->REPLY_STATUS; }
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Am 26.05.2010 12:21, schrieb Miklos Tirpak:
Hi Klaus,
On 05/26/2010 11:56 AM, Klaus Darilion wrote:
Hi Miklos!
How can the reply status be changed?
there should be some other function added, what tm module does is only checking for the change. If you need it then I can add the function to modules_s/textops for instance.
I think that would be a useful extension.
regards Klaus
If it is changed in reply-route, will failure route have the changed-one?
Yes.
Miklos
Thanks Klaus
Am 26.05.2010 11:38, schrieb Miklos Tirpak:
Module: sip-router Branch: master Commit: 4cca625ce8229c5513451d135c09d9701c80dcd7 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4cca625c...
Author: Miklos Tirpakmiklos@iptel.org Committer: Miklos Tirpakmiklos@iptel.org Date: Wed May 26 11:31:51 2010 +0200
tm: support for changing the reply status in the script
The reply status code is re-read after the onreply_route block is executed which makes possile to change the status code from the
script.
The status code shall be rewritten directly in the message buffer and in the parsed structure, and the class of provisional and positive final replies cannot be changed.
modules/tm/t_reply.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c index 9ad1d0e..2e6fd55 100644 --- a/modules/tm/t_reply.c +++ b/modules/tm/t_reply.c @@ -2129,6 +2129,17 @@ int reply_received( struct sip_msg *p_msg ) stop_rb_timers(&uac->request); } #endif /* TM_ONREPLY_FINAL_DROP_OK */
- /* Re-read the status code, it can be changed in the route block. */
+#ifdef EXTRA_DEBUG
- /* The class of provisional and positive final replies cannot be
changed. */
- if (((msg_status< 300) || (p_msg->REPLY_STATUS< 300))
- && (msg_status/100 != p_msg->REPLY_STATUS/100)
- ) {
- LOG(L_ERR, "ERROR: The class of provisional and "
- "positive final replies should not be changed!\n");
- }
+#endif /* EXTRA_DEBUG */
- msg_status=p_msg->REPLY_STATUS;
} #ifdef USE_DST_BLACKLIST /* add temporary to the blacklist the source of a 503 reply */
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
On 05/26/2010 02:22 PM, Klaus Darilion wrote:
Am 26.05.2010 12:21, schrieb Miklos Tirpak:
Hi Klaus,
On 05/26/2010 11:56 AM, Klaus Darilion wrote:
Hi Miklos!
How can the reply status be changed?
there should be some other function added, what tm module does is only checking for the change. If you need it then I can add the function to modules_s/textops for instance.
I think that would be a useful extension.
I have added the function: change_reply_status(code, reason)
Miklos
regards Klaus
If it is changed in reply-route, will failure route have the changed-one?
Yes.
Miklos
Thanks Klaus
Am 26.05.2010 11:38, schrieb Miklos Tirpak:
Module: sip-router Branch: master Commit: 4cca625ce8229c5513451d135c09d9701c80dcd7 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4cca625c...
Author: Miklos Tirpakmiklos@iptel.org Committer: Miklos Tirpakmiklos@iptel.org Date: Wed May 26 11:31:51 2010 +0200
tm: support for changing the reply status in the script
The reply status code is re-read after the onreply_route block is executed which makes possile to change the status code from the
script.
The status code shall be rewritten directly in the message buffer and in the parsed structure, and the class of provisional and positive final replies cannot be changed.
modules/tm/t_reply.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c index 9ad1d0e..2e6fd55 100644 --- a/modules/tm/t_reply.c +++ b/modules/tm/t_reply.c @@ -2129,6 +2129,17 @@ int reply_received( struct sip_msg *p_msg ) stop_rb_timers(&uac->request); } #endif /* TM_ONREPLY_FINAL_DROP_OK */
- /* Re-read the status code, it can be changed in the route block. */
+#ifdef EXTRA_DEBUG
- /* The class of provisional and positive final replies cannot be
changed. */
- if (((msg_status< 300) || (p_msg->REPLY_STATUS< 300))
- && (msg_status/100 != p_msg->REPLY_STATUS/100)
- ) {
- LOG(L_ERR, "ERROR: The class of provisional and "
- "positive final replies should not be changed!\n");
- }
+#endif /* EXTRA_DEBUG */
- msg_status=p_msg->REPLY_STATUS;
} #ifdef USE_DST_BLACKLIST /* add temporary to the blacklist the source of a 503 reply */
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Am 26.05.2010 17:45, schrieb Miklos Tirpak:
On 05/26/2010 02:22 PM, Klaus Darilion wrote:
Am 26.05.2010 12:21, schrieb Miklos Tirpak:
Hi Klaus,
On 05/26/2010 11:56 AM, Klaus Darilion wrote:
Hi Miklos!
How can the reply status be changed?
there should be some other function added, what tm module does is only checking for the change. If you need it then I can add the function to modules_s/textops for instance.
I think that would be a useful extension.
I have added the function: change_reply_status(code, reason)
Thanks Klaus
2010/5/26 Miklos Tirpak miklos@iptel.org:
How can the reply status be changed?
there should be some other function added, what tm module does is only checking for the change. If you need it then I can add the function to modules_s/textops for instance.
Exotic question: what would occur if I change a 180 response to 486 in onreply_route? Transaction client must end in this case, would it happen?
Thanks.
Hi,
On 05/26/2010 11:46 PM, Iñaki Baz Castillo wrote:
2010/5/26 Miklos Tirpak miklos@iptel.org:
How can the reply status be changed?
there should be some other function added, what tm module does is only checking for the change. If you need it then I can add the function to modules_s/textops for instance.
Exotic question: what would occur if I change a 180 response to 486 in onreply_route? Transaction client must end in this case, would it happen?
to keep the feature simple, I disallowed this case. 1xx can be changed only to 1xx, 2xx to 2xx, and [3456]xx to [3456]xx.
As far as I know Andrei added support for sending replies from onreply_route. You can call t_reply(486, "...") when the 180 is received if you wish, I think tm will cancel the pending branch properly. Hence, I did not care about this case, and just disallowed it.
Miklos
Thanks.
On May 27, 2010 at 09:29, Miklos Tirpak miklos@iptel.org wrote:
Hi,
On 05/26/2010 11:46 PM, Iñaki Baz Castillo wrote:
2010/5/26 Miklos Tirpak miklos@iptel.org:
How can the reply status be changed?
there should be some other function added, what tm module does is only checking for the change. If you need it then I can add the function to modules_s/textops for instance.
Exotic question: what would occur if I change a 180 response to 486 in onreply_route? Transaction client must end in this case, would it happen?
to keep the feature simple, I disallowed this case. 1xx can be changed only to 1xx, 2xx to 2xx, and [3456]xx to [3456]xx.
As far as I know Andrei added support for sending replies from onreply_route. You can call t_reply(486, "...") when the 180 is received if you wish, I think tm will cancel the pending branch properly. Hence, I did not care about this case, and just disallowed it.
Yes, one can t_reply() the transaction from the on_reply route. Note though that this will act as the final reply (the transaction will be terminated, no failure route will be called) and not as a per branch reply. If you want to change the per-branch reply, you need to use Miklos's new addition with the limitation that you can't change the reply class.
Andrei
On 05/27/2010 11:20 AM, Andrei Pelinescu-Onciul wrote:
On May 27, 2010 at 09:29, Miklos Tirpak miklos@iptel.org wrote:
Hi,
On 05/26/2010 11:46 PM, Iñaki Baz Castillo wrote:
2010/5/26 Miklos Tirpak miklos@iptel.org:
How can the reply status be changed?
there should be some other function added, what tm module does is only checking for the change. If you need it then I can add the function to modules_s/textops for instance.
Exotic question: what would occur if I change a 180 response to 486 in onreply_route? Transaction client must end in this case, would it happen?
to keep the feature simple, I disallowed this case. 1xx can be changed only to 1xx, 2xx to 2xx, and [3456]xx to [3456]xx.
As far as I know Andrei added support for sending replies from onreply_route. You can call t_reply(486, "...") when the 180 is received if you wish, I think tm will cancel the pending branch properly. Hence, I did not care about this case, and just disallowed it.
Yes, one can t_reply() the transaction from the on_reply route. Note though that this will act as the final reply (the transaction will be terminated, no failure route will be called) and not as a per branch reply. If you want to change the per-branch reply, you need to use Miklos's new addition with the limitation that you can't change the reply class.
Actually you can change the class when it is >=300, the new value should be also >=300. In other words, provisional, negative, and positive final replies cannot be swapped.
Miklos
Andrei
2010/5/27 Miklos Tirpak miklos@iptel.org:
Actually you can change the class when it is >=300, the new value should be also >=300. In other words, provisional, negative, and positive final replies cannot be swapped.
And it makes sense, more if we can now use t_reply in onreply_route :)
On 05/27/2010 12:46 PM, Iñaki Baz Castillo wrote:
2010/5/27 Miklos Tirpak miklos@iptel.org:
Actually you can change the class when it is >=300, the new value should be also >=300. In other words, provisional, negative, and positive final replies cannot be swapped.
And it makes sense, more if we can now use t_reply in onreply_route :)
Well, I think there is a major difference even with negative responses in case of parallel forking. t_reply() immediately sends back a final reply and cancels the pending branches. change_reply_status() affects only a single branch that may not win at the end.
Miklos
2010/5/27 Miklos Tirpak miklos@iptel.org:
Well, I think there is a major difference even with negative responses in case of parallel forking. t_reply() immediately sends back a final reply and cancels the pending branches. change_reply_status() affects only a single branch that may not win at the end.
Thanks for the clarification. It makes sense as if the proxy sends a final reply to the UAC it must terminate the pending branches.