呼叫中心中间件-网关配置

253 阅读3分钟

一起养成写作习惯!这是我参与「掘金日新计划 · 4 月更文挑战」的第4天,点击查看活动详情。

介绍

支持给网关指定变量,设置网关的语音编码编码和主叫号码。网关配置编辑后,不能实时生效 ,需要执行sofia命令才可以生效,具体看SIP设置。

配置

cti_gateway@domain [哈希表]

  1. key 网关名字
  2. value 网关配置

| ``` { "param": { "register": "true", "caller-id-in-from": "true", "realm": "180.76.224.191:35560", "from-user": "", "destination-prefix": "", "username": "mytrunk", "password": "mytrunk@ddt" }, "variables": { "sip_sticky_contact": "true" } }

| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

![gateway_template.png](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/007b00f8310a4e64b98c728f708f31f9~tplv-k3u1fbpfcp-zoom-1.image)

-   param 网关参数

    -   realm 网关服务器IP
    -   username 网关用户名
    -   password 网关密码
    -   register 是否需要注册
    -   destination-prefix 报号前缀,呼叫时被叫号码之前添加这个前缀
    -   from-user 对接IMS时需要,根据IMS要求填写,一般和username设置一样
    -   from-domain 对接IMS时需要,根据IMS要求填写,一般和realm设置一样
    -   caller-id-in-from sip信令from设置为主叫号码
    -   extension extension parameter influence the contents of channel variable Caller-Destination-Number and destination_number. If it is blank, Caller-Destination-Number will always be set to gateway’s username. If it has a value, Caller-Destination-Number will always be set to this value. If it has value auto_to_user, Caller-Destination-Number will be populated with value ${sip_to_user} which means the real dialled number in case of an inbound call.
    -   extension-in-contact Param “extension-in-contact” is used to force what the contact info will be in the registration. If you are having a problem with the default registering as gw+gateway_name@ip you can set this to true to use extension@ip. If extension is blank, it will use username@ip.
    -   auth-username 认证用户名,如果认证用户名和用户名不一样时需要配置
    -   retry-seconds this sets the number of seconds to retry the registration
    -   expire-seconds 注册的过期时间,如果不设置,默认是 3600,建议设置60。

-   variables 网关变量

    -   absolute_codec_string 声音编码
    -   p:caller_id_number 主叫号码
    -   sip_sticky_contact 为了防止NAT环境出问题,都设置为true

## [](http://www.ddrj.com/callcenter/gateway.html#%E7%BD%91%E5%85%B3%E7%9A%84%E6%B3%A8%E5%86%8C%E7%8A%B6%E6%80%81%E5%86%99%E5%85%A5redis "网关的注册状态写入redis")网关的注册状态写入redis

cti.json\


| ```
    "gui": {         /*网关信息推送到redis*/         "gateway": {             "hash": "gateways",             "channel": "",             "list": ""         }     } ` 
``` |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

网关注册信息会记录到哈希表gateways\
key:网关名字\
value:注册信息\
没勾选注册的\


| ```
{     "Event-Name": "CUSTOM",     "Core-UUID": "651a086c-4d20-4749-96a4-3eb2cb866ec3",     "FreeSWITCH-Hostname": "ai",     "FreeSWITCH-Switchname": "ai",     "FreeSWITCH-IPv4": "192.168.31.57",     "FreeSWITCH-IPv6": "::1",     "Event-Date-Local": "2022-04-07 23:19:29",     "Event-Date-GMT": "Thu, 07 Apr 2022 15:19:29 GMT",     "Event-Date-Timestamp": "1649344769167507",     "Event-Calling-File": "sofia_reg.c",     "Event-Calling-Function": "sofia_reg_add_gateway",     "Event-Calling-Line-Number": "3740",     "Event-Sequence": "92",     "Event-Subclass": "sofia::gateway_add",     "Gateway": "default",     "profile-name": "external" } ` 
``` |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

注册成功的\


| ```
{     "Event-Name": "CUSTOM",     "Core-UUID": "651a086c-4d20-4749-96a4-3eb2cb866ec3",     "FreeSWITCH-Hostname": "ai",     "FreeSWITCH-Switchname": "ai",     "FreeSWITCH-IPv4": "192.168.31.57",     "FreeSWITCH-IPv6": "::1",     "Event-Date-Local": "2022-04-07 23:23:11",     "Event-Date-GMT": "Thu, 07 Apr 2022 15:23:11 GMT",     "Event-Date-Timestamp": "1649344991284944",     "Event-Calling-File": "sofia_reg.c",     "Event-Calling-Function": "sofia_reg_fire_custom_gateway_state_event",     "Event-Calling-Line-Number": "156",     "Event-Sequence": "680",     "Event-Subclass": "sofia::gateway_state",     "Gateway": "default",     "State": "REGED",     "Ping-Status": "UP",     "Register-Network-IP": "49.235.127.246",     "Register-Network-Port": "39468" }
``` |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------