btriller left a comment (kamailio/kamailio#4303)
Can you provide more details when it happens the case this PR tries to fix?
Also, do not do formatting and logs changes in a commit that fixes an issue, it makes it harder to understand what is related to what. Do formatting/log changes in a separate commit.
I updated commit text/description. Is it more clear now? Debug log for broken case ``` {1 16260 INVITE 68366c48-358f-4708-8ade-b9ba966f846d} uac [uac.c:588]: ki_replace_to(): dsp=(nil) (len=0) , uri=0x7ffccaa314c0 (len=24) {1 16260 INVITE 68366c48-358f-4708-8ade-b9ba966f846d} uac [replace.c:354]: replace_uri(): uri to replace [sip:02212345@1.2.3.4] {1 16260 INVITE 68366c48-358f-4708-8ade-b9ba966f846d} uac [replace.c:355]: replace_uri(): replacement uri is [sip:02212345@example.com] {1 16260 INVITE 68366c48-358f-4708-8ade-b9ba966f846d} uac [replace.c:404]: replace_uri(): Stored <_uac_to> var in dialog with value sip:02212345@1.2.3.4 {1 16260 INVITE 68366c48-358f-4708-8ade-b9ba966f846d} uac [replace.c:424]: replace_uri(): Stored <_uac_tonew> var in dialog with value sip:02212345@example.com {1 16260 INVITE 68366c48-358f-4708-8ade-b9ba966f846d} uac [replace.c:438]: replace_uri(): Stored <_uac_tdp> var in dialog with value {1 16260 INVITE 68366c48-358f-4708-8ade-b9ba966f846d} uac [replace.c:453]: replace_uri(): Stored <_uac_tdpne> var in dialog with value {2 16260 INVITE 68366c48-358f-4708-8ade-b9ba966f846d} uac [replace.c:787]: restore_uri_reply(): removing <sip:02212345@example.com> {2 16260 INVITE 68366c48-358f-4708-8ade-b9ba966f846d} uac [replace.c:795]: restore_uri_reply(): inserting <sip:02212345@1.2.3.4> {2 16260 INVITE 68366c48-358f-4708-8ade-b9ba966f846d} uac [replace.c:787]: restore_uri_reply(): removing <sip:02212345@example.com> {2 16260 INVITE 68366c48-358f-4708-8ade-b9ba966f846d} uac [replace.c:795]: restore_uri_reply(): inserting <sip:02212345@1.2.3.4> {2 16260 INVITE 68366c48-358f-4708-8ade-b9ba966f846d} uac [replace.c:787]: restore_uri_reply(): removing <sip:02212345@example.com> {2 16260 INVITE 68366c48-358f-4708-8ade-b9ba966f846d} uac [replace.c:795]: restore_uri_reply(): inserting <sip:02212345@1.2.3.4> {1 16260 ACK 68366c48-358f-4708-8ade-b9ba966f846d} uac [replace.c:567]: restore_uri(): getting 'vsf' Route param {1 16260 ACK 68366c48-358f-4708-8ade-b9ba966f846d} uac [replace.c:570]: restore_uri(): route param 'vsf' not found {1 16260 ACK 68366c48-358f-4708-8ade-b9ba966f846d} uac [replace.c:567]: restore_uri(): getting 'vst' Route param {1 16260 ACK 68366c48-358f-4708-8ade-b9ba966f846d} uac [replace.c:570]: restore_uri(): route param 'vst' not found {1 16260 ACK 68366c48-358f-4708-8ade-b9ba966f846d} uac [replace.c:915]: replace_callback(): DOWNSTREAM direction detected - replacing uri with the new uri {1 16260 ACK 68366c48-358f-4708-8ade-b9ba966f846d} uac [replace.c:937]: replace_callback(): Replace [ sip:02212345@1.2.3.4] with [ sip:02212345@example.com] {1 20434 BYE 68366c48-358f-4708-8ade-b9ba966f846d} uac [replace.c:567]: restore_uri(): getting 'vsf' Route param {1 20434 BYE 68366c48-358f-4708-8ade-b9ba966f846d} uac [replace.c:570]: restore_uri(): route param 'vsf' not found {1 20434 BYE 68366c48-358f-4708-8ade-b9ba966f846d} uac [replace.c:567]: restore_uri(): getting 'vst' Route param {1 20434 BYE 68366c48-358f-4708-8ade-b9ba966f846d} uac [replace.c:570]: restore_uri(): route param 'vst' not found {1 20434 BYE 68366c48-358f-4708-8ade-b9ba966f846d} uac [replace.c:920]: replace_callback(): UPSTREAM direction detected - replacing uri with the original uri {1 20434 BYE 68366c48-358f-4708-8ade-b9ba966f846d} uac [replace.c:937]: replace_callback(): Replace [ sip:02212345@example.com] with [ sip:02212345@1.2.3.4] {2 20434 BYE 68366c48-358f-4708-8ade-b9ba966f846d} uac [replace.c:787]: restore_uri_reply(): removing <"02215432" sip:02215432@example.com> {2 20434 BYE 68366c48-358f-4708-8ade-b9ba966f846d} uac [replace.c:795]: restore_uri_reply(): inserting <"02215432" sip:02215432@example.com> ```