how to setup a SIP trunk between 2 local Asterisk servers (same LAN, no NAT, no firewalls)

9 posts / 0 new
Last post
vieri
vieri's picture
how to setup a SIP trunk between 2 local Asterisk servers (same LAN, no NAT, no firewalls)

Hi,

Simple question.
Can anyone please give me a "Hello World" example of setting up a SIP trunk in FreePBX between 2 Asterisk servers on the same network (LAN, no NAT, no firewalls)?

I tried this:

Add SIP trunk:
name: interboxsip
PEER details:
type=friend
insecure=port,invite
host=192.168.250.111
context=mycontext-custom

Did the same on the other server (just replaced host IP address).

sip show users and sip show peers seem ok on both systems.

However, when I place a call via SIP from one server to the other and I enable SIP debugging in Asterisk, the "receiving" end complains about:

SIP/2.0 407 Proxy Authentication Required

(but I never setup authentication for this peer; I want to Keep It Simple for now)

What am I missing?

mudslide567
mudslide567's picture
accept anonymous SIP

accept anonymous SIP connections

blanchae
blanchae's picture
There's two ways of doing

There's two ways of doing it, one using SIP user/peer trunking and the other using SIP friend trunking. In either case, download the excel spreadsheet: SIP trunk configuration tool, fill in the green section that pertains to your network. The spreadsheet will create the proper configuration for both PBXs that you fill in the FreePBX.

Eugene Blanchard

vieri
vieri's picture
Thanks!

Thanks, Eugene, your link proved to be very clear, straightforward and complete. Seems that the only thing I was missing was the "fromuser=" option... Works great now.

vieri
vieri's picture
callerid

Just one more question...
If I place a call through a friend SIP trunk, I'm not receiving a caller id. The sending end is setting it (am also using "intracompany" route). The receiving end has a blank string/number for caller name / number.

[EDIT]: I think my problem is with "fromuser".
fromuser: Specify user to put in "from" instead of $CALLERID(number) (overrides the callerid) when placing calls _to_ peer (another SIP proxy). Valid only for type=peer.
However, if I remove "fromuser" my trunk doesn't work.

blanchae
blanchae's picture
Try the "friends" configuration

You can try the friends SIP trunk, it's just as easy. The main difference is that friends authorizes on the IP address while user/peer authorizes on the user/password. Interesting about the CallerID. I wonder if you could add callerid= into the trunk config.

Eugene Blanchard

vieri
vieri's picture
friends

I actually tried the "friends" type, not the user/peer config.
In any case, "fromuser" is necessary otherwise I get an authorization error. It does not work simply with IP addresses even with "friends".

Someone suggested that it may be because my SIP user names (for authentication) are the same as my extension numbers. I don't know if this may be true but I'll try it out on Monday.

I will also try specifying callerid= into the trunk config.

jobsoftinc
jobsoftinc's picture
this is how you work around this for CID and fromuser=

http://pbxinaflash.com/community/index.php?threads/connected-party-id.8923/

Essentially:

trustrpid
sendrpid

I had run into this very same issue and found the above post. As soon as I added these to my two peers, the CID started coming through as desired. FYI and FWIW!

Mark

amaurer
amaurer's picture
Thanks

Thanks Eugene. I had been struggling with the two frepbx boxes for a long time. I was using IAX2 trunks since I read that they were much simpler to use, but kept getting "All circuits are busy now" message.
With this SIP configuration it went on in a flash and work flaelessly, so far.
Another question. I now have the two boxes in the same LAN, what would you recomend if I need to connect two boxes through Internet ?

Regards

Andres