Wednesday, November 5, 2014

configure trunk between two voip servers using iax2

If you not yet configure voip server,  follow the link  http://theamdara.blogspot.com/2014/11/how-to-setup-voip-server-asterisk.html

1- General information
voip-server1:
ip : 10.0.3.4
user: user2, extention, 6002

voip-server2:
ip: 10.0.3.5
user: ob, extention, 7003

2- configure on voip-server1
  - edit file /etc/asterisk/iax.conf to the following content

[general]
autokill=yes
calltokenoptional = 0.0.0.0/0.0.0.0
maxcallnumbers = 16382
register => server2:pass2@10.0.3.5
authdebug=yes

;account for configure on voip-server2
[server1]
type=friend
host=dynamic
trunk=yes
auth=plaintext
requirecalltoken=no
username=server1
secret=pass1
context=incoming_server2
permit=10.0.3.5/255.255.255.25
;deny=0.0.0.0/0.0.0.0
 

[server2-out]
type=peer
context=iax
auth=md5
;auth=plaintext
requirecalltoken=no
host=10.0.3.5
username=server2
secret=pass2
trunk=yes


  - edit  dialplan extentions by adding the following line to /etc/asterisk/extensions.conf 
[inside-context]
exten=>7003,1,Dial(SIP/ob,20)
include => server2-dialout
[incoming_server2]
include => from-internal
[server2-dialout]
exten=>6002,1,Dial(IAX2/server2-out/${EXTEN},30)



3- configure on voip-server2:

- edit file /etc/asterisk/iax.conf to the following content

[general]
autokill=yes
calltokenoptional = 0.0.0.0/0.0.0.0
maxcallnumbers = 16382
register => server1:pass1@10.0.3.5
authdebug=yes

;account for configure on voip-server1
[server2]
type=friend
host=dynamic
trunk=yes
auth=plaintext
requirecalltoken=no
username=server2
secret=pass2
context=incoming_server1
permit=10.0.3.5/255.255.255.25
;deny=0.0.0.0/0.0.0.0
 

[server1-out]
type=peer
context=iax
auth=md5
;auth=plaintext
requirecalltoken=no
host=10.0.3.4
username=server1
secret=pass1
trunk=yes


  - edit  dialplan extentions by adding the following line to /etc/asterisk/extensions.conf 
[inside-context]
exten=>6002,1,Dial(SIP/user2,20)
include => server1-dialout
[server1-dialout]
exten=>7003,1,Dial(IAX2/server1-out/${EXTEN},30)
[incoming_server1]
include => inside-context


4- testing calling


No comments:

Post a Comment