Hi,
I have the following weird problem. A Kamailio (5.4.x) with some asynchronous permission logic suspends outgoing INVITEs and resumes them after the answer of the permission system. Everything works as expected when the call is answered. However, when the called party rejects the call (with a 486 for example), the call doesn't get torn down immediately (it is rejected with a 408 eventually) because Kamailio logs the following:
Nov 23 14:51:02 host /usr/sbin/kamailio[1569]: DEBUG: app_python [apy_kemi.c:106]: sr_kemi_config_engine_python(): execution of route type 4 with name [ksr_onreply_manage] returned 1 Nov 23 14:51:02 host /usr/sbin/kamailio[1569]: DEBUG: tm [t_reply.c:1363]: t_should_relay_response(): ->>>>>>>>> T_code=183, new_code=486 Nov 23 14:51:02 host /usr/sbin/kamailio[1569]: DEBUG: tm [t_reply.c:1448]: t_should_relay_response(): store - other branches still active Nov 23 14:51:02 host /usr/sbin/kamailio[1569]: DEBUG: tm [t_reply.c:1926]: relay_reply(): reply status=3 branch=2, save=1, relay=-1 icode=0 msg status=486
I don't do any forking, the call is just forwarded.
I put the following line immediately after t_suspend() and in the beginning of the route specified in t_continue():
KSR.info("We're at branch index %d" % KSR.pv.get("$T(branch_index)"))
This produces the following output:
Nov 23 16:30:13 host /usr/sbin/kamailio[2745]: INFO: <core> [core/kemi.c:104]: sr_kemi_core_info(): We're at branch index 0 Nov 23 16:30:13 host /usr/sbin/kamailio[2725]: INFO: <core> [core/kemi.c:104]: sr_kemi_core_info(): We're at branch index 2
So apparently, the suspend and continue introduce new branches. (Other option: I'm doing something completely different creating those branches, but I don't have any append_branch() or similar in my code.)
I assume, I just missed a configuration parameter. Can I get Kamailio somehow to behave as if there was just one branch and forward the negative reply?
Thanks, Sebastian
After spending more hours of unsuccessful debugging, I can add to my problem:
My call enters the branch_route_failure route, where I can get the 486 status with t_get_status_code(). However, I cannot issue a t_reply() in this phase of the call. And after some more seconds, when the transaction times out (looks like it's the no-answer-received timer of 30 seconds), Kamailio just sends a 408 without entering any route anymore. I have a debug output in my failure route, which is never printed.
I tried virtually every command from tm or tmx module in the last hours that looked like it could help. Without success. Still stuck at "Why is there another branch after t_suspend and t_continue and how do I make it go away? There's just an evapi call to cgrates in between.
Grateful for any ideas.
Thanks, Sebastian
----- Ursprüngliche Mail ----- Von: "Sebastian Damm" sdamm@pascom.net An: "sr-users" sr-users@lists.kamailio.org Gesendet: Dienstag, 23. November 2021 17:51:02 Betreff: [SR-Users] t_suspend() / t_continue() create new branches
Hi,
I have the following weird problem. A Kamailio (5.4.x) with some asynchronous permission logic suspends outgoing INVITEs and resumes them after the answer of the permission system. Everything works as expected when the call is answered. However, when the called party rejects the call (with a 486 for example), the call doesn't get torn down immediately (it is rejected with a 408 eventually) because Kamailio logs the following:
Nov 23 14:51:02 host /usr/sbin/kamailio[1569]: DEBUG: app_python [apy_kemi.c:106]: sr_kemi_config_engine_python(): execution of route type 4 with name [ksr_onreply_manage] returned 1 Nov 23 14:51:02 host /usr/sbin/kamailio[1569]: DEBUG: tm [t_reply.c:1363]: t_should_relay_response(): ->>>>>>>>> T_code=183, new_code=486 Nov 23 14:51:02 host /usr/sbin/kamailio[1569]: DEBUG: tm [t_reply.c:1448]: t_should_relay_response(): store - other branches still active Nov 23 14:51:02 host /usr/sbin/kamailio[1569]: DEBUG: tm [t_reply.c:1926]: relay_reply(): reply status=3 branch=2, save=1, relay=-1 icode=0 msg status=486
I don't do any forking, the call is just forwarded.
I put the following line immediately after t_suspend() and in the beginning of the route specified in t_continue():
KSR.info("We're at branch index %d" % KSR.pv.get("$T(branch_index)"))
This produces the following output:
Nov 23 16:30:13 host /usr/sbin/kamailio[2745]: INFO: <core> [core/kemi.c:104]: sr_kemi_core_info(): We're at branch index 0 Nov 23 16:30:13 host /usr/sbin/kamailio[2725]: INFO: <core> [core/kemi.c:104]: sr_kemi_core_info(): We're at branch index 2
So apparently, the suspend and continue introduce new branches. (Other option: I'm doing something completely different creating those branches, but I don't have any append_branch() or similar in my code.)
I assume, I just missed a configuration parameter. Can I get Kamailio somehow to behave as if there was just one branch and forward the negative reply?
Thanks, Sebastian
__________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions * sr-users@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe: * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hello,
a suspend of a request is practically a branch that is not sent out, which can also time out, if not resumed before retransmission timeout value and can get in failure route if requested.
On continue, the suspended branch is closed like when a negative response is received on that branch and a new one is created to allow processing/routing further the request. So, yes, the mechanism behind is relying on using branches.
Note that on re-routing, you have to request again failure route execution. If no branch was answered with 200ok, you can enforce the response code in failure route with t_reply().
Cheers, Daniel
On 24.11.21 14:43, Sebastian Damm wrote:
After spending more hours of unsuccessful debugging, I can add to my problem:
My call enters the branch_route_failure route, where I can get the 486 status with t_get_status_code(). However, I cannot issue a t_reply() in this phase of the call. And after some more seconds, when the transaction times out (looks like it's the no-answer-received timer of 30 seconds), Kamailio just sends a 408 without entering any route anymore. I have a debug output in my failure route, which is never printed.
I tried virtually every command from tm or tmx module in the last hours that looked like it could help. Without success. Still stuck at "Why is there another branch after t_suspend and t_continue and how do I make it go away? There's just an evapi call to cgrates in between.
Grateful for any ideas.
Thanks, Sebastian
----- Ursprüngliche Mail ----- Von: "Sebastian Damm" sdamm@pascom.net An: "sr-users" sr-users@lists.kamailio.org Gesendet: Dienstag, 23. November 2021 17:51:02 Betreff: [SR-Users] t_suspend() / t_continue() create new branches
Hi,
I have the following weird problem. A Kamailio (5.4.x) with some asynchronous permission logic suspends outgoing INVITEs and resumes them after the answer of the permission system. Everything works as expected when the call is answered. However, when the called party rejects the call (with a 486 for example), the call doesn't get torn down immediately (it is rejected with a 408 eventually) because Kamailio logs the following:
Nov 23 14:51:02 host /usr/sbin/kamailio[1569]: DEBUG: app_python [apy_kemi.c:106]: sr_kemi_config_engine_python(): execution of route type 4 with name [ksr_onreply_manage] returned 1 Nov 23 14:51:02 host /usr/sbin/kamailio[1569]: DEBUG: tm [t_reply.c:1363]: t_should_relay_response(): ->>>>>>>>> T_code=183, new_code=486 Nov 23 14:51:02 host /usr/sbin/kamailio[1569]: DEBUG: tm [t_reply.c:1448]: t_should_relay_response(): store - other branches still active Nov 23 14:51:02 host /usr/sbin/kamailio[1569]: DEBUG: tm [t_reply.c:1926]: relay_reply(): reply status=3 branch=2, save=1, relay=-1 icode=0 msg status=486
I don't do any forking, the call is just forwarded.
I put the following line immediately after t_suspend() and in the beginning of the route specified in t_continue():
KSR.info("We're at branch index %d" % KSR.pv.get("$T(branch_index)"))
This produces the following output:
Nov 23 16:30:13 host /usr/sbin/kamailio[2745]: INFO: <core> [core/kemi.c:104]: sr_kemi_core_info(): We're at branch index 0 Nov 23 16:30:13 host /usr/sbin/kamailio[2725]: INFO: <core> [core/kemi.c:104]: sr_kemi_core_info(): We're at branch index 2
So apparently, the suspend and continue introduce new branches. (Other option: I'm doing something completely different creating those branches, but I don't have any append_branch() or similar in my code.)
I assume, I just missed a configuration parameter. Can I get Kamailio somehow to behave as if there was just one branch and forward the negative reply?
Thanks, Sebastian
Kamailio - Users Mailing List - Non Commercial Discussions
- sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
Kamailio - Users Mailing List - Non Commercial Discussions
- sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
Hi Daniel,
thanks for the explanation.
I played around, and when setting fr_timer to 30s and fr_inv_timer to 500ms by default and setting the fr_inv_timer to 120s in branch route, it works as expected. At least when I call my mobile and reject the call there. So indeed it looks like the first branch still waits for a reply even though the branch is suspended. And when I call t_on_failure before suspending the transaction, I end up in failure route after the 30s timeout (before changing the fr_timer setting).
Does this sound like a bug in Kamailio or am I still doing something wrong? The settings I chose now could open up a race condition when the negative final reply on the request sent out comes in before the 500ms are over. I actually expect the initial branch not playing a role in call routing anymore after suspending it.
Regards, Sebastian
----- Ursprüngliche Mail ----- Von: "miconda" miconda@gmail.com An: "sr-users" sr-users@lists.kamailio.org, "Sebastian Damm" sdamm@pascom.net Gesendet: Mittwoch, 24. November 2021 16:30:19 Betreff: Re: [SR-Users] t_suspend() / t_continue() create new branches
Hello,
a suspend of a request is practically a branch that is not sent out, which can also time out, if not resumed before retransmission timeout value and can get in failure route if requested.
On continue, the suspended branch is closed like when a negative response is received on that branch and a new one is created to allow processing/routing further the request. So, yes, the mechanism behind is relying on using branches.
Note that on re-routing, you have to request again failure route execution. If no branch was answered with 200ok, you can enforce the response code in failure route with t_reply().
Cheers, Daniel
On 24.11.21 14:43, Sebastian Damm wrote:
After spending more hours of unsuccessful debugging, I can add to my problem:
My call enters the branch_route_failure route, where I can get the 486 status with t_get_status_code(). However, I cannot issue a t_reply() in this phase of the call. And after some more seconds, when the transaction times out (looks like it's the no-answer-received timer of 30 seconds), Kamailio just sends a 408 without entering any route anymore. I have a debug output in my failure route, which is never printed.
I tried virtually every command from tm or tmx module in the last hours that looked like it could help. Without success. Still stuck at "Why is there another branch after t_suspend and t_continue and how do I make it go away? There's just an evapi call to cgrates in between.
Grateful for any ideas.
Thanks, Sebastian
----- Ursprüngliche Mail ----- Von: "Sebastian Damm" sdamm@pascom.net An: "sr-users" sr-users@lists.kamailio.org Gesendet: Dienstag, 23. November 2021 17:51:02 Betreff: [SR-Users] t_suspend() / t_continue() create new branches
Hi,
I have the following weird problem. A Kamailio (5.4.x) with some asynchronous permission logic suspends outgoing INVITEs and resumes them after the answer of the permission system. Everything works as expected when the call is answered. However, when the called party rejects the call (with a 486 for example), the call doesn't get torn down immediately (it is rejected with a 408 eventually) because Kamailio logs the following:
Nov 23 14:51:02 host /usr/sbin/kamailio[1569]: DEBUG: app_python [apy_kemi.c:106]: sr_kemi_config_engine_python(): execution of route type 4 with name [ksr_onreply_manage] returned 1 Nov 23 14:51:02 host /usr/sbin/kamailio[1569]: DEBUG: tm [t_reply.c:1363]: t_should_relay_response(): ->>>>>>>>> T_code=183, new_code=486 Nov 23 14:51:02 host /usr/sbin/kamailio[1569]: DEBUG: tm [t_reply.c:1448]: t_should_relay_response(): store - other branches still active Nov 23 14:51:02 host /usr/sbin/kamailio[1569]: DEBUG: tm [t_reply.c:1926]: relay_reply(): reply status=3 branch=2, save=1, relay=-1 icode=0 msg status=486
I don't do any forking, the call is just forwarded.
I put the following line immediately after t_suspend() and in the beginning of the route specified in t_continue():
KSR.info("We're at branch index %d" % KSR.pv.get("$T(branch_index)"))
This produces the following output:
Nov 23 16:30:13 host /usr/sbin/kamailio[2745]: INFO: <core> [core/kemi.c:104]: sr_kemi_core_info(): We're at branch index 0 Nov 23 16:30:13 host /usr/sbin/kamailio[2725]: INFO: <core> [core/kemi.c:104]: sr_kemi_core_info(): We're at branch index 2
So apparently, the suspend and continue introduce new branches. (Other option: I'm doing something completely different creating those branches, but I don't have any append_branch() or similar in my code.)
I assume, I just missed a configuration parameter. Can I get Kamailio somehow to behave as if there was just one branch and forward the negative reply?
Thanks, Sebastian
Kamailio - Users Mailing List - Non Commercial Discussions
- sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
Kamailio - Users Mailing List - Non Commercial Discussions
- sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe: