PROBLEM with more than 2 SIP Trunks

I have two clients with Asterisk 1.8.21 (was on 1.8.17) who are experiencing a very debilitating problem:

Initial setup:

  1. They have several accounts with the same SIP provider
  2. Each account corresponds to a direct-dial number
  3. Each number is supposed to go to a SIP telephone thus using the SIP provider as a PBX.

Requirement:
Use more than three telephones internally, have an internal PBX, use Cisco SCCP phones.

Solution:
Install Asterisk; add additional SCCP support, use existing SIP phones together with new Cisco ones;
>>> replace direct SIP connections to SIP provider with SIP trunks <<<

[color=#800000]PROBLEM:[/color]
Having more than two ‘register’ commands in the SIP.conf file trigger
registration timeout messages.
The problem appears very similar to what this bug describes
https://issues.asterisk.org/jira/browse/ASTERISK-14084
However, I was never able to apply the patch - possibly because it is for an earlier version of Asterisk.

I need [at leaset three] registrations to my SIP provider so I can uniquely handle each incoming line accordingly:

[general]
bindport=5060
bindaddr=0.0.0.0
context=default
disallow=all
allow=gsm
allow=ilbc
allow=ulaw
allow=alaw
srvlookup=yes

register => 1111:pass1@sip.provider.net/1111
register => 2222:pass2@sip.provider.net/2222
register => 3333:pass3@sip.provider.net/3333

				
[1111]
type=friend
host=dynamic
defaultip=192.168.1.12
username=1111
secret=pass1
context=default
dtmfmode=rfc2833
nat=no

[2222]
type=friend
host=dynamic
defaultip=192.168.1.12
username=2222
secret=pass2
context=default
dtmfmode=rfc2833
nat=no

[3333]
type=friend
host=dynamic
defaultip=192.168.1.12
username=3333
secret=pass3
context=default
dtmfmode=rfc2833
nat=no


[provider_line1]
type=peer
host=sip.provider.net
username=1111
secret=pass1
context=testA
fromuser=1111
fromdomain=sip.provider.net
nat=no

[provider_line2]
type=peer
host=sip.provider.net
username=2222
secret=pass2
context=testB
fromuser=2222
fromdomain=sip.provider.net
nat=no

[provider_line3]
type=peer
host=sip.provider.net
username=3333
secret=pass3
context=testC
fromuser=3333
fromdomain=sip.provider.net
nat=no

[provider-in]
type=peer
host=sip.provider.net
context=default
insecure=port,invite
nat=no

If all three ‘register’ commands are active Asterisk starts yielding ‘connection timeout’ for each of them !
If I comment out ONE of these - all appears to work just fine!
In either case dial out is OK.

Of course, if any of the register commands is commented the relevant incoming number is no longer reachable from outside.

I have been struggling with this problem for over three months now and there seems some patchy information here and there of people experiencing similar issue, but no solution to the issue at all.

Any help would be much appreciated!

In default of adequate logging, I would ask whether it is actually the ITSP that cannot cope with multiple registers from the same address.

Also you need to remove the in entry and put the three outgoing entries in the default context.

Thank you David55.

Ended up with removing the FQDN provider from the register=> line and describing it separately in its own section (provider) with its IP address rather than FQDN. This seemed to resolve my issue.

Again, it appeared that the problem was with Asterisk and a bug of some sort that could not resolve the SIP provider’s address if there was more than two register commands.

It doesn’t really matter in what context you will place the incoming calls as long as you can handle those adequately.

Here is what is production at the moment:

[code][general]
bindport=5060
bindaddr=0.0.0.0
disallow=all
allow=gsm
allow=ulaw
allow=alaw
srvlookup=yes
nat=no

register => 1111:pass1@provider/1111
register => 2222:pass2@provider/2222
register => 3333:pass3@provider/3333

[line1]
type=peer
host=sip.provider.net
username=1111
secret=pass1
context=company
fromuser=1111
fromdomain=sip.provider.net
nat=no

[line2]
type=peer
host=sip.provider.net
username=2222
secret=pass2
context=company
fromuser=2222
fromdomain=sip.provider.net

[line3]
type=peer
host=sip.provider.net
username=3333
secret=pass3
context=company
fromuser=3333
fromdomain=sip.provider.net

[provider]
type=peer
host=xxx.yyy.zzz.xzy ;IP address here, NOT a FQDN
context=default
insecure=port,invite
nat=no[/code]