<div dir="ltr">Hello,<div><br></div><div>The scenario is an attended transfer to a remote domain.</div><div><br></div><div>The short description: </div><div>When Asterisk receives a REFER message with a refer-to header that contains "?replaces=" query, in chan_sip's function "get_refer_info" the domain is extracted with the query-part. That leads to an error (no such host) when trying to send the INVITE to this domain.</div>

<div><br></div><div>The solution is to remove the query part ('?') in the get_refer_info function (see attached diff file).</div><div><br></div><div>---</div><div><br></div><div>The following is a description of the events like a SIP trace; with A being transferor, B transferee (Asterisk) and C the transfer-target.</div>

<div><br></div><div>Two calls are established: call1 between B and A, and call2 between A and C.</div><div>When starting the transfer, the transferor A sends a REFER to Asterisk (B):</div><div>A -> REFER (Refer-to: <sip:C@domain?replaces=call2>) -> B</div>

<div>B -> 202 Accepted -> A</div><div>B -> Notify sipfrag 200 ok -> A</div><div>A -> 200 ok -> B</div><div><br></div><div>Now, there should be an outgoing INIVTE with Replaces header:</div><div>B -> INVITE (Replaces: call2) > C</div>

<div>But this INVITE never is send.</div><div><br></div><div>In Asterisk's traces you see the following:<br></div><div>  chan_sip.c: Attended transfer: Will use Replace-Call-ID : call2 (No check of from/to tags)<br></div>

<div>  chan_sip.c: SIP transfer to extension C@internal by A@domain<br></div><div>  chan_sip.c: This SIP transfer is to a remote SIP extension (remote domain domain?Replaces=call2)<br></div><div><br></div><div>Here you can see the error ^^^^. The remote domain still contains the query part (?Replaces) of the uri.</div>

<div><br></div><div>The traces then continue:</div><div>chan_sip.c: SIP attended transfer: Still not our call - generating INVITE with replaces<br></div><div><br></div><div>Then it enters the dialplan where it is redirected with a Dial command:</div>

<div>logger.c:     -- Executing [s@callreferred:4] Dial("SIP/domain-09a40b60", "SIP/C@domain?Replaces=call2|60|") in new stack<br></div><div><br></div><div>And finally the error:</div><div><div>WARNING[32395] chan_sip.c: No such host: domain?Replaces=call2</div>

<div>DEBUG[32395] chan_sip.c: Cant create SIP call - target device not registered</div></div><div><br></div><div>---</div><div><br></div><div>With the attached patch, Asterisk behaves as expected.  Should I open an issue on the tracker?</div>

<div><br></div><div>Regards</div><div>Jan</div><div><br></div><div><div><br></div>-- <br><div dir="ltr">

<table border="0" cellpadding="0" cellspacing="0">
        <tbody>
                <tr>
                        <td bgcolor="#004054" colspan="2" height="8px" width="570">
                                <img alt="" border="0" height="8" src="http://icons/ecblank.gif" width="1"></td>
                </tr>
                <tr valign="top">
                        <td bgcolor="#FFFFFF" width="380">
                                <font color="#004054" face="Arial"><b>Jan </b></font><b><font color="#004054" face="Arial">Gaida</font></b><br>
                                <font color="#99cc33" face="Arial" size="1">Ingeniero Desarrollo Software</font></td>
                        <td>
                                <img src="http://www.amper.es/image/logoamperH.jpg" style="float: right;"></td>
                </tr>
                <tr>
                        <td colspan="2">
                                <img alt="" border="0" height="5" src="http://icons/ecblank.gif" width="1"></td>
                </tr>
                <tr valign="top">
                        <td valign="bottom" width="380"><span style="color:rgb(0,0,0);font-family:Arial;font-size:x-small">C/ Marconi 3 (PTM)</span><br><font color="#000000" face="Arial" size="1">28760 Tres Cantos<br>Spain</font><br>
                                <font color="#8f8f8f" face="Arial" size="1"><a href="mailto:jan.gaida@grupoamper.com" target="_blank">jan.gaida@grupoamper.com</a> | </font><a href="http://www.grupoamper.com" target="_blank"><font color="#8f8f8f" face="Arial" size="1">www.grupoamper.com</font></a></td>


                        <td valign="bottom">
                                <img src="http://www.amper.es/image/lineasamper.jpg" style="float: right;"></td>
                </tr>
        </tbody>
</table>
<br></div>
</div></div>

<br>
<div><br></div><div><p><font color="#5f497a" size="1" face="Times New Roman">This message and any attachments are intended only for the use of the individual to whom they are addressed and it may contain information that is privileged or confidential. If you have received this communication by mistake, please notify us immediately by e-mail or telephone.The storage, recording, use or disclosure of this e-mail and its attachments by anyone other than the intended recipient is strictly prohibited. This message has been verified using antivirus software; however, the sender is not responsible for any damage to hardware or software resulting from the presence of any virus.</font></p><p><font color="#5f497a" size="1" face="Times New Roman"><br></font></p><p><font color="#5f497a" size="1" face="Times New Roman">Este mensaje y cualquier anexo son exclusivamente para la persona a quien van dirigidos y pueden contener información privilegiada o confidencial. Si usted ha recibido esta comunicación por error, le agradecemos notificarlo de inmediato por esta misma vía o por teléfono. Está prohibida su retención, grabación, utilización o divulgación con cualquier propósito. Este mensaje ha sido verificado con software antivirus; sin embargo, el remitente no se hace responsable en caso de que en éste o en los archivos adjuntos haya presencia de algún virus que pueda generar daños en los equipos o programas del destinatario.</font></p></div>