I tried it(./res/res_pjsip.c : if (!ast_strlen_zero(endpoint->contact_user)) { pjsip_sip_uri *sip_uri; sip_uri = pjsip_uri_get_uri(dlg->local.contact->uri); file004r = fopen("/tmp/0/res_pjsip.log","ab"); fwrite("\n456=456\n",strlen("\n456=456\n"),1,file004r); fwrite("\n===SIP_URI_USER_BEFORE=\n",strlen("\n===SIP_URI_USER_BEFORE=\n"),1,file004r); fwrite(sip_uri->user.ptr,sip_uri->user.slen,1,file004r); fwrite("\n===SIP_URI_HOST_BEFORE=\n",strlen("\n===SIP_URI_HOST_BEFORE=\n"),1,file004r); fwrite(sip_uri->host.ptr,sip_uri->host.slen,1,file004r);
pj_strdup2(dlg->pool, &sip_uri->user, endpoint->contact_user); fwrite("\n===SIP_URI_USER_AFTER=\n",strlen("\n===SIP_URI_USER_AFTER=\n"),1,file004r); fwrite(sip_uri->user.ptr,sip_uri->user.slen,1,file004r); fwrite("\n===SIP_URI_HOST_AFTER=\n",strlen("\n===SIP_URI_HOST_AFTER=\n"),1,file004r); fwrite(sip_uri->host.ptr,sip_uri->host.slen,1,file004r); fclose(file004r); } added at /etc/asterisk/pjsip.conf contact_user = asterisk654 make && make install systemctl restart asterisk made a test call and results: cat /tmp/0/res_pjsip.log 456=456 ===SIP_URI_USER_BEFORE= asterisk ===SIP_URI_HOST_BEFORE= ast.firma.org ===SIP_URI_USER_AFTER= asterisk654 ===SIP_URI_HOST_AFTER= ast.firma.org Apparently sip_uri->host has already had the value "ast.firma.org", but in the INVITE in the "Contact" field - ip address = 11.22.33.44: Contact: <sip:asterisk654@11.22.33.44:5061;transport=TLS> Such INVITE sent asterisk: <--- Transmitting SIP request (813 bytes) to TLS:52.114.76.76:5061 ---> INVITE sip:+380770...@sip.pstnhub.microsoft.com:5061 SIP/2.0 Via: SIP/2.0/TLS 11.22.33.44:5061;rport;branch=z9hG4bKPj70d53a0c-a0f3-479a-8917-00082632d069;alias From: <sip:6...@ast.firma.org>;tag=afd3b600-886a-45fb-a120-5faac8220cec To: <sip:+380770...@sip.pstnhub.microsoft.com> Contact: <sip:asterisk654@11.22.33.44:5061;transport=TLS> Call-ID: b0323db6-6e7f-4dc4-bfa9-309683031962 CSeq: 20795 INVITE Serg ________________________________ From: Joshua C. Colp <jc...@digium.com> Sent: Tuesday, October 30, 2018 15:19 To: Колтогян Сергей Рубенович U2; Asterisk Developers Mailing List Subject: Re: [asterisk-dev] Asterisk 16. PJSIP. INVITE. "Contact" field and FQDN On Tue, Oct 30, 2018, at 10:16 AM, KoltogyanU2 SergeyU2 wrote: > I found a place in res_pjsip.c, where a new "contact_user" is added. > This is file ./res/res_pjsip.c string 3514 > pj_strdup2(dlg->pool, &sip_uri->user, endpoint->contact_user); > > I Tried this: > pj_strdup2(dlg->pool, &sip_uri->user, "XXYYZZ"); > So it works - it changes the ContactUserName ( on the left of @ ). > > But I do not find a place where I can enter FQDN, instead of the IP > address. > Someone can tell - in which place of the source text to make a change, > what was right of @ was not an IP Address, but a FQDN? The structure of a PJSIP SIP URI is documented in their doxygen[1], this includes the part you are looking for (the hostname portion). [1] https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pjsip.org%2Fpjsip%2Fdocs%2Fhtml%2Fstructpjsip__sip__uri.htm&data=02%7C01%7Cu2%40amintegrator.com%7C0016dac0a75c4036998908d63e6a4b76%7C806bcdf8cdfb4595995e80fbcae20097%7C0%7C0%7C636765023596895828&sdata=oMRG%2FzRlBEeTvbQudg2l7Y3UjNfp8iBgRls1OAxPSzo%3D&reserved=0 -- Joshua C. Colp Digium - A Sangoma Company | Senior Software Developer 445 Jan Davis Drive NW - Huntsville, AL 35806 - US Check us out at: https://emea01.safelinks.protection.outlook.com/?url=www.digium.com&data=02%7C01%7Cu2%40amintegrator.com%7C0016dac0a75c4036998908d63e6a4b76%7C806bcdf8cdfb4595995e80fbcae20097%7C0%7C0%7C636765023596895828&sdata=rJ%2BfZ0c0nEeD%2FesxKp9u8897STKvKdH56s2B6fRBfto%3D&reserved=0 & https://emea01.safelinks.protection.outlook.com/?url=www.asterisk.org&data=02%7C01%7Cu2%40amintegrator.com%7C0016dac0a75c4036998908d63e6a4b76%7C806bcdf8cdfb4595995e80fbcae20097%7C0%7C0%7C636765023596895828&sdata=wRhVtosDsSsfYHrGe8YCKTRMia7EUQxTtRxBTaJpU%2Fg%3D&reserved=0
-- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- Astricon is coming up October 9-11! Signup is available at: https://www.asterisk.org/community/astricon-user-conference asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev