<h3>Description</h3>

We have a module that has tm callbacks of type TMCB_REQUEST_FWDED and it calls uac.replace_from API. I noticed that this call was failing in a forking scenario:
<p>First branch:</p>
<pre><code>Nov 20 16:24:59 spce proxy[28430]: DEBUG: {1 NGCP%invite_q_forking%///1-28692@127.126.0.1[0]} tm [t_hooks.c:258]: run_trans_callbacks_internal(): DBG: trans=0x7f89149cf660, callback type 16, id 0 entered
Nov 20 16:24:59 spce proxy[28430]: DEBUG: {1 NGCP%invite_q_forking%///1-28692@127.126.0.1[0]} pv_headers [pv_headers.c:413]: pv_apply_headers(): xavp->name:headers.0 br_xname:headers.0 keys_count: 21
Nov 20 16:24:59 spce proxy[28430]: DEBUG: {1 NGCP%invite_q_forking%///1-28692@127.126.0.1[0]} pv_headers [pv_headers.c:445]: pv_apply_headers(): replace_from[From]:  sip:4311002@spce.test
Nov 20 16:24:59 spce proxy[28430]: DEBUG: {1 NGCP%invite_q_forking%///1-28692@127.126.0.1[0]} uac [uac.c:489]: replace_from_api(): dsp=(nil) (len=0) , uri=0x7ffde172f250 (len=21)
Nov 20 16:24:59 spce proxy[28430]: DEBUG: {1 NGCP%invite_q_forking%///1-28692@127.126.0.1[0]} uac [replace.c:361]: replace_uri(): uri to replace [sip:testuser1002@spce.test]
Nov 20 16:24:59 spce proxy[28430]: DEBUG: {1 NGCP%invite_q_forking%///1-28692@127.126.0.1[0]} uac [replace.c:362]: replace_uri(): replacement uri is [sip:4311002@spce.test]
Nov 20 16:24:59 spce proxy[28430]: DEBUG: {1 NGCP%invite_q_forking%///1-28692@127.126.0.1[0]} uac [replace.c:506]: replace_uri(): encode is=<aVBYbwMxODMSLiN6KQM7LQplW2h4fiwKMBM-> len=36
Nov 20 16:24:59 spce proxy[28430]: DEBUG: {1 NGCP%invite_q_forking%///1-28692@127.126.0.1[0]} pv_headers [pv_headers.c:464]: pv_apply_headers(): skip unchanged To header
</code></pre>
<p>Second branch:</p>
<pre><code>Nov 20 16:24:59 spce proxy[28430]: DEBUG: {1 NGCP%invite_q_forking%///1-28692@127.126.0.1[1]} tm [t_hooks.c:258]: run_trans_callbacks_internal(): DBG: trans=0x7f89149cf660, callback type 16, id 0 entered
Nov 20 16:24:59 spce proxy[28430]: DEBUG: {1 NGCP%invite_q_forking%///1-28692@127.126.0.1[1]} pv_headers [pv_headers.c:413]: pv_apply_headers(): xavp->name:headers.1 br_xname:headers.1 keys_count: 21
Nov 20 16:24:59 spce proxy[28430]: DEBUG: {1 NGCP%invite_q_forking%///1-28692@127.126.0.1[1]} pv_headers [pv_headers.c:445]: pv_apply_headers(): replace_from[From]:  sip:4311002@spce.test
Nov 20 16:24:59 spce proxy[28430]: DEBUG: {1 NGCP%invite_q_forking%///1-28692@127.126.0.1[1]} uac [uac.c:489]: replace_from_api(): dsp=(nil) (len=0) , uri=0x7ffde172f250 (len=21)
Nov 20 16:24:59 spce proxy[28430]: ERROR: {1 NGCP%invite_q_forking%///1-28692@127.126.0.1[1]} uac [replace.c:267]: replace_uri(): called uac_replace_from() multiple times on the message
Nov 20 16:24:59 spce proxy[28430]: DEBUG: {1 NGCP%invite_q_forking%///1-28692@127.126.0.1[1]} pv_headers [pv_headers.c:464]: pv_apply_headers(): skip unchanged To header
</code></pre>
<h3>Possible solution</h3>
<p>allow TMCB_REQUEST_FWDED cb to be executed as BRANCH_ROUTE</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/2141?email_source=notifications&email_token=ABO7UZJAIFO7QXFND3SFJQTQUY2JBA5CNFSM4JP6EL52YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H3AOROA">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZN2YODEV2OEGOGIOD3QUY2JBANCNFSM4JP6EL5Q">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABO7UZMXJQCVTRMMB4I5VSLQUY2JBA5CNFSM4JP6EL52YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H3AOROA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/2141?email_source=notifications\u0026email_token=ABO7UZJAIFO7QXFND3SFJQTQUY2JBA5CNFSM4JP6EL52YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H3AOROA",
"url": "https://github.com/kamailio/kamailio/issues/2141?email_source=notifications\u0026email_token=ABO7UZJAIFO7QXFND3SFJQTQUY2JBA5CNFSM4JP6EL52YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H3AOROA",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>