實(shí)現(xiàn)目標(biāo):
FreePBX創(chuàng)建pjsip分機(jī),WebRTC客戶端可以使用pjsip分機(jī)賬號(hào)登陸,同時(shí)實(shí)現(xiàn)WebRTC內(nèi)部分機(jī)語音溝通,對(duì)接網(wǎng)關(guān)后,可以使用WebRTC客戶端與運(yùn)營商號(hào)碼的雙向語音呼叫。
相對(duì)比與asterisk搭建,F(xiàn)reePBX有著可視化頁面,可以方便管理員對(duì)分機(jī)賬號(hào)的創(chuàng)建和管理,同時(shí)和asterisk的管理難度相比,操作難度減低,方便用戶使用WebRTC集成其他企業(yè)業(yè)務(wù)實(shí)現(xiàn)IPPPBX的WebRTC業(yè)務(wù)支持和擴(kuò)展。
測(cè)試環(huán)境:
- FreePBX版本SNG7-FPBX-64bit-1805-2
- WebRTC客戶端sipML5客戶端
- 語音網(wǎng)關(guān):sangoma vega50模擬網(wǎng)關(guān)
- 火狐瀏覽器68.0.1 (64 位)
- SIP軟電話eyeBeam軟電話
配置完整拓?fù)鋱D:

配置步驟:
首先需要到官方下載FreePBX,安裝配置以后,可以通過界面登錄FreePBX系統(tǒng)。然后,再進(jìn)行以下流程配置。其流程包括:創(chuàng)建證書,創(chuàng)建WebRTC分機(jī),創(chuàng)建SIP分機(jī),使用webrtc客戶端登錄WebRTC分機(jī),配置網(wǎng)關(guān),配置FreePBX呼入呼出路由。下面,我們會(huì)通過一步步配置來告訴大家如何實(shí)現(xiàn)WebRTC和網(wǎng)關(guān)呼入呼出的對(duì)接呼叫。
創(chuàng)建證書:
在WebRTC中,需要證書的支持才能支持登陸,在本次測(cè)試環(huán)境中為內(nèi)網(wǎng)環(huán)境,沒有公網(wǎng)證書,所以需要自己在FreePBX中創(chuàng)建證書。供測(cè)試使用,創(chuàng)建證書導(dǎo)航為“管理員>>證書管理”進(jìn)入頁面之后,按下圖所指示進(jìn)入證書創(chuàng)建頁面

創(chuàng)建證書模板為

配置完成后記得在左下角點(diǎn)擊提交,提交之后在右上角更新配置

關(guān)注知識(shí)星球,獲取更多關(guān)于SIP應(yīng)用場景技術(shù)SIP相關(guān)技術(shù)方案
證書的默認(rèn)路徑為“/etc/asterisk/keys/”使用遠(yuǎn)程軟件連接到freepbx后臺(tái)查看你所創(chuàng)建的證書

證書頁面:
在配置http守護(hù)進(jìn)程完成之后,現(xiàn)在我們進(jìn)入證書頁面,驗(yàn)證配置是否成功,在火狐瀏覽器中輸入“https://192.168.1.31:8089/httpstatus”出現(xiàn)該頁面時(shí),配置完成

PJSIP分機(jī)創(chuàng)建:
接下來需要?jiǎng)?chuàng)建PJSIP分機(jī),供sipML5客戶端以及eyeBeam軟電話注冊(cè),進(jìn)行通訊的測(cè)試,最先的就是將sip通道設(shè)置為僅僅pjsip,使用auto模式時(shí),pjsip分機(jī)登陸可能會(huì)走到sip通道,導(dǎo)致登陸失敗,設(shè)置路徑為“設(shè)置>>高級(jí)設(shè)置”找到“撥號(hào)規(guī)則和操作”這一板塊下,修改為下圖中的設(shè)置。

配置完成后,進(jìn)入“設(shè)置>>Asterisk SIP設(shè)置”在通用設(shè)置頁面下,修改一下參數(shù),開啟RTP的功能,同時(shí),在下面的語音編碼中,記得添加好opus模塊

現(xiàn)在修改PJISP設(shè)置,設(shè)置如下

PJSIP分機(jī)創(chuàng)建及屬性修改,在測(cè)試中,需要?jiǎng)?chuàng)建3臺(tái)分機(jī) ,2臺(tái)為sipML5使用的分機(jī),一臺(tái)為eyeBeam軟電話登陸分機(jī)。設(shè)置路徑為“應(yīng)用配置>>分機(jī)”添加PJSIP分機(jī)

設(shè)置為

現(xiàn)在創(chuàng)建一臺(tái)eyebeam軟電話登陸的PJSIP分機(jī)僅僅修改密碼就好,其余使用默認(rèn)設(shè)置。

