Re: uac_replace_to() generates double angle brackets in To header when display name is used in kamailio 6.1.2

Ihor Olkhovskyi via sr-users <[email protected]> Tue, 19 May 2026 07:06:41 +0200
Newsgroups gmane.comp.voip.ser
Message-ID <[email protected]>
David,

Just to clarify, are you sure you're not using this function twice 
across the config?

Regards,
Ihor

Le 19/05/2026 à 06:15, David Escartin Almudevar via sr-users a écrit :
> Hello,
>
> I am seeing a possible issue with `uac_replace_to()` in Kamailio 6.1.2.
>
> Version:
>
> ```text
> kamailio 6.1.2 (x86_64/linux) 1b2dad-dirty
> ```
>
> I am calling `uac_replace_to()` passing both a display name and a To URI.
> ```text
> DEBUG: uac [uac.c:588]: ki_replace_to(): dsp=0x7ffca81777a0 (len=15) , uri=0x7ffca81777b0 (len=41)
> DEBUG: uac [replace.c:341]: replace_uri(): adding new display ["+818067029073"]
> DEBUG: uac [replace.c:368]: replace_uri(): uri to replace [sip:[email protected]:5065]
> DEBUG: uac [replace.c:369]: replace_uri(): replacement uri is [sip:[email protected];user=phone]
> DEBUG: uac [replace.c:434]: replace_uri(): Stored <_uac_to> var in dialog with value sip:[email protected]:5065
> DEBUG: uac [replace.c:454]: replace_uri(): Stored <_uac_tonew> var in dialog with value sip:[email protected];user=phone
> DEBUG: uac [replace.c:468]: replace_uri(): Stored <_uac_tdp> var in dialog with value
> DEBUG: uac [replace.c:483]: replace_uri(): Stored <_uac_tdpne> var in dialog with value "+818067029073"
> ```
> The replacement seems to work internally, but the outgoing INVITE sent to the callee contains double angle brackets in the `To` header.
>
> The resulting header is:
>
> ```text
> To: "+818067029073" <<sip:[email protected];user=phone>>
> ```
> And I get the folloing error when processing the response from UAS
> ```
> May 19 03:42:19 ip-10-100-10-19 /usr/local/kamailio/sbin/kamailio[3562]: ERROR: <core> [core/parser/parse_addr_spec.c:754]: parse_addr_spec(): unexpected char [</60] in status 5: [+818067029073 <] .
> May 19 03:42:19 ip-10-100-10-19 /usr/local/kamailio/sbin/kamailio[3562]: ERROR: <core> [core/parser/parse_to.c:56]: parse_to_body(): bad to header
> May 19 03:42:19 ip-10-100-10-19 /usr/local/kamailio/sbin/kamailio[3562]: ERROR: <core> [core/parser/msg_parser.c:342]: parse_headers(): bad header field [To: +818067029073 <<sip:[email protected];user=phone>>;tag=1803SIPpTag011
> May 19 03:42:19 ip-10-100-10-19 /usr/local/kamailio/sbin/kamailio[3562]: ERROR: <core> [core/receive.c:398]: receive_msg(): parsing relevant headers failed
> May 19 03:42:19 ip-10-100-10-19 /usr/local/kamailio/sbin/kamailio[3562]: ERROR: <core> [core/receive.c:558]: receive_msg(): required headers not found in reply
> ```
>
> If a pass the replace uri enclosed in brackets (<sip:[email protected];user=phone>), then i obtain a To header with triple <....> and I get the folowing error processing the response from callee
> ```text
> May 19 03:43:31 ip-10-100-10-19 /usr/local/kamailio/sbin/kamailio[4136]: ERROR: <core> [core/parser/parse_to.c:56]: parse_to_body(): bad to header
> May 19 03:43:31 ip-10-100-10-19 /usr/local/kamailio/sbin/kamailio[4136]: ERROR: <core> [core/parser/msg_parser.c:342]: parse_headers(): bad header field [To: +818067029073 <<<sip:[email protected];user=phone>>>;tag=1803SIPpTag012
> ```
>
> Is this a known issue in 6.1.2, or am I passing the URI/display name in the wrong format?
>
> >From the debug logs, the replacement URI appears to be stored without angle brackets, but the final generated `To` header contains:
>
> ```text
> <<sip:[email protected];user=phone>>
> ```
>
> Thanks in advance.
> David Escartín
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions -- [email protected]
> To unsubscribe send an email to [email protected]
> Important: keep the mailing list in the recipients, do not reply only to the sender!
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the sender!