I use Asterisk for test automation to generate calls.
Asterisk connects to system with multiple extensions(see details in config).
I try to originate a call from A to B where both A and B are registered from my Asterisk setup.
If insecure=invite, port included in sip.conf, I can originate the call, but on the incoming call will be handled by the first channel that has been registered from my Asterisk. E.g.
I have 3 numbers registered, A,B and C. I originate a call from B to C. Incoming call being handled by A.
I have 2 numbers registered, A and B. I originate the call from A to B. Incoming call being handled by A
If I remove insecure=invite,port than I get the following error message
[May 29 17:30:02] WARNING[1707][C-00000034]: chan_sip.c:17292 check_auth: username mismatch, have <ph nr of A leg>, digest has <>
[May 29 17:30:02] NOTICE[1707][C-00000034]: chan_sip.c:26355 handle_request_invite: Failed to authenticate device "418" <sip:418@host.name>;tag=3F53436E-5B0D71FA0000686B-834F4700
The question is, how to config properly asterisk?
See full extensions and sip.conf
[general]
qualify=yes
tcpenable=yes
canreinvite=no
allowguest=no
srvlookup=yes
register => [uname2]@[host.name]:[pwd2]@[host.name]/[phnr2]
register => [uname]@[host.name]:[pwd]@[host.name]/[phnr]
[[phnr2]]
type=peer
context=CT-[phnr2]
callerid=[phnr2]
trustpid=no
sendrpid=no
canreinvite=no
fromdomain=[host.name]
fromuser=[uname2]
username=[uname2]
defaultusername=[uname2]
insecure=invite,port
disallow=all
allow=ulaw, alaw, gsm
host=[host.name]
secret=[pwd2]
nat=no
[[phnr]]
type=peer
context=CT-[phnr]
callerid=[phnr]
trustpid=no
sendrpid=no
canreinvite=no
fromdomain=[host.name]
fromuser=[uname]
username=[uname]
defaultusername=[uname]
insecure=invite,port
disallow=all
allow=ulaw, alaw, gsm
host=[host.name]
secret=[pwd]
nat=no
#################################### Extensions.conf ##################################
[CT-[phnr2]]
exten => [phnr2],1,NoOp('This is an ARI Test')
same => n,Stasis(ST-[phnr2])
same => n,Hangup()
[CT-[phnr]]
exten => [phnr],1,NoOp('This is an ARI test')
same => n,Stasis(ST-[phnr])
same => n,Hangup()