電訊茶室's Archiver

ckleea 發表於 2013-12-7 21:50

【Raspberry Pi】—— 自家製 VOIP Asterisk Raspberry Pi Image 2015/01/17 更新

[i=s] 本帖最後由 ckleea 於 2015-1-17 09:29 編輯 [/i]

[b][size=4]2014年5月20日更新[/size][/b]

請參考主帖  [url]http://www.telecom-cafe.com/forum/viewthread.php?tid=6058&extra=page%3D1[/url]

這是我自己在 Raspberry Pi compiled 的  Asterisk,此版本目的是讓各供 Telecom-Cafe VOIP 網友可以利用手上的 Raspberry Pi 建立一個輕便簡單易用的 VOIP PBX,配合已有的 USB 3G 手指,輕鬆上網通話和發放 SMS。

同時附上以下VOIP - PBX 功能
1. 最新版 Asterisk 11.X (SVN version),沒有G729 codec ,其他功能已 compiled.
2. 配合 Asterisk GUI 輕鬆設定
3. 內建 Dongle 供 USB 3G 手指發放 SMS,如手指是 Voice activated/enabled,更可收發電話
4. [s]已內置 SIP Trunk settings for HKBN 2B, NWT, ComNet, SPA3000 ATA (via HTTP Digest)[/s]
5. Fax (已設置IAXModem + Hylafax),設定未完成
6. Web based SMS client 供發放英文 SMS
7. Mail tools to send SMS 去指定電郵地址,可使用 Google Mail SMTP 或網友 ISP 提供 Mail server

其他server功能
1. VPN supported by Softether - SSTP, IPSec, OpenVPN [color=Red](已啟動)[/color]
2. VNC server [color=Red](已啟動)[/color]
3. Samba client and server
4. Webmin 系統管理 [color=Red](已啟動)[/color]
5. Printing support
6. PPTP server [color=Red](已啟動)[/color]
7. Backup and email important configuration files [color=Red](已啟動)[/color]
8. xRDP for remote desktop [color=Red](已啟動)[/color]
9. 加入 Watchdog

硬件:
1. Raspberry Pi with at least 8GB SD Card
2. [color=Red]充足電力 Power Supply - 最好使用帶電 USB 2.0 Hub[/color]
建議使用呢款 USB 3.0 Hub ([url]http://www.connectland.com.hk/main/product/html/product_detail.php?id=966[/url]),完全解決電力不足 reboot 的情況。

[attach]3000[/attach]


3. 支援  USB 3G 手指,例如華為 E180 (可參考支援型號: [url]http://wiki.e1550.mobi/doku.php?id=requirements#list_of_supported_models[/url])
[b][color=Orange]另外要留意手指是否 Voice enable[/color][/b]

[b][color=SeaGreen]下面網頁有 Raspberry Pi 支援硬件
[url]http://elinux.org/RPi_VerifiedPeripherals[/url][/color][/b]


軟件:
1. Debian Wheezy
2. Asterisk 11 (latest SVN version)
3. chan_dongle driver
4. Softether VPN server
5. webmin
6. fail2ban [color=Red](可以自行啟動)[/color]
7. minisipserver 已安裝配,有GUI 的 SIP server [color=Red](可以自行啟動)[/color]
8. ddclient for dynamic host  [color=Red](可以自行啟動)[/color]
9. Avantfax Fax Web based frontend

ToDo List:
[s]1. OpenVPN[/s]
[s]2. Fax Web based frontend[/s]
3. Iptables


感謝:角色、雯雯、Bubblestar 協助

ckleea 發表於 2013-12-7 21:50

[i=s] 本帖最後由 ckleea 於 2013-12-14 19:56 編輯 [/i]

我的硬件

[attach]3049[/attach]

Samples Screenshots

1. Telecom-Cafe (Digium) Asterisk GUI
[attach]3023[/attach]

2. SMS Gateway
[attach]2999[/attach]

3. Webmin Interface
[attach]3024[/attach]

4. VNC server
[attach]3028[/attach]
[attach]3029[/attach]
[attach]3030[/attach]

ckleea 發表於 2013-12-7 21:50

[i=s] 本帖最後由 ckleea 於 2015-1-17 09:15 編輯 [/i]

[align=center][color=Red][size=5][b]下載及基本安裝程序:[/b][/size][/color] [color=Blue][b](下載Image 會不斷更新)[/b][/color][/align]

1. 下載 RASPASTDON-V1.8-201500117.zip from [url]https://drive.google.com/file/d/0B9oltMKtfpe3emZxdkJ5dnRpV3M/view?usp=sharing[/url]

2. 下載 Win32 Disk Imager from [url]http://sourceforge.net/projects/win32diskimager/[/url]
3. 使用 Win32 Disk Imager 將下載的zip 檔放出的 RASPASTDON-V1.8-201500117.img, 寫入一張最小有 8GB SD Card
4. 用剛剛準備好 SD Card 起動 Raspberry Pi;如果用 HMDI 出 Mon 或 電視,可以看到Raspberry Pi系統起動的資訊
5. 正常的話,Raspberry Pi系統應該可以從 Router DHCP 取得網內 IP
6. 用 putty 登入 raspberrypi, root password is raspberrypi
[b][size=4][color=SeaGreen]基本上系統內所有 password 均預設為 raspberrypi[/color][/size][/b]

[color=Red]更改 root password[/color][/size][/color]
1. 用 putty 進入系統 as root
2. passwd 更改 your root password

[color=RoyalBlue][b]主要軟件工具:[/b][/color]
1. Putty - [url]http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html[/url]
2. WinSCP - [url]http://winscp.net/eng/download.php[/url]
3. VOIP - Soft client - [url]http://www.zoiper.com/en/voip-softphone/download/zoiper3[/url]
4. Windows VNC Clients - [url]http://portableapps.com/node/11285[/url]  & [url]http://portableapps.com/node/2031[/url]

ckleea 發表於 2013-12-7 21:50

[i=s] 本帖最後由 ckleea 於 2013-12-13 06:49 編輯 [/i]

[align=center][b][color=Red][size=5]更改網絡設定[/size][/color][/b][/align]

注意:同一 USB 3G 手指,不能同時使用 為 internet 上網和 Asterisk dongle
[color=Red]設定DHCP versus static IP[/color]
1. 用 putty 進入系統 as root
2. 更改 /etc/network/interfaces
[attach]3002[/attach]
3. 改為
[attach]3003[/attach]
例如 網友的網絡設定為
<ip-address> = 192.168.1.10
<netmask address> = 255.255.255.0
<gateway address> = 192.168.1.1

[attach]3004[/attach]
4. 儲存檔案,然後
/etc/init.d/networking reload
or
reboot

參考網頁:[url]http://elinux.org/RPi_Setting_up_a_static_IP_in_Debian[/url]

[color=Red][b]設定USB 3G 手指上網[/b][/color]
1. 已裝置 sakis3g 程式
2. 輸入 /usr/bin/sakis3g --interactive
[attach]3026[/attach]
3. 成功上網
[attach]3027[/attach]

ckleea 發表於 2013-12-7 21:51

[i=s] 本帖最後由 ckleea 於 2013-12-11 07:02 編輯 [/i]

[size=5][b][color=Red]設定VOIP - Asterisk 和 Dongle [/color][/b][/size]
注意:已內置ComNet Phone, NWT, HKBN 2b和 SAP3000/3102 SIP Trunks的基本設定, 但需要自行加入VOIP Provider (ComNet Phone, NWT, HKBN 2b) 的username 和 password

1. 登入 asterisk gui via http://yourip:8088/
2. user name: admin; password: raspberrypi
3. 修改 HKBN; NWT; ComNET; SPA300/3102 trunk 的 資料
4. 更改 ext 6000/ 6001 password
5. 記住按 Apply change
6. 用自己喜歡的 Windows or 手機的 SIP client 登入

[color=Red]手動修改 dongle.conf 及 dongle_extensions.conf[/color]
1. 打開/etc/asterisk/dongle.conf
[attach]3007[/attach]
2. 更改 SIM Card 電信號碼如cursor 位置
[attach]3008[/attach]
3. 打開/etc/asterisk/dongle_extensions.conf
更改 SIM Card 電信號碼及電郵地址
[attach]3009[/attach]

[b][color=Red]
更改 SMTP server address 供電郵 sms[/color][/b]
1. 用 putty 登入 Raspberry Pi
2. cd /etc/ssmtp
3. 更改 ssmtp.conf
[attach]3005[/attach]
跟據gmail user name 設定 修改
[attach]3006[/attach]

ckleea 發表於 2013-12-7 21:51

[i=s] 本帖最後由 ckleea 於 2013-12-13 06:59 編輯 [/i]

[size=4][b][color=Orange]設定 miniSipServer[/color][/b][/size]

[url]http://www.myvoipapp.com/[/url]
這是一個簡單易用 VOIP PBX (用GUI 設定),asterisk外另一選擇。

1. 用你的瀏覽器指向 http://yourip:8080/
2. password:raspberrypi
3. 設定 ipaddress, sip port, extension(s), trunk(s), etc

[attach]3025[/attach]

ckleea 發表於 2013-12-7 21:51

[i=s] 本帖最後由 ckleea 於 2013-12-11 22:09 編輯 [/i]

[size=5][b][color=Red]設定你的VPN Server[/color][/b][/size]

1. Image 已內置 Softether VPN 和 PPPD,在開機時已自動起動
2. Use Softether VPN Server Manager 設定 SSTP, IPSec 和 OpenVPN
登入 Softether VPN Server
[attach]3010[/attach]

- 雙擊 Manage Virtual Hub "Default"

[attach]3011[/attach]

- 雙擊 Manage Users

[attach]3012[/attach]

- 加入 User name 和 password

[attach]3013[/attach]

- 揀選 enable Open VPN 和 enable MS STP

[attach]3014[/attach]

-  揀選  enable VON Azure 功能

[attach]3016[/attach]
- 最重要是更改 Dynamic Host name

[attach]3017[/attach]

[b][color=Blue]3. PPTP VPN 設定[/color][/b]
- 已設定基本 PPTPD
- 請修改以下部份
- in /etc/ppptd.conf, 更改 localip
[attach]3019[/attach]

- in /etc/ppp/pptpd.options, 更改 ms-dns
[attach]3020[/attach]

- in /etc/ppp/chap-secrets, 加入 user 和 password
[attach]3021[/attach]

- 在 command line, 輸入 service pptpd restart
- 在 windows 加入 ppp connection 設定

參考: [url]http://blog.wellsb.com/post/29412820494/raspberry-pi-vpn-server[/url]

ckleea 發表於 2013-12-7 21:51

[i=s] 本帖最後由 ckleea 於 2013-12-14 19:35 編輯 [/i]

[b][color=Red]VNC 使用[/color][/b]
1. 使用你喜愛的 Windows vncclient 登入 Raspberry Pi VNC server;網絡地址為 yourip:0
2. password: raspberrypi

[b][color=Red]RDP 使用[/color][/b]
1. 利用Windows Remote Desktop Connection 登入 Raspberry Pi xRDP server
2. 網絡地址為yourip

[b][color=Red]Webmin 使用[/color][/b]
1. 使用你喜愛的 browser 登入 raspberry Pi webmin 管理系統;網絡地址為 https://yourip:10000/
2. username: root; password: raspberrypi

[b][color=Red]Backup script[/color][/b]
1. 已內置 a bash script 自動備份 /etc 內所有 config files
2. 備份於每星期日零晨1時
2. 備份檔案位置 - /opt/backup

[b][color=Red]Raspberry Pi 系統 Image 備份[/color][/b]
1. 最簡單是 poweroff 後,將全張 SD Card 用 Wind32 DiskImager 備份
(參考:
[url]http://lifehacker.com/how-to-clone-your-raspberry-pi-sd-card-for-super-easy-r-1261113524[/url]
[url]http://rpi.tnet.com/project/faqs/backups/backingup[/url]
)
2. 但備份檔案最小 2.9 GB (zip)
3. 另一問題是 reboot 後, softether vpn dynamic host 有機會用不到
4. 其他方法
參考: [url]http://jonathangiles.net/blog/?p=1554[/url]

ckleea 發表於 2013-12-7 21:52

留用 ###8

ckleea 發表於 2013-12-7 21:52

留用 ###9

bubblestar 發表於 2013-12-8 21:17

Is it feasible to install OBiApp in this tiny device?

ckleea 發表於 2013-12-8 21:42

[i=s] 本帖最後由 ckleea 於 2013-12-9 21:36 編輯 [/i]

[b]回復 [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=36394&ptid=6043]11#[/url] [i]bubblestar[/i] [/b]

應該唔得,因為冇x86 instruction set,但請看看這帖子

[url]http://www.raspberrypi.org/phpBB3/viewtopic.php?t=12727[/url]

希望有機會做到!

角色 發表於 2013-12-8 22:07

是否有一个version number control 那么大家知道现在自己用哪个版本?

可以的话,那么member可以在某个version上再加东西,然后楼主可以根据step再把Official version升级。

ckleea 發表於 2013-12-9 03:00

[i=s] 本帖最後由 ckleea 於 2013-12-9 21:35 編輯 [/i]

[b]回復 [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=36396&ptid=6043]13#[/url] [i]角色[/i] [/b]

暫時會用 date stamp標示不同版本。

還在想怎樣協助網友不用更新全套image ,因為現在仍未知怎樣才可以提供patches or updates。而且整套 images 更新需要網友自己先行backup 和轉移設定,所以有機會做漏。

orangelau 發表於 2013-12-10 00:53

太好了, 等我試試

角色 發表於 2013-12-10 23:55

[i=s] 本帖最後由 角色 於 2013-12-11 00:04 編輯 [/i]

好想没有ComNet Phone。

如果ComNet Phone出现No Authentication,等我有空写一个script,然后通过cron job自动运行sip reload。

角色 發表於 2013-12-11 00:02

还有Asterisk的SVN怎样check out,然后complile和安装呢?

角色 發表於 2013-12-11 00:05

Windows的VNC Client呢?

wochinaren123 發表於 2013-12-11 01:26

**** 作者被禁止或刪除 內容自動屏蔽 ****

ckleea 發表於 2013-12-11 06:36

[b]回復 [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=36415&ptid=6043]17#[/url] [i]角色[/i] [/b]

請看我在 /usr/scr/asterisk 內的 install 和 update scripts

ckleea 發表於 2013-12-11 06:41

[b]回復 [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=36419&ptid=6043]18#[/url] [i]角色[/i] [/b]

有不同Windows VNC 選擇,如 vncviewer, ultraVNCviewer ,tightVNC, 個人喜好最重要。

我選 portable 版本

[url]http://portableapps.com/node/11285[/url]

[url]http://portableapps.com/node/2031[/url]

ckleea 發表於 2013-12-11 06:47

[quote]好想没有ComNet Phone。

如果ComNet Phone出现No Authentication,等我有空写一个script,然后通过cron jo ...
[size=2][color=#999999]角色 發表於 2013-12-10 23:55[/color] [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=36413&ptid=6043][img]http://www.telecom-cafe.com/forum/images/common/back.gif[/img][/url][/size][/quote]

對 ,版本是洗沒有實際的 sip trunk,需要網友自己加入自己的 ComNet Phone, NWT, HKBN 2B 或 SPA 3000/3102 資料。

角色 發表於 2013-12-11 13:28

[b]回復 [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=36427&ptid=6043]22#[/url] [i]ckleea[/i] [/b]

其实已经有一个非常好开始,这可以让非常多的人“快速”入门。

bubblestar 發表於 2013-12-11 22:19

基本的運行是沒有問題的,我把舊的Asterisk 設定蓋在上面而能馬上運作的了。

sSMTP,fail2ban 都已裝好,現在我尚欠3G dongle SMS 及 3G 上網未作測試,而WiFi 上網是沒有問題的。

角色 發表於 2013-12-11 22:43

[b]回復 [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=36429&ptid=6043]24#[/url] [i]bubblestar[/i] [/b]

WiFi你怎样连接呢?

ckleea 發表於 2013-12-12 11:04

[b]回復 [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=36430&ptid=6043]25#[/url] [i]角色[/i] [/b]

設定應該不太難
但要
1. 參考及配置合適的 USB Wifi dongle [url]http://elinux.org/RPi_USB_Wi-Fi_Adapters[/url]
2. 想設定為 wireless lan adaptor to access 網絡,或
3. 設定為 hotspot

相信每種功能都想要。

希望遲少少找到隻USB Wifi dongle試試,然後 post 出設定

bubblestar 發表於 2013-12-12 11:20

[b]回復 [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=36430&ptid=6043]25#[/url] [i]角色[/i] [/b]


   
我是用這個設備:

TP-LINK TL-WN823N 300Mbps Mini Wireless N USB Adapter

[url]http://www.tp-link.com/en/products/details/?model=TL-WN823N#spec[/url]

[attach]3022[/attach]

我選它是因為隻WiFi Dongle 不需特別去裝driver,RaspberryPI 已可以認到,減少麻煩,其次,我也看中它是因為它提供了

•300Mbps wireless speed 就算減半, 理論上也有 150Mbps 啩 :L
•SoftAP Mode – Turn a wired internet connection to a PC or Laptop into a Wi-Fi hotspot 在 RasperryPI 未試此功能,但可塑性高
•Easily setup a secure wireless connection with one-touch WPS button 未試,但在Windows 使用時,也會增添方便。

此品牌旗下還有其它更細小的Dongle 都可以使用的,只是賣70-80港元左右,算抵玩,但它們都多數只提供150Mbps,以現時及未來使用上計,我才選上WN823N,也不算太大隻,售價大概110-130之間罷了。大陸買應可以平很多,但我不想麻煩,大費周章,所以.......

入正題,WiFi 設定:

1. 插入Wifi Dongle,使用ifconfig,掃瞄附近的 AP,看看wlan0有沒有被認來[code]sudo iwlist wlan0 scan 或這
sudo iwlist wlan0 scan | grep SSID[/code]如果有掃瞄到,代表有正確的驅動起來,

2. 現在連上無線AP,Edit interfaces
   sudo nano /etc/network/interfaces ,然後加入以下設定[code]auto lo
iface lo inet loopback
#如果eth0 如果搵唔到, 可以試著把它打開
auto eth0
iface eth0 inet dhcp
#自動開啟wlan0
auto wlan0
allow-hotplug wlan0
#使用dhcp配置
iface wlan0 inet dhcp
#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#iface default inet dhcp
# wpa 檔案放在這裡
wpa-conf /etc/wpa.conf[/code]3. 新增一個 wpa.conf 檔
     sudo nano /etc/wpa.conf,鍵入以下內容,SSID = 改成自己的SSID, PSK 改成自己的密碼。[code]network={
  ssid="MyAP"
  proto=RSN
  key_mgmt=WPA-PSK
  pairwise=CCMP TKIP
  group=CCMP TKIP
  psk="12345678"
}[/code]不過,這個PSK是明碼,不太安全,所以可以使用 wpa_passphrase 把密碼加密一下。

在command line 輸入格或是 wpa_passphrase <ssid> [passphrase]

例如:[code]wpa_passphrase MyAP 12345678[/code][code]network={
  ssid="MyAp"
    #psk="12345678"
    psk=b2449175398db27f75a0790f780cdacd0cbf8529e9e29fa051bdf3248f1fd595
}[/code]再把它產生出來的 psk 這段code 貼入wpa.conf中就可以啦,當一切完成後, 重新reboot應該就可以使用了。

bubblestar 發表於 2013-12-12 11:30

第二版本的image 修改/增加或 fix-bug 了什麼功能,可否簡單地概述一下。:D  THANKS!

ckleea 發表於 2013-12-12 13:47

發展有部份scripts 有問題,所以未夠一日就放出另一 Image。

但已試了pptp VPN;和backup scripts,可以將wifi 部份加上去先。

另外,已內置了USB 3G 手指 Dial up 上網功能。

ckleea 發表於 2013-12-12 13:50

有空的話,會 clean up asterisk config scripts,因為太多不必要的 sample codes

頁: [1] 2 3 4 5 6 7 8 9 10

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.