Board logo

標題: 【角色茶桌】—— Multiple Asterisk Servers Behind A Router [打印本頁]

作者: 角色    時間: 2011-9-29 09:06     標題: 【角色茶桌】—— Multiple Asterisk Servers Behind A Router

本帖最後由 角色 於 2011-9-29 09:54 編輯

如果单一Asterisk,坊间已经有很多examples怎样set,但是多了,真的不知道是否set得正确,所以特意开这幅帖子,集中讨论,然后我把大家的心得多好好的整理,那么大家以后起多余一个Asterisk Servers时就有一个非常重要的根据地了。

角色
作者: 角色    時間: 2011-9-29 09:06

本帖最後由 角色 於 2011-9-29 11:42 編輯

Multiple Asterisk Servers Configuration 1.gif
2011-9-29 10:39


上面只是一个说明,除了第一个Asterisk Server A是标准的settings,其他都是没有经过详细核实。

圖片附件: Multiple Asterisk Servers Configuration 1.gif (2011-9-29 10:39, 7.03 KB) / 下載次數 40
http://www.telecom-cafe.com/forum/attachment.php?aid=932&k=09c37bddc9097aecf0d6b12a23884995&t=1596867043&sid=w8ipi9


作者: 角色    時間: 2011-9-29 09:06

本帖最後由 角色 於 2011-10-5 07:25 編輯

问题: 用5228 TCP Port注册不成功? 答案
问题: 用SPA IP Phone注册可以(例如ext 2001),但是在Asterisk Server看到ext 2001 unreachable 答案
作者: alang    時間: 2011-9-29 09:52

對於一般 Router 而言,這樣的架構必須每一個 Asterisk 都有獨立的 public IP,然後將 Asterisk 會用到 SIP & RTP port 互相分開,如此應該也是可行。
作者: 角色    時間: 2011-9-29 09:56

谢谢alang兄的意见,我补充一下,SIP和RTP port是UDP port,而不是TCP port。

角色
作者: ckleea    時間: 2011-10-1 10:24

回復 4# alang

如果用commercial router, 有獨立public IP 的話,基本上唔需要改SIP and RTP ports
作者: 角色    時間: 2011-10-1 11:27

我知道大家会有不同的Asterisk severs在router后面,那么你事怎样处理呢?

角色
作者: ckleea    時間: 2011-10-1 12:56

本帖最後由 ckleea 於 2011-10-1 13:37 編輯

Let me check my router and get back. There is a way to do direct Public ip binding to internal ip. Now I am working in different way.
作者: ckleea    時間: 2011-10-1 13:37

Here is my router WAN mode

WAN Mode
The WAN mode page allows you to configure how your router should use your external Internet connections, for example your WAN1 and WAN2 port connections.
NAT is a technique which allows several computers on a LAN to share an Internet connection. The computers on the LAN use a "private" IP address range while the WAN port on the router is configured with a single "public" IP address.
Along with connection sharing, NAT also hides internal IP addresses from the computers on the Internet.
NAT (Network Address Translation)
Select NAT if your ISP has assigned only one IP address to you. The computers that connect through the router will need to be assigned IP addresses from a private subnet (example: 192.168.1.0). If your ISP has assigned an IP address for each of the computers that you use, select Classic Routing.
Note: The router will delete all inbound firewall rules when switching between NAT and Classic Routing.

Load Balancing Settings
These options allow you to configure the router to balance internet traffic across all of the configured WAN ports, or to use a redundant ISP link for backup purposes.
Select Load Balancing mode to distribute your internet load among configured ISP's simultaneously. The active WAN interfaces (at least 2) will carry data for the protocols that are bound to them. Protocol bindings can be specified in the Protocol Bindings menu. For example, if the HTTP protocol is bound to WAN1 and FTP protocol is bound to WAN3, then the router will automatically channel FTP data from and to the computers on the LAN through the WAN3 port. All HTTP traffic will be routed through the WAN1 port. This feature can be used to segregate traffic between links that are not of the same speed. High volume traffic can be routed through a port connected to a high speed link and low volume traffic can be routed through a different port connected to the slow link. When the router is configured in Load Balancing Mode, it checks the connection of both the links at regular intervals to detect its status. If WAN is configured for Idle Timeout, then Load Balancing Mode is not applicable.
This device supports Weighted Load Balancing (LB), where balance weights are calculated based on WAN link speed and available WAN bandwidth. This is the default and most efficient balancing algorithm. With Round-robin load balancing, new traffic connections are sent over a WAN link in a serial method irrespective of bandwidth or link speed. For example if WAN1, WAN2, and WAN3 are active in round-robin load balancing, a HTTP request will first be sent over WAN1, and then a new FTP session will start on WAN2, and then any new connection to the internet will be made on WAN3. This method ensure that any one WAN will not have a disproportionate distribution of sessions over that single link.
Primary WAN mode should be used when load balancing is not required, and all internet traffic should be sent over the selected primary WAN (choose between WAN1 to WAN4). Enable Auto Rollover to use a single WAN for all internet connectivity until a failure on that link is detected. Once a failure on the primary WAN link is detected, all active connections to the internet will be rolled over to the selected secondary WAN port.
Note: If Auto Rollover mode is selected, you must configure the primary WAN port's Failure Detection Method, located in the WAN Advanced Options page.
Note: IPsec VPN policies will be rolled over in both Load balancing and failover mode.
作者: 角色    時間: 2011-10-1 13:42

