Hello,
Using Kamailio 6.0.2.
I'm running a registrar that can fork incoming calls to two or more registered users. Some users are WebRTC and others are not, so RTPEngine needs to handle them differently.
In the branch route, I call: rtpengine_manage("via-branch=auto replace-origin");
However, the via-branch passed to RTPEngine doesn't match the branch ID of the actual INVITEs sent out.
When one branch answers, the others get a CANCEL, but the CANCEL/200 OK sent to RTPEngine includes a different via-branch than the one used for the original INVITE. This causes media handling issues.
I saw that the docs suggest using $T_branch(name) or AVPs to set the correct branch name, but $T_branch(name) seems deprecated or removed.
In previous setups, branching was done on a separate instance, so identifying the right branch was easier. Now that it's local, I’m unsure how to arm rtpengine_manage() with the correct via-branch.
*TL;DR:* When doing local forking, how can I set the correct via-branch value for each leg in rtpengine_manage()?
Thanks, David
Hello Richard,
Your solution was half the fix.
I set via-branch=next on the initial INVITE and I set via-branch=1 on the reply.
For anyone else reading this, via-branch=1 is needed on the reply so that the FIRST via header is used to match the via header from via-branch=next.
via-branch=auto+via-branch=auto => This is good if the branching happened on the previous SIP Proxy and the current proxy is handling both branches.
via-branch=next+via-branch=1 => This is good if the branching happens on the current SIP Proxy.
With this, the audio works perfectly and is no longer dropped.
Thank you!
David
On Thu, Aug 7, 2025 at 7:59 AM Richard Fuchs via sr-users < sr-users@lists.kamailio.org> wrote:
On 06/08/2025 20.47, David Tek via sr-users wrote:
When doing local forking, how can I set the correct via-branch value for each leg in rtpengine_manage()?
Have you tried with `via-branch=next` ?
Cheers __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions -- sr-users@lists.kamailio.org To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!
Hello,
where do you got the information that $T_branch(name) is deprecated? It’s in the docs and also in the source code available:
https://www.kamailio.org/wikidocs/cookbooks/devel/pseudovariables/#t_branchn...
Cheers,
Henning
From: David Tek via sr-users sr-users@lists.kamailio.org Sent: Donnerstag, 7. August 2025 02:47 To: David Tek via sr-users sr-users@lists.kamailio.org Cc: David Tek davidtek7@gmail.com Subject: [SR-Users] RTPEngine and branch_route
Hello,
Using Kamailio 6.0.2.
I'm running a registrar that can fork incoming calls to two or more registered users. Some users are WebRTC and others are not, so RTPEngine needs to handle them differently.
In the branch route, I call: rtpengine_manage("via-branch=auto replace-origin");
However, the via-branch passed to RTPEngine doesn't match the branch ID of the actual INVITEs sent out.
When one branch answers, the others get a CANCEL, but the CANCEL/200 OK sent to RTPEngine includes a different via-branch than the one used for the original INVITE. This causes media handling issues.
I saw that the docs suggest using $T_branch(name) or AVPs to set the correct branch name, but $T_branch(name) seems deprecated or removed.
In previous setups, branching was done on a separate instance, so identifying the right branch was easier. Now that it's local, I’m unsure how to arm rtpengine_manage() with the correct via-branch.
TL;DR: When doing local forking, how can I set the correct via-branch value for each leg in rtpengine_manage()?
Thanks, David
David,
I'm having exact the same setup with different type of clients behind Kamailio.
I'm using approach like
modparam("rtpengine", "extra_id_pv", "$avp(via_branch_extra_id)")
... $avp(via_branch_extra_id) = "srtp"; # For one type of clients ... $avp(via_branch_extra_id) = "dtls"; # For other type of clients ... rtpengine_manage("... via-branch=extra") .... So, basically relying not on Via branch, but client type.
Maybe this will give a hint
Le jeu. 7 août 2025 à 03:07, David Tek via sr-users < sr-users@lists.kamailio.org> a écrit :
Hello,
Using Kamailio 6.0.2.
I'm running a registrar that can fork incoming calls to two or more registered users. Some users are WebRTC and others are not, so RTPEngine needs to handle them differently.
In the branch route, I call: rtpengine_manage("via-branch=auto replace-origin");
However, the via-branch passed to RTPEngine doesn't match the branch ID of the actual INVITEs sent out.
When one branch answers, the others get a CANCEL, but the CANCEL/200 OK sent to RTPEngine includes a different via-branch than the one used for the original INVITE. This causes media handling issues.
I saw that the docs suggest using $T_branch(name) or AVPs to set the correct branch name, but $T_branch(name) seems deprecated or removed.
In previous setups, branching was done on a separate instance, so identifying the right branch was easier. Now that it's local, I’m unsure how to arm rtpengine_manage() with the correct via-branch.
*TL;DR:* When doing local forking, how can I set the correct via-branch value for each leg in rtpengine_manage()?
Thanks, David
Kamailio - Users Mailing List - Non Commercial Discussions -- sr-users@lists.kamailio.org To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!
Ihor,
Thanks for the reply,
I actually tried using via-branch=extra to resolve my issue, and I almost had it fixed but couldn't figure out what the ;branch= would contain on the outbound branch. If I hadn't gotten a solution from Richard, I was going to write the via-branch=$T_Branch_idx on the request and the last character of the branch= of the top via header as the via-branch= on the reply.
However, I like Richard's solution better, it seems safer.
I do like the idea of using the branch id to track client type, though I was using parameters on the Route headers.
Thanks.
David
On Thu, Aug 7, 2025 at 11:10 AM Ihor Olkhovskyi via sr-users < sr-users@lists.kamailio.org> wrote:
David,
I'm having exact the same setup with different type of clients behind Kamailio.
I'm using approach like
modparam("rtpengine", "extra_id_pv", "$avp(via_branch_extra_id)")
... $avp(via_branch_extra_id) = "srtp"; # For one type of clients ... $avp(via_branch_extra_id) = "dtls"; # For other type of clients ... rtpengine_manage("... via-branch=extra") .... So, basically relying not on Via branch, but client type.
Maybe this will give a hint
Le jeu. 7 août 2025 à 03:07, David Tek via sr-users < sr-users@lists.kamailio.org> a écrit :
Hello,
Using Kamailio 6.0.2.
I'm running a registrar that can fork incoming calls to two or more registered users. Some users are WebRTC and others are not, so RTPEngine needs to handle them differently.
In the branch route, I call: rtpengine_manage("via-branch=auto replace-origin");
However, the via-branch passed to RTPEngine doesn't match the branch ID of the actual INVITEs sent out.
When one branch answers, the others get a CANCEL, but the CANCEL/200 OK sent to RTPEngine includes a different via-branch than the one used for the original INVITE. This causes media handling issues.
I saw that the docs suggest using $T_branch(name) or AVPs to set the correct branch name, but $T_branch(name) seems deprecated or removed.
In previous setups, branching was done on a separate instance, so identifying the right branch was easier. Now that it's local, I’m unsure how to arm rtpengine_manage() with the correct via-branch.
*TL;DR:* When doing local forking, how can I set the correct via-branch value for each leg in rtpengine_manage()?
Thanks, David
Kamailio - Users Mailing List - Non Commercial Discussions -- sr-users@lists.kamailio.org To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!
-- Best regards, Ihor (Igor) __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions -- sr-users@lists.kamailio.org To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!