PJSIP outbound registrations and the line option

I have asterisk 16.9.0 configured to register a total of 5 phone numbers (SIP accounts) with the same ITSP using the ‘line=yes’ option so that calls coming in from my ITSP get mapped to the correct endpoints. This setup has been working for some time now. Today I restarted asterisk a couple of times and noticed that after the third time the outbound registrations got rejected with a temporary ‘503: too many registered contacts’ message. It seems asterisk regenerates the values it uses for the line parameter and as that is part of the contact, the ITSP server sees it as a new contact when the line paramater changes and refuses to register more than 3 contacts. This problem could be avoided if it would be possible to set a fixed value to use for the line parameter of each registration, but unfortunately that’s not the case.

As an alternative to using the ‘line=yes’ option I started experimenting with an endpoint identifier that uses the ‘match_header’ option to match on the ‘To:’ request header but so far the results don’t seem very promising. Exact string matching did not work at all. Regex matching kind of works now but does not appear to be very reliable as some elements of the supplied header value are not as constant or even predictable as one would like. For example some incoming calls had my number prefixed with a ‘+’ sign, others not and even for the domain part I have at least seen two different values so far.

Are there any other alternatives to reliably map incoming calls to the correct endpoints? Identification by IP address is no viable option as my ITSP probably uses more than a single IP, those addresses could change anytime without notice and also does the IP not help to differentiate multiple registrations with the same ITSP.

Not really, the options you’ve stated are the ones that are available.

Are there circumstances other than a restart of asterisk that will cause asterisk to regenerate the values it uses for the line parameters? Will they get regenerated if I do a ‘core reload’ for example? And will a ‘core reload’ correctly reload pjsip.conf? My past experience was that reloading pjsip.conf was somehow problematic, but I don’t remember the exact details.

It would be quite painful to be at risk getting that 503 response each time I make some configuration changes that require reloading/restarting asterisk (possibly multiple times within a 1-2 hour time frame).

Reloading doesn’t change the value, unless there was a substantial change to the outbound registration (such as directing it elsewhere). I’ve never been aware of any problems caused by PJSIP reloads themselves, only external issues (such as DNS server being done).

Guess for the time being I will try reloading then instead of restarting asterisk. I still wonder why I did not run into this problem sooner. Maybe my ITSP changed something more recently. I could imagine that they just overwrote the old contact with the new one and at some point changed that so that customers may register up to 3 contacts but rejecting any new contacts past that limit. Would be great though to have the option to statically configure a string to use for the line paramerter of each registration so that it never actually changes.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.