[SR-Users] t_suspend() / t_continue() create new branches

Daniel-Constantin Mierla miconda at gmail.com
Wed Nov 24 16:30:19 CET 2021


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 at pascom.net>
> An: "sr-users" <sr-users at 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 at 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
>
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions
>   * sr-users at 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

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - Online
  Feb 21-24, 2022 (America Timezone)
  * https://www.asipto.com/sw/kamailio-advanced-training-online/




More information about the sr-users mailing list