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.