[asterisk-users] Incoming SIP call, outgoing SIP registration. PJSIP.
Joshua C. Colp
jcolp at digium.com
Mon Apr 22 12:27:01 CDT 2019
On Mon, Apr 22, 2019, at 2:10 PM, Pavel wrote:
<snip>
> Tried already.
>
> "line" is good, but not perfect.
>
> Every time I restart asterisk, it will generate new random string for ";line=".
>
> So, every time I restart asterisk, registrar (Server1) will save one
> more contact in it's database.
>
> Some will remove obsolete contacts, but some will not.
>
> For example, FreePBX will not remove obsolete contacts, if max_contacts
> specified (FreePBX will set rewrite_contact=no in this case).
>
> So, after a number of Asterisk restarts, FreePBX will reject new
> registrations, as max_contacts is reached.
It should specify remove_existing to remove old ones to make room for the new ones. That would be a FreePBX thing, though.
> Unfortunately, "line" does not save random between restarts.
>
> It's also unable to specify "random" value in pjsip.conf.
>
>
> I'm thinking to patch res_pjsip_outbound_registration to add this feature.
>
> Am I wrong and there is another way ?
I don't see any reason why this couldn't be an option.
>
> It's also a security hole, as anybody can generate INVITE with
> ";line=random" from any IP address !
You can use an ACL to limit the endpoint to certain source IP addresses.
>
> res_pjsip_outbound_registration will only match "line", but will not
> take care about source IP, ...
>
>
>
> Is there any more clear way to identify incoming INVITE/OPTIONS packets ?
>
> Not very familliar with SIP, not sure, how should it be done.
There is no real defined mechanism within SIP to do this. Phones employ different mechanisms to differentiate. Some may use a similar mechanism to the line option. Some run multiple SIP transports on different ports for each account so they can differentiate based on where it came in on. Some look at the request URI coming in. Some just don't care.
--
Joshua C. Colp
Digium - A Sangoma Company | Senior Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
Check us out at: www.digium.com & www.asterisk.org
More information about the asterisk-users
mailing list