RE: Multiple registers with the same SIP provider

Comment on Asterisk SIP user vs peer
GarethP
Joined: Sun 08 of Oct, 2006

RE: Multiple registers with the same SIP provider

Posted:Sun 08 of Oct, 2006 (21:04 UTC)
Hi I have got this working but it did take some figuring out. It appears that when looking for a matching incoming SIP peer that * starts at the bottom of the sip.conf file and works up. Therefore the last one to put in is the incoming calls peer. You can put the other peers for outgoing calls above them and still use them no bother by calling them directly e.g. Dial(SIP/{THEPHONENUMBER}@provider_line1). I'd be interested to hear if this works for anyone else.


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

register => 3377:???????@2x2.2x3.x56.2x6
register => 3378:???????@2x2.2x3.x56.2x6
				
[3377]
type=friend
host=dynamic
defaultip=192.168.1.12
username=3377
secret=3377
context=default
dtmfmode=rfc2833
mailbox=3377
callerid="SPA1" <3377>
nat=no

[3378]
type=friend
host=dynamic
defaultip=192.168.1.12
username=3378
secret=3378
context=default
dtmfmode=rfc2833
mailbox=3378
callerid="SPA2" <3378>
nat=no

[provider_line1]
type=peer
host=2x2.2x3.x56.2x6
username=3377
secret=???????
context=testA
fromuser=3377
fromdomain=2x2.2x3.x56.2x6
nat=no

[provider_line2]
type=peer
host=2x2.2x3.x56.2x6
username=3378
secret=???????
context=testB
fromuser=3378
fromdomain=2x2.2x3.x56.2x6
nat=no

[provider-in]
type=peer
host=2x2.2x3.x56.2x6
context=default
insecure=invite
nat=no



The result is that SIP SHOW PEERS gives me

myserver*CLI> sip show peers
Name/username	Host            	Dyn 	Nat 	ACL 	Port 	Status
provider-in		2x2.2x3.x56.2x6 	              			5060     	Unmonitored
provider_line2/3378   	2x2.2x3.x56.2x6               			5060 	Unmonitored
provider_line1/3377	2x2.2x3.x56.2x6   	            			5060 	Unmonitored
3378/3378		192.168.1.12     	D         			5061 	Unmonitored
3377/3377		192.168.1.12      	D         			5060    	Unmonitored
5 sip peers [5 online , 0 offline]

Where you can see everything is in the reverse order of sip.conf.

I am guessing here that * works down this list and applies the first rule it can...