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@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@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@example.com;user=phone`
Observed outcome:
`From: "Maurice Moss" sip:0991234567+41991234567@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-
For questions about how to use Kamailio and its configuration file, you have to send email to sr-users@lists.kamailio.org . The bug tracker is for reporting issue in the code.
Closed #3165 as completed.
kerozin left a comment (kamailio/kamailio#3165)
I believe, that this actually a bug and the ticket closed mistakenly.
hb9eue left a comment (kamailio/kamailio#3165)
Hi @kerozin
Some years later, using kamailio in production and having learned *a lot* I don't think this is a bug, but just how kamailio works and how you are supposed to use stuff.
One very important think I learned regarding that issue (and more similar ones I had at that time) is:
Change stuff in headers like the from username etc. ONLY in branch routes before sending the call to the next hop. If the next hop fails, kamailio does weird things to stuff you changed outside a branch route.
If keeping to that rule, stuff works much smoother :-)
-Benoit-