[sr-dev] [kamailio/kamailio] Writing to $fU or $tU appends to header user (Issue #3165)

Benoît Panizzon notifications at github.com
Mon Jun 27 09:37:17 CEST 2022


Dear Gang

Possibly @oej could provide more in-depth information as he has witnessed this issue.

Usually the user of the from URI is the phone number displayed at the destination. There are situations where this phone number is translated.
As example. In Switzerland, the user is used to see numbers in a local format. National number starting with 0 and international numbers with 00 but on interconnection between telcos, e164 is used.
So basically when a call is sent to a customer '+41' is replaced by '0' and '+' is replaced by '00'.

Let's start with an example From: header:

`From: "Maurice Moss" <sip:+41991234567 at example.com>;user=phone`

So shortly before the call is sent out to the location of the registered CPE, this is done:

```
if ($fU =~ "^\+41") {
   $fU = "0" + $(fU{s.substr,3,0});
} else if ($fU = ~ "^\+") {
   $fU = "00" + $(fU{s.substr,1,0});
}
```

What is sent to the CPE now looks like this:

`From: "Maurice Moss" <sip:0991234567 at example.com>;user=phone`

Now we hit an error like 486 BUSY and the destination has call forwarding active to a mobile phone on another TSP. So we have to send the call out back the IC and numbers need to be translated back to e164.

We handle this in a failure route, which in turn could trigger a branch route.

So we revert the number back to e164:

`$fU = "+41" + $(fU{s.substr,1,0});`

Expected outcome:

`From: "Maurice Moss" <sip:+41991234567 at example.com>;user=phone`

Observed outcome:

`From: "Maurice Moss" <sip:0991234567+41991234567 at example.com>;user=phone`

So setting $fU more than once is appending to the user element of the From header URI.

This behavior has not been found in any documentation.

I have been working around most of the issues by making sure I change $fU (and $tU) at the latest possible time and only once. But in the case described above, I have not been able to come up with a work-around yet.

I also can't think of any benefit of the way those PV are handled or any harm that could be done, to handle them differently and make the last 'write' overwrite and previous value, instead of appending.

Thank you for looking into this.

-Benoît-

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3165
You are receiving this because you are subscribed to this thread.

Message ID: <kamailio/kamailio/issues/3165 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20220627/69aa17ae/attachment.htm>


More information about the sr-dev mailing list