UniFi Talk 電話串接第三方 SIP (Third-Party SIP) 使用 iAG800 V2

最近買了 UniFi Talk 的 Phone Touch 想要讓他可以串接市話所以買了 OpenVox 的 iAG800 V2,他們串接其實很簡單不過我還是在中間踩了雷,在這邊把設定方法分享出來。

OpenVox iAG800 V2

iAG800 V2 有分 6 種型號通常應該比較常買 4 FXO 的機器不過我自己是買 2 FXO 與 2 FXS ,4 FXO 的意思代表 4 可以支援 4 條中華電信進線,而 2 FXS 代表可以接兩台普通的類比電話不過我自己試用其實效果沒有很好,因為我還是希望我原本的類比電話可以成為 UniFi Talk 下面的其中一隻電話,所以還是推薦想要購買的直接買 4 FXO 就可以了。

如果有興趣可以看看 IAG800 V2 的文件裡面有滿多設定可以使用的,不過如果你只是要讓它與 UniFi Talk 串接直接看下面就好。

UniFi ATA (Analog Telephone Adapter)

如果原本有在使用傳真機或是希望原本的類比電話可以成為 UniFi Talk 的讀者可以購買 UniFi ATA 它是一個 UniFi 標準解決傳統電話問題的一個解法,不過台灣應該買不到需要現在需要去美國定。

設定 OpenVox

首先第一步把你的外線插上去 OpenVox 然後打開 OpenVox 的介面點選 Analog -> Channel Settings,如果中華外線真的有通會看到第一個 Line Status 那邊會顯示 Connected 代表線路正常。

然後點選第一個 FXO 的 Edit 把 CID signalling 與 CID start signal 都設定成 dtmf,如此 OpenVox 才可以經過電話線讀取到近來電話的號碼。

然後點選 Analog -> Advanced 把 Country 設定成 Taiwan

然後點選 Analog -> Driver 把 impedance 也改成 TAIWAN

並且把 FXO Rx gain 與 FXO Tx gain 設定成 0

然後到左側的 Voip -> SIP Endpoionts 裏面點選上面的 Add

打開後輸入 Name、User Name、Password,而 Registration 的地方選擇 Server,選擇 Server 的意思代表我們把 OpenVox 當成 Server 使用,並且指定了它的帳號密碼以及名稱,這邊建議 Name 與 User Name 可以直接輸入家裡面的市話號碼,比較不會搞錯而我這邊隨便輸入一組。

設定後點選上方的 Call Settings 記得把 Send Remote-Party-ID 設定成 YES,不然電話打進來在 Phone Touch 或是後台只會看到剛剛設定的那組 Name 號碼

如果跟我一樣需要介接其他 SIP Server 可以在新增的時候把 Registration 設定成 client 就可以讓 OpenVox 連線到其他的 SIP Server 當成其他 Endpoints 來使用了

然後點選 Routing -> Call Routing Rules 來設定電話的路由一樣點選上方的 Add

inbound 比較簡單設定一下

  • Routing Name: inbound
  • Call Comes in From: fxo-1
  • Send Call Through: sip

Send Call Through 設定為剛剛設定的 SIP Server 名稱,如果剛剛是設定家裡的電話號碼就會直接出現

outbound 比較複雜這邊需要用到增減碼

  • Routing Name: outbound
  • Call Comes in From: sip
  • Send Call Through: fxo-1

下方的 Callee Dial Pattern 通常只要設定一個就可以了

  • Prepend: 0
  • Prefix: +886

不過我這邊依照新北市的需求做了更多的設定,有需要可以參考使用就不多做解釋

  • 0 +886 800XXXXXX
  • 2 +8862 XXXXXX
  • 2 +8862 XXXXXXX
  • 0 +886 NZXXXXXX
  • 0 +886 NZXXXXXXX
  • 002 +
  • 8 +8868 XXXXXXX

以上設定完成 OpenVox 的設定就結束了

UniFi Talk 設定

接下來設定完 UniFi Talk Phone 後打開 UniFi Talk 點選左邊的設定後選擇 System 然後看到下方的 Third-Party SIP Settings 然後點選 Add Third-Party SIP Provider

Provider Name 取一個自己喜歡的名字,一開始會發現下面都沒有輸入框,所以先選擇 Add Custom Field -> Add Field,輸入 proxy、password、register、username 然後按下 Done,就會發現輸入框跑出來了

出現選項後 proxy 輸入 OpenVox 的 IP 這邊要注意記得後面要加上 :5060 不然會跟我一樣踩坑,可以在 UniFi Community 找到一篇叫做 Incoming voip.ms calls being rejected 的文章下面有提到雖然 5060 是預設的 Port 不過還是需要加上加上就正常了。

再來依序輸入 username 與 password 然後把 register 設定成 true。

Destination Countries 的 Handle All Outgoing Calls By Default 把 Enable 打開

