[SR-Users] Wrong To tag in t_reply

Ivan Ribakov i.ribakov at zaleos.net
Fri Dec 11 11:04:47 CET 2020

Hi all,

I’m trying to implement following routing behaviour:

- ingress INVITE is sequentially forked to 1 or more endpoints
- under certain conditions sequential forking may be stopped and pre-defined error returned to the caller

Here’s is part of the config responsible for handling errors:


    # We need to check if the error happens before the first egress, because T-state is not defined yet so we can not use t_reply
    if ($var(before_first_egress) == 0) {
        t_reply("$var(sipCode)", "$var(sipMessage)");
    } else {
        sl_send_reply("$var(sipCode)", "$var(sipMessage)");

Here is a simple scenario where delivering call to first endpoint times out after receiving 180 Ringing (using custom fr_inv_timer value) where:
- .33 is caller
- .208 is Kamailio
- .138 is callee

Notice that 504 is retransmitted by Kamailio. Here is a comparison of 180 and 504 returned by Kamailio:

As can be seen, 180 was proxied from the callee and has callee’s to-tag (tag=CALLEE1), however 504 that was generated by Kamailio using t_reply() has a different to-tag (presumably generated by Kamailio).

How can I tell Kamailio not to generate new to-tag but to use the last one that proxied back to the caller?

Thanks in advance for any help!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20201211/f42dd522/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PastedGraphic-1.png
Type: image/png
Size: 51562 bytes
Desc: not available
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20201211/f42dd522/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PastedGraphic-2.tiff
Type: image/tiff
Size: 102494 bytes
Desc: not available
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20201211/f42dd522/attachment.tiff>

More information about the sr-users mailing list