I have worked on SIP trunking for long time and each time used registration method for Asterisk servers to talk with each other.
Syntax in sip.conf: register => ....
The problem with this is Asterisk Servers send registration requests to each other periodically adding more SIP signalling overhead. So, I thought why not establish the trunk between Asterisk Servers that doesn't require the Servers Registration.
B makes call to A using AsteriskServerA_Trunk
AsteriskServerB ---> [AsteriskServerA_Trunk] ---> AsteriskServerA
A makes call to B using AsteriskServerB_Trunk
AsteriskServerA ---> [AsteriskServerB_Trunk] ---> AsteriskServerB
AsteriskServerA:
/etc/asterisk/sip.conf
[AsteriskServerB_Trunk]
type=peer
fromdomain = [AsteriskServerA IP Add]
host = [AsteriskServerB IP Add]
outboundproxy = [AsteriskServerB IP Add]
context = Internal
[11111]
type=friend
host=dynamic
username=11111
mailbox=11111
AsteriskServerB:
/etc/asterisk/sip.conf
[AsteriskServerA_Trunk]
type=peer
fromdomain = [AsteriskServerB IP Add]
host = [AsteriskServerA IP Add]
outboundproxy = [AsteriskServerA IP Add]
context = Internal
[22222]
type=friend
host=dynamic
username=22222
mailbox=22222
Dialplan in ServerA:
extensions.conf
[Internal]
exten => 22222,1,Verbose(1,-----Check the trunk )
same => n,Dial(SIP/AsteriskServerB_Trunk/22222)
exten => 11111,1,Verbose(1,----Dialing local number)
same => n, Dial(SIP/11111)
Dialplan in ServerB
extensions.conf
[Internal]
exten => 11111,1,Verbose(1,-----Check the trunk )
same => n,Dial(SIP/AsteriskServerA_Trunk/11111)
exten => 22222,1,Verbose(1,----Dialing local number)
same => n, Dial(SIP/22222)
Now you can use free SIP based SoftPhones like X-lite, Zoiper and register extension 11111 with Server A and extension 22222 with Server B. Then make a test call from 11111 to 22222 and vice-versa. It should work.
If you need any assistance, you can email me at erdevendra@gmail.com