<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hi,</p>
<p>Thank for your answer.<br>
</p>
<div class="moz-cite-prefix">22.04.2019 23:47, Joshua C. Colp пишет:<br>
</div>
<blockquote type="cite"
cite="mid:c4c4ecb0-9c1f-4d31-8859-c716b15d1bf8@www.fastmail.com">
<pre class="moz-quote-pre" wrap="">On Mon, Apr 22, 2019, at 1:43 PM, Pavel wrote:
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">Hi,
Got problems with incoming SIP calls.
Scenario:
Server1: 3cx or any other server
Server2: Asterisk 16.2.1 . PJPROJECT 2.8
Server2 registers on Server1 with SIP ID 1121.
Registration is OK.
Server2 outgoing calls are OK.
INVITE, unauthorized, INVITE with password, OK, RINGING,...
Troubles with incoming calls / incoming INVITE's .
I can not identify endpoint by IP, I have multiple registrations on the
same Server1.
As far as I understood, res_pjsip_endpoint_identifier_user match
endpoint by "From" header, so it will not match also.
match_headers also seems useless (not able to match "INVITE" string,
just headers like "TO:").
Is there any way to match incoming INVITE calls ? (also OPTIONS, NOTIFY,
... packets)
It should be a typical scenario, but it does not work...
Is there any way to make it working ?
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
Outbound registration provides the line option[1] which can be used to differentiate traffic in regards to different outbound registrations. It requires the remote server to adhere to the SIP RFC and report back some data we give in our Contact, so you have to test it and see if it works.
[1] <a class="moz-txt-link-freetext" href="https://blogs.asterisk.org/2016/01/27/the-pjsip-outbound-registration-line-option/">https://blogs.asterisk.org/2016/01/27/the-pjsip-outbound-registration-line-option/</a>
</pre>
</blockquote>
<p>Tried already.<br>
</p>
<p>"line" is good, but not perfect.</p>
<p>Every time I restart asterisk, it will generate new random string
for ";line=".</p>
<p>So, every time I restart asterisk, registrar (Server1) will save
one more contact in it's database.</p>
<p>Some will remove obsolete contacts, but some will not.</p>
<p>For example, FreePBX will not remove obsolete contacts, if
max_contacts specified (FreePBX will set <span style="color: rgb(36, 41, 46); font-size: 12px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">rewrite_contact=no in this case).</span></p>
<p>So, after a number of Asterisk restarts, FreePBX will reject new
registrations, as max_contacts is reached.</p>
<p>Unfortunately, "line" does not save random between restarts.<br>
</p>
<p>It's also unable to specify "random" value in pjsip.conf.</p>
<br>
<p>I'm thinking to patch res_pjsip_outbound_registration to add this
feature.</p>
<p>Am I wrong and there is another way ?<br>
<span style="color: rgb(36, 41, 46); font-size: 12px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"></span></p>
<p><span style="color: rgb(36, 41, 46); font-size: 12px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">
</span></p>
<p>It's also a security hole, as anybody can generate INVITE with
";line=random" from any IP address !</p>
<p>res_pjsip_outbound_registration will only match "line", but will
not take care about source IP, ...<br>
</p>
<p><br>
</p>
<p>Is there any more clear way to identify incoming INVITE/OPTIONS
packets ?</p>
<p>Not very familliar with SIP, not sure, how should it be done.<br>
</p>
<p><span style="color: rgb(36, 41, 46); font-size: 12px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"></span></p>
<blockquote type="cite"
cite="mid:c4c4ecb0-9c1f-4d31-8859-c716b15d1bf8@www.fastmail.com">
<pre class="moz-quote-pre" wrap="">
</pre>
</blockquote>
</body>
</html>