Could you please simplify the discussion and let us have a look at your configuration?

YH
作者: ckleea    時間: 2011-10-1 13:48

If you have a commercial router or one that allows direct binding of public IP to internal asterisk server, then you do not need port forward. All default SIP, IAX, RTP ports can be used for the asterisk.

However, if you can use only NAT mode, then multiple asterisk servers can only be accessible by having different SIP, IAX, RTP ports for each server. Adjustment of the settings are required to ensure the servers are accessible and functional.
作者: 角色    時間: 2011-10-1 21:23

Last time I had problem in connecting with my Intel ATOM-based Asterisk server. I do not know whether the problem came from the setting for type, which I mistyped as typp. I will check it on Monday morning to see any improvement if I changed it to type.

Anyway, whatever configurations are appreciated.

YH
作者: alang    時間: 2011-10-3 12:01

是我搞混了,有多個 public IP 就不需要分開 port。
作者: ckleea    時間: 2011-10-3 12:48

Not your fault. Sometimes, we also mix up the wan mode and number of IPs we have.
BTW, did you implement cdr-stats in your system? I saw the information in your website
作者: 角色    時間: 2011-10-5 00:14

原来multiple servers真的点难度,因为以前没有用过Asterisk 1.8,而1.8与1.4是有分别。

真的慢慢做才能成功。

今晚辛苦了bubblestar兄的指导,成功在望。


角色
作者: ckleea    時間: 2011-10-5 07:07

How many servers you have now?
作者: 角色    時間: 2011-10-5 07:14

问题: 用SPA IP Phone注册可以(例如ext 2001),但是在Asterisk Server看到ext 2001 unreachable

解答:
1) 我的第二台Asterisk server B全用default port 5060,而我利用我的router,做port redirection,从5228 UDP Port转到5060 UDP Port of Asterisk server B IP,于是我可以注册到。

2)但是这个“转动”改动是单向,而不是双向, 所以Asterisk server B能注册,在Asterisk server B想发出UDP packets to IP Phone时,因为router不会把Asterisk server B IP:5060, 往外面转至WAN (IP) Port:5228。

3)在更改Asterisk server B的bindport=5228,和router,用port forwarding,WAN的5228,转到Asterisk server IP的5228,就可以。这个转向是双向的。

4)更改后SPA IP Phone注册后,就可以reachable。


角色
作者: 角色    時間: 2011-10-5 07:17

问题: 用5228 TCP Port注册不成功?

解答:
因为Asterisk default是用UDP port,从TCP更改到UDP port,变成注册。

角色
作者: 角色    時間: 2011-10-5 07:20

回復 16# ckleea

Now I have two servers running at the same time,one is QNAP TS-119 NAS Asterisk and the other is Intel ATOM-based D515 Asterisk. I may add another one IP-01 later. If I have time, I may add one more for testing purpose.

YH
作者: ckleea    時間: 2011-10-5 07:21

I recall I do not need to make this port change when I have two asterisk servers. But I use two public IP.
作者: 角色    時間: 2011-10-5 07:23

If you do have two public IP addresses, you do not need this port forwarding process.

YH
作者: 角色    時間: 2011-10-5 07:38

问题: Asterisk Server B可以注册到,但是内外互打出问题,两边什么声音都听不到。

答案:
1) 我Asterisk Server A的rtp.conf已经更改为10000-10999, 而Server A,已经更改过。而Server B, router都做了port forwarding,如UDP 5228, 11000-11999,分流到Server B IP address。

2) 查找后,发现在router对应Server A的RTP port forwarding 10000-20000, 没有更新,现在更改为10000-10999 (因为没有时间测试,所以不知道这次更改后,是否通话正常?)

角色
作者: ckleea    時間: 2011-10-5 08:19

It should work for you
作者: 角色    時間: 2011-10-7 07:21

It is confirmed that with the revised settings, both SIP signalling and RTP voice packets work perfectly.

YH
作者: ttmuskie    時間: 2011-10-20 12:53

Registered but no sound, my NAT problem?

1. Router set port Forward 7000-7999 (both TCP and UCP)
2. sip.conf
  1. [general]
  2. bindport=7060
  3. [1234]
  4. nat=yes
  5. ...
  6. ...
複製代碼
3. rtp.conf
  1. rtpstart=7900
  2. rtpend=7999
  3. ...
  4. ...
複製代碼
Is there anything I need to set? Thanks!
作者: 角色    時間: 2011-10-20 13:09

Are you testing the Asterisk within the network segment?

What is the model number of QNAP that you using?

YH
作者: ttmuskie    時間: 2011-10-20 13:57

1. I'm testing it from outside and connect back to my home network
2. I don't have any QNAP and my asterisk is run under ubuntu.

I just figured out my Android SIP client (CSIPSimple) need to enable the stun server in order to hear the sound. Any recommendation for the stun server? Thanks.
作者: bubblestar    時間: 2011-10-20 14:41

It depends.  It is not necessary for me to enable stun in Asterisk and other voip devices behind NAT.  If you need to , you may try this one stun.xten.com




歡迎光臨 電訊茶室 (http://www.telecom-cafe.com/forum/) Powered by Discuz! 7.2