注意:創(chuàng)建PJSIP分機(jī)時(shí),筆者在點(diǎn)擊更新后,sipML5客戶端以及軟電話登陸pjsip分機(jī)都出現(xiàn)了forbide的錯(cuò)誤,這是配置沒有完全生效,可以重啟asterisk后臺(tái),或者直接putty連接重啟freepbx。
通話測(cè)試
現(xiàn)在進(jìn)行通話測(cè)試,sipML5客戶端和軟電話的使用在之前文章有提及,不過多贅述,在本次測(cè)試中為內(nèi)網(wǎng)環(huán)境,不需要nat以及stun服務(wù)器的配置,因此在專家模式中需要進(jìn)行一些改動(dòng)。
8888分機(jī)上線成功

9999分機(jī)上線成功

軟電話上線成功

sipML5客戶端8888呼叫sipML5客戶端9999:

通話建立成功,asterisk后臺(tái)日志可查看,下圖為日志部分截圖

sipML5客戶端8888呼叫軟電話10000:

通話建立成功,asterisk后臺(tái)日志可查看,下圖為日志部分截圖

軟電話10000呼叫sipML5客戶端8888:

通話建立成功,asterisk后臺(tái)日志可查看,下圖為日志部分截圖

軟電話10000呼叫sipML5客戶端9999:

通話建立成功,asterisk后臺(tái)日志可查看,下圖為日志部分截圖

sipML5客戶端9999呼叫sipML5客戶端8888

通話建立成功,asterisk后臺(tái)日志可查看,下圖

sipML5客戶端9999呼叫sipML5客戶端10000

通話建立成功,asterisk后臺(tái)日志可查看,下圖為日志部分截圖

至此,sipML5客戶端以及到軟電話的內(nèi)網(wǎng)通訊全都測(cè)試完畢,雙向通訊正常。
接下來我們進(jìn)行更深一步的測(cè)試,讓freepbx對(duì)接sangoma的網(wǎng)關(guān)設(shè)備,型號(hào)為vega50模擬網(wǎng)關(guān),使得內(nèi)部話機(jī)可以與運(yùn)營商雙向呼叫。
FreePBX配置:
與vega網(wǎng)關(guān)對(duì)接,需要一條中繼指向網(wǎng)關(guān),在設(shè)置路徑為“通信接口連接>>中繼”

我們?cè)谶@添加一條sip(chan_pjsip)中繼,默認(rèn)設(shè)置中,將中繼名設(shè)置為簡單易懂的名字

“pjsip配置”中,我們關(guān)閉認(rèn)證和注冊(cè)功能,在SIP服務(wù)器和端口,輸入vega網(wǎng)關(guān)的IP地址和端口

現(xiàn)在配置入局路由。設(shè)置路徑為“通信接口連接>>入局線路>>添加呼入路由設(shè)置”設(shè)置未知目的地為分機(jī) ,同時(shí)指導(dǎo)一個(gè)分機(jī)號(hào)碼接受運(yùn)營商的呼叫

現(xiàn)在配置出局路由。設(shè)置路徑為“通信接口連接>>出局線路>>添加呼出路由設(shè)置”在匹配中繼順序中,選擇好之前創(chuàng)建的中繼。

在Dial Patterns設(shè)置中,匹配模式設(shè)置為X.為匹配所有

現(xiàn)在進(jìn)行網(wǎng)關(guān)側(cè)配置
在vega網(wǎng)關(guān)上,建議新手使用快速配置



配置完成后,進(jìn)行呼叫測(cè)試
使用sipML5客戶端8888分機(jī)呼叫運(yùn)營商號(hào)碼,撥號(hào)時(shí)異地號(hào)碼前加0

通話建立成功,asterisk后臺(tái)日志可查看,下圖為日志部分截圖


呼入測(cè)試,使用手機(jī)撥打回PSTN線路號(hào)碼,檢查8888分機(jī)是否能接受呼叫

通話建立成功,asterisk后臺(tái)日志可查看,下圖為日志部分截圖

注意:
- WebRTC通信對(duì)多方環(huán)境的依賴程度比較高,在本環(huán)境下配置成功不代表環(huán)境
- 在FreePBX配置時(shí),記得使用快照功能,筆者在實(shí)際配置時(shí),由于一些誤操作 導(dǎo)致IP被PBX加入黑名單,無法遠(yuǎn)程訪問頁面,使用快照可還原狀態(tài)
- FreePBX部分配置保持后,沒有立即生效,需要手動(dòng)重啟PBX,保證配置生效,否則可能會(huì)出現(xiàn)。


SIPlab@知識(shí)星球?qū)W習(xí)SIP語音相關(guān)技術(shù)
asterisk@知識(shí)星球免費(fèi)獲取關(guān)于Asterisk的完整知識(shí)資料
關(guān)注微信公眾號(hào):asterisk-cn,獲得有價(jià)值的Asterisk行業(yè)分享
Asterisk freepbx,F(xiàn)reeSBC技術(shù)文檔: www.freepbx.org.cn
融合通信商業(yè)解決方案,協(xié)同解決方案首選產(chǎn)品:www.hiastar.com
Asterisk/FreePBX中國合作伙伴,官方qq技術(shù)分享群(3000人):589995817