1. 寧衛微信通信模塊使用說明書:
  2. 寧衛通信
  3. 新聞動態
  4. 寧衛新聞
  5. 寧衛微信通信模塊使用說明書

寧衛微信通信模塊使用說明書

https://mp.weixin.qq.com/s/JzPMakWoCQyPbDN7o8QP6Q

需要開通有關音視頻流的權限

協議

如何讓微信小程序和傳統電話進行語音溝通、進行實時交流

 協議部分

 

 雙向的協議

 

請求包

```

{

       "type":"request",

       "method":"x",                        //register,invite,bye,cancel,answer,option,message

       "version":"x",                       //1.0,1.1 等,高版本可支持低版本,但低版本不一定支持高版本

       "sessionid":"x",                     //invite,bye,cancel,answer 需在同一個會話中

       "order":x,                           //序號

       "appname":"x",                       //如微信小程序

       "protoname":"x",                     //rtmp gb28181 rtsp

       "realm":"x",                         //實際ip

       "data":{

              "caller_number":"x",                    //都有

              "callee_number":"x",                    //register,option沒有

              "caller_url":"x",                       //推流地址

              "callee_url":"x",                       //拉流地址

              "caller_audio":"G711A",                 //推流語音編碼

              "caller_video":"H264" ,                 //推流視頻編碼

              "media_attribute":"x",                  //sendonly,sendrecv,recvonly

              "password":"x"                          //密碼,只在register時啟用

       }

}

```

 

回應包

 

```

{

       "type":"response",

       "method":"x",

       "version":"x",                       //1.0,1.1 等,高版本可支持低版本,但低版本不一定支持高版本

       "sessionid":"x",                     //invite,bye,cancel,answer 需在同一個會話中

       "order":x,                           //序號

       "appname":"x",                       //wx,fs,攝像機

       "protoname":"x",                     //rtmp gb28181 rtsp

       "data":{

              "code":"200ok",                      //200 401 403 480,解析不了 505,506請求類型不配套

              "msg":"xxx"                          //回應的消息內容

              "callee_audio":"G711A",                //推流語音編碼

              "callee_video":"H264" ,                 //推流視頻編碼

              "caller_url":"x",                       //推流地址

              "callee_url":"x"                        //拉流地址

       }

}

```

 

 模塊配置

 

```

[server]

addr=0.0.0.0:18123

welcome_wav=/opt/welcome.wav

welcome_h264=/opt/welcome.h264

fs_esl_ip=127.0.0.1:8021

fs_auth=ClueCon

 

base_pull_url=rtmp://182.61.34.55/live/

base_push_url=rtmp://182.61.34.55/live/

 

use_callout=false

callout_gateway=

 

[user]

user_number=2

 

[users]

user1=lihao

password1=1234

user2=nway

password2=1234

 

 

#this not support

[database]

use_db=no

#yes no

#posgresql,mysql,sqlite3

db_type=sqlite3

db_string=./db.db3

 

#sqlite3

#/*

#create table wx_user(

#     user_name text,

#     password text

#)

#*/

#postgresql

#/*

#create table wx_user(

#     user_name text,

#     password text

#)

#*/

#mysql

#/*

#create table wx_user(

#     user_name text,

#     password text

#)

#*/

 

 

#this not support

[acl]

use_acl=no

allow=0.0.0.0

```

## 使用方法

 

### 加載模塊

 

```

load mod_nway_wx

```

 

api 規則

```

nway_wx_api uuid caller_name gateway destination_number welcome.wav welcome.h264 rtmp://nway.com.cn/push_url rtmp://nway.com.cn/pull_url nway.com.cn

```

 

呼叫規則

 

    由小程序發起呼叫,可以呼給手機,也可以直接呼給座席終端,可以啟用視頻,也可以不啟用視頻,如果用在語音系統中,不建議使用視頻,否則帶寬占用比較大

 

模塊配置

 

```

<configuration name="nway_wx.conf" description="nway wx service control module for FreeSWITCH">

  <settings>

    <param name="ip_port" value="0.0.0.0:25535"/>

    <param name="use_video" value="false"/>

    <param name="audio_codec" value="aac"/>

    <param name="video_codec" value="h264"/>

    <param name="push_to_other" value="true"/>

    <param name="program_name" value="wechat"/>

    <!--program name usage: wechat dingding douyin hd-machine-->

    <param name="use_flv" value="true"/>

    <param name="ptime" value="20"/>

  </settings>

</configuration>

```

 

UI

在小程序開發環境中



手機小程序中界面


當按以上的通信協議和使用方式通信時,就能讓我們的電話系統和微信直接雙通了。

台湾佬?偷拍?娱乐?中文网