<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=koi8-r">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I tried it(./res/res_pjsip.c :</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>if (!ast_strlen_zero(endpoint->contact_user)) {<br>
</span>
<div> pjsip_sip_uri *sip_uri;<br>
</div>
<div> sip_uri = pjsip_uri_get_uri(dlg->local.contact->uri);<br>
</div>
<div>file004r = fopen("/tmp/0/res_pjsip.log","ab");   <br>
</div>
<div>fwrite("\n456=456\n",strlen("\n456=456\n"),1,file004r);<br>
</div>
<div>fwrite("\n===SIP_URI_USER_BEFORE=\n",strlen("\n===SIP_URI_USER_BEFORE=\n"),1,file004r);<br>
</div>
<div>fwrite(sip_uri->user.ptr,sip_uri->user.slen,1,file004r);<br>
</div>
<div>fwrite("\n===SIP_URI_HOST_BEFORE=\n",strlen("\n===SIP_URI_HOST_BEFORE=\n"),1,file004r);<br>
</div>
<div>fwrite(sip_uri->host.ptr,sip_uri->host.slen,1,file004r);<br>
</div>
<div><br>
</div>
<div> pj_strdup2(dlg->pool, &sip_uri->user, endpoint->contact_user);<br>
</div>
<div><br>
</div>
<div>fwrite("\n===SIP_URI_USER_AFTER=\n",strlen("\n===SIP_URI_USER_AFTER=\n"),1,file004r);<br>
</div>
<div>fwrite(sip_uri->user.ptr,sip_uri->user.slen,1,file004r);<br>
</div>
<div>fwrite("\n===SIP_URI_HOST_AFTER=\n",strlen("\n===SIP_URI_HOST_AFTER=\n"),1,file004r);<br>
</div>
<div>fwrite(sip_uri->host.ptr,sip_uri->host.slen,1,file004r);<br>
</div>
<div>fclose(file004r);<br>
</div>
<div><br>
</div>
<div>}<br>
</div>
<span></span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
added at /etc/asterisk/pjsip.conf</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
contact_user = asterisk654</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
make && make install <br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
systemctl restart asterisk</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span lang="en"><span>made a test call</span></span>  <br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
and results:</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
cat /tmp/0/res_pjsip.log</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>456=456<br>
</span>
<div><br>
</div>
<div>===SIP_URI_USER_BEFORE=<br>
</div>
<div>asterisk<br>
</div>
<div>===SIP_URI_HOST_BEFORE=<br>
</div>
<div>ast.firma.org<br>
</div>
<div>===SIP_URI_USER_AFTER=<br>
</div>
<div>asterisk654<br>
</div>
<div>===SIP_URI_HOST_AFTER=<br>
</div>
<span>ast.firma.org</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span><br>
</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span><span lang="en"><span>Apparently sip_uri->host  has already had the value  "ast.firma.org",</span></span></span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span><span lang="en"><span>but in the INVITE  in the "Contact" field - ip address = 11.22.33.44:</span></span></span><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span>Contact: <sip:asterisk654@11.22.33.44:5061;transport=TLS></span><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
S<span><span lang="en"><span>uch INVITE sent asterisk</span></span>:</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span><span><--- Transmitting SIP request (813 bytes) to TLS:52.114.76.76:5061 ---><br>
</span>
<div>INVITE sip:+380770081@sip.pstnhub.microsoft.com:5061 SIP/2.0<br>
</div>
<div>Via: SIP/2.0/TLS 11.22.33.44:5061;rport;branch=z9hG4bKPj70d53a0c-a0f3-479a-8917-00082632d069;alias<br>
</div>
<div>From: <sip:6001@ast.firma.org>;tag=afd3b600-886a-45fb-a120-5faac8220cec<br>
</div>
<div>To: <sip:+380770081@sip.pstnhub.microsoft.com><br>
</div>
<div>Contact: <sip:asterisk654@11.22.33.44:5061;transport=TLS><br>
</div>
<div>Call-ID: b0323db6-6e7f-4dc4-bfa9-309683031962<br>
</div>
<span>CSeq: 20795 INVITE</span><br>
</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Serg<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Joshua C. Colp <jcolp@digium.com><br>
<b>Sent:</b> Tuesday, October 30, 2018 15:19<br>
<b>To:</b> Колтогян Сергей Рубенович U2; Asterisk Developers Mailing List<br>
<b>Subject:</b> Re: [asterisk-dev] Asterisk 16. PJSIP. INVITE. "Contact" field and FQDN</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">On Tue, Oct 30, 2018, at 10:16 AM, KoltogyanU2 SergeyU2 wrote:<br>
> I found a place in res_pjsip.c, where a new "contact_user" is added.<br>
> This is file   ./res/res_pjsip.c  string 3514<br>
> pj_strdup2(dlg->pool, &sip_uri->user, endpoint->contact_user);<br>
> <br>
> I Tried this:<br>
> pj_strdup2(dlg->pool, &sip_uri->user, "XXYYZZ");<br>
> So it works - it changes the ContactUserName ( on the left of @ ).<br>
> <br>
> But I do not find a place where I can enter FQDN, instead of the IP <br>
> address.<br>
> Someone can tell - in which place of the source text to make a change, <br>
> what was right of @ was not an IP Address, but a FQDN?<br>
<br>
The structure of a PJSIP SIP URI is documented in their doxygen[1], this includes the part you are looking for (the hostname portion).<br>
<br>
[1] <a href="https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pjsip.org%2Fpjsip%2Fdocs%2Fhtml%2Fstructpjsip__sip__uri.htm&amp;data=02%7C01%7Cu2%40amintegrator.com%7C0016dac0a75c4036998908d63e6a4b76%7C806bcdf8cdfb4595995e80fbcae20097%7C0%7C0%7C636765023596895828&amp;sdata=oMRG%2FzRlBEeTvbQudg2l7Y3UjNfp8iBgRls1OAxPSzo%3D&amp;reserved=0">
https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pjsip.org%2Fpjsip%2Fdocs%2Fhtml%2Fstructpjsip__sip__uri.htm&amp;data=02%7C01%7Cu2%40amintegrator.com%7C0016dac0a75c4036998908d63e6a4b76%7C806bcdf8cdfb4595995e80fbcae20097%7C0%7C0%7C636765023596895828&amp;sdata=oMRG%2FzRlBEeTvbQudg2l7Y3UjNfp8iBgRls1OAxPSzo%3D&amp;reserved=0</a><br>
<br>
-- <br>
Joshua C. Colp<br>
Digium - A Sangoma Company | Senior Software Developer<br>
445 Jan Davis Drive NW - Huntsville, AL 35806 - US<br>
Check us out at: <a href="https://emea01.safelinks.protection.outlook.com/?url=www.digium.com&amp;data=02%7C01%7Cu2%40amintegrator.com%7C0016dac0a75c4036998908d63e6a4b76%7C806bcdf8cdfb4595995e80fbcae20097%7C0%7C0%7C636765023596895828&amp;sdata=rJ%2BfZ0c0nEeD%2FesxKp9u8897STKvKdH56s2B6fRBfto%3D&amp;reserved=0">
https://emea01.safelinks.protection.outlook.com/?url=www.digium.com&amp;data=02%7C01%7Cu2%40amintegrator.com%7C0016dac0a75c4036998908d63e6a4b76%7C806bcdf8cdfb4595995e80fbcae20097%7C0%7C0%7C636765023596895828&amp;sdata=rJ%2BfZ0c0nEeD%2FesxKp9u8897STKvKdH56s2B6fRBfto%3D&amp;reserved=0</a>
 & <a href="https://emea01.safelinks.protection.outlook.com/?url=www.asterisk.org&amp;data=02%7C01%7Cu2%40amintegrator.com%7C0016dac0a75c4036998908d63e6a4b76%7C806bcdf8cdfb4595995e80fbcae20097%7C0%7C0%7C636765023596895828&amp;sdata=wRhVtosDsSsfYHrGe8YCKTRMia7EUQxTtRxBTaJpU%2Fg%3D&amp;reserved=0">
https://emea01.safelinks.protection.outlook.com/?url=www.asterisk.org&amp;data=02%7C01%7Cu2%40amintegrator.com%7C0016dac0a75c4036998908d63e6a4b76%7C806bcdf8cdfb4595995e80fbcae20097%7C0%7C0%7C636765023596895828&amp;sdata=wRhVtosDsSsfYHrGe8YCKTRMia7EUQxTtRxBTaJpU%2Fg%3D&amp;reserved=0</a><br>
</div>
</span></font></div>
</div>
</body>
</html>