Calling outside using Asterisk 2 server

Good day!

Need your help guys, i have an asterisk1 and asterisk 2 server. Now, I need to connect the asterisk2 in order me to call outside because asterisk1 don’t have trunkline yet. It is possible?

Thanks :smiley:

My answer will be as verbose and full of details as the question:

Yes, this is possible.

You still haven’t provided any details or even showed that you are trying to make any configuration attempts. If you want that someone does this for you, go to the Jobs forum. If you want us to help you, make a configuration, explain the details and the place where you got stuck, so we can help out, if possible.

I would recommend that you make a SIP (Trunk) connection between the two Asterisk boxes. Once you have the two servers communicating via SIP, it’s just a matter of the dialplan for directing the calls as you want. If you still haven’t found a good place for Asterisk documentations, here it is:

asteriskdocs.org/

There are way too many nuances to deal with but here is something to get you going in the right direction. You basically want to create a SIP “trunk” between the two servers, a dial pattern to route the appropriate calls from Asterisk1 to Asterisk2 that require an outside line. Here is something close to get you going…

on asterisk1

edit sip.conf

; register a sip trunk with asterisk2 replace X.X.X.X with asterisk2 IP
[ASTERISK2]
type=peer
host=X.X.X.X
context=incoming
username=ASTERISK1
secret=myspecialpassword
disallow=all
qualify=yes
insecure=port,invite
deny=0.0.0.0/0.0.0.0
permit=X.X.X.X/255.255.255.255
canreinvite=no

edit extensions.conf

; establish pattern that any 10 digit dials goes out through asterisk2
exten => _NXXNXXXXXX,1,Verbose(2,requires outside line)
exten => _NXXNXXXXXX,n,Dial(SIP/ASTERISK2/${EXTEN})
exten => _NXXNXXXXXX,n,Hangup()

on asterisk2

edit sip.conf

; create other side of sip trunk
[ASTERISK1]
type=peer
host=X.X.X.X
context=default
username=ASTERISK2
secret=myspecialpassword
disallow=all
qualify=yes
insecure=port,invite
deny=0.0.0.0/0.0.0.0
permit=X.X.X.X/255.255.255.255
canreinvite=no

There is absolutely no point in specifying passwords if you use insecure=invite and static addresses. they will not be used. Most people don’t need insecure=port. (Where insecure=invite used to be used, remotesecret tends to be a better choice.)

canreinvite is deprecated.

hangup does nothing useful. The call has already hung up if it succeeded, and will hangup when control runs off the end of the dialplan, otherwise.