Connect 2 Asterisk Servers SIP accounts

Hello community,

I would like to ask you if i can connect two different Asterisk servers in the same local network while you use SIP accounts.

Because i ve found some tutorials and i got confused, my questions is, do i have to configure iax.conf and extensions.conf file and leave the sip and pjsip files as they are ?

And could you please enlight me with a helpfull tutorial??

Thanks in advance.

The WIKI has a example of a trunk between peers.

https://wiki.asterisk.org/wiki/display/AST/PJSIP+Configuration+Wizard

https://wiki.asterisk.org/wiki/display/AST/res_pjsip+Configuration+Examples

Hello johnkiniston,

Thank you so much for your reply.

I have tried some configurations, but it didnt work.

I opened a new topic explaning everything.

I would be gratefull if you could help me somehow.

Thanks in advance.

Hello johnkiniston,

I would like to ask you something.

I have SIP accounts and 2 servers.

I want to connect the two servers

So i attached one user to 1st server and 2nd user to the second server.

Do i have to configure iax.conf file to make it work, or the configurations will be only in sip.conf file?

Thanks in advance.

You do not need to modify iax.conf to connect two servers using SIP.

I linked above to the WIKI where there is a configuration example

https://wiki.asterisk.org/wiki/display/AST/res_pjsip+Configuration+Examples

Hello johnkiniston,

Thank you for your reply.

I found here also a example for sip trunk.

https://wiki.asterisk.org/wiki/display/AST/Migrating+from+chan_sip+to+res_pjsip#Migratingfromchan_siptores_pjsip-Disablingres_pjsipandchan_pjsip

It has less configurations.

But i want to ask you something because iam so confused.

Lets say we follow this one :

[general]
udpbindaddr=0.0.0.0
register => myaccountname:1234567890@203.0.113.1 :5060

[mytrunk]
type=friend
secret=1234567890
username=myaccountname
host=203.0.113.1
disallow=all
allow=ulaw
context=from-external

I have 2 servers and 2 users. One is attached to the 1st and the other to the 2nd.

Can you please explain the logic of the trunks and the configuration, because iam completely lost who is registering where and how.

Thanks in advance.

I don’t recommend you use registration, just create a static definition.

Let’s assume you have a Asterisk 1.8 PBX at the IP 10.0.0.25 called ‘Kilroy’

Let’s assume your modern asterisk PBX is at the IP of 10.10.10.100 and it’s called ‘Bozo’

To define a trunk on Bozo to send and receive calls from Kilroy you would edit your pjsip.conf and create an aor, endpoint, and an identify section.

[kilroy]
type=aor
contact=sip:10.0.0.25:5060

[kilroy]
type=endpoint
context=from-kilroy
disallow=all
allow=ulaw
aors=kilroy

[kilroy]
type=identify
endpoint=kilroy
match=10.0.0.25

On Bozo you can dial extension 100 at Kilroy PBX by dialing PJSIP/100@kilroy

When calls arrive at Bozo from Kilroy they will be matched by the identify section to the endpoint and will arrive at the context ‘from-kilroy’

On Kilroy to create you trunk to Bozo you would modify sip.conf and add a peer.

[Bozo]
type=peer
host=10.10.10.100
context=from-bozo
disallow=all
allow=ulaw

To dial extension 200 at Bozo from Kilroy you would dial SIP/200@Bozo

When calls arrive at Kilroy from Bozo they will be matched by the IP address and will arrive at the context ‘from-bozo’

1 Like

Hello johnkiniston,

I did it the way you said but with the sip configurations.

Finally i found out how it works, the logic behind the trunks.

Really appreciate the fact that you spent time explaining to me.

Really thank you.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.