下方的 DID Numbers 輸入剛剛的 username

最下方的 Add IP Address Range 輸入 OpenVox 的 IP 並且設定 /32,這邊我原本沒有設定結果就有點問題。

設定後就可以點選左邊第三個 USERS AND GROUPS 找到要設定號碼的使用者點選 Edit,切換到 Manage -> Manage -> Change Number 然後把剛剛加入的號碼放進去,如此就可以把市話丟給 UniFi Talk Phone 了!

總結

以上就是這次的UniFi Talk 電話串接第三方 SIP 使用 iAG800 V2 教學,在設定上參考很多 Ubiquiti UniFi Official Taiwan User Group 官方社團與 Pctine 大大的文章與 YouTube。有興趣也可以看一下 UniFi Talk Tutorial 03 – 3rd-party SIP Trunk 任意門 說不定有不同的收穫。

Debug 方法

如果在使用上有問題我們可以使用 SSH 進入 UDMP 或是 UDR,進入後輸入 unifi-os shell

$ ssh [email protected]
Welcome to UbiOS

By logging in, accessing, or using the Ubiquiti product, you
acknowledge that you have read and understood the Ubiquiti
License Agreement and agree to be bound by its terms.

[email protected]'s password:
  ___ ___      .__________.__
 |   |   |____ |__\_  ____/__|
 |   |   /    \|  ||  __) |  |   (c) 2010-2022
 |   |  |   |  \  ||  \   |  |   Ubiquiti Inc.
 |______|___|  /__||__/   |__|
            |_/                  http://www.ui.com

      Welcome to UniFi Dream Machine!

********************************* NOTICE **********************************
* By logging in to, accessing, or using any Ubiquiti product, you are     *
* signifying that you have read our Terms of Service (ToS) and End User   *
* License Agreement (EULA), understand their terms, and agree to be       *
* fully bound to them. The use of CLI (Command Line Interface) can        *
* potentially harm Ubiquiti devices and result in lost access to them and *
* their data. By proceeding, you acknowledge that the use of CLI to       *
* modify device(s) outside of their normal operational scope, or in any   *
* manner inconsistent with the ToS or EULA, will permanently and          *
* irrevocably void any applicable warranty.                               *
***************************************************************************

# unifi-os shell
root@ubnt:/# 

再輸入 fs_cli 就可以進入 FreeSWITCH 的 CLI 介面

root@ubnt:/# fs_cli
.=======================================================.
|            _____ ____     ____ _     ___              |
|           |  ___/ ___|   / ___| |   |_ _|             |
|           | |_  \___ \  | |   | |    | |              |
|           |  _|  ___) | | |___| |___ | |              |
|           |_|   |____/   \____|_____|___|             |
|                                                       |
.=======================================================.
| Anthony Minessale II, Ken Rice,                       |
| Michael Jerris, Travis Cross                          |
| FreeSWITCH (http://www.freeswitch.org)                |
| Paypal Donations Appreciated: [email protected]   |
| Brought to you by ClueCon http://www.cluecon.com/     |
.=======================================================.

.=======================================================================================================.
|       _                            _    ____ _             ____                                       |
|      / \   _ __  _ __  _   _  __ _| |  / ___| |_   _  ___ / ___|___  _ __                             |
|     / _ \ | '_ \| '_ \| | | |/ _` | | | |   | | | | |/ _ \ |   / _ \| '_ \                            |
|    / ___ \| | | | | | | |_| | (_| | | | |___| | |_| |  __/ |__| (_) | | | |                           |
|   /_/   \_\_| |_|_| |_|\__,_|\__,_|_|  \____|_|\__,_|\___|\____\___/|_| |_|                           |
|                                                                                                       |
|    ____ _____ ____    ____             __                                                             |
|   |  _ \_   _/ ___|  / ___|___  _ __  / _| ___ _ __ ___ _ __   ___ ___                                |
|   | |_) || || |     | |   / _ \| '_ \| |_ / _ \ '__/ _ \ '_ \ / __/ _ \                               |
|   |  _ < | || |___  | |__| (_) | | | |  _|  __/ | |  __/ | | | (_|  __/                               |
|   |_| \_\|_| \____|  \____\___/|_| |_|_|  \___|_|  \___|_| |_|\___\___|                               |
|                                                                                                       |
|     ____ _             ____                                                                           |
|    / ___| |_   _  ___ / ___|___  _ __         ___ ___  _ __ ___                                       |
|   | |   | | | | |/ _ \ |   / _ \| '_ \       / __/ _ \| '_ ` _ \                                      |
|   | |___| | |_| |  __/ |__| (_) | | | |  _  | (_| (_) | | | | | |                                     |
|    \____|_|\__,_|\___|\____\___/|_| |_| (_)  \___\___/|_| |_| |_|                                     |
|                                                                                                       |
.=======================================================================================================.

Type /help <enter> to see a list of commands

參考資料