顶顶通呼叫中心中间件(mod_cti基于FreeSWITCH)-网关配置

介绍

支持给网关指定变量,设置网关的语音编码编码和主叫号码。网关配置编辑后,不能实时生效 ,需要执行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

  • 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。
    • context 呼入的路由,呼入的URI需要指定网关才可以关联到路由比如sip:555000002@1.2.3.4;gw=网关名 或者 sip:gw+网关@1.2.3.4
  • variables 网关变量
    • absolute_codec_string 声音编码
    • p:caller_id_number 主叫号码
    • sip_sticky_contact 为了防止NAT环境出问题,都设置为true

配置改变通知

config@all config@domain [通道]

cti_gateway@domain改变PUBLISH 通知到 config@domain。

{
"type":"config_change",
"table":"cti_gateway",
"key":"test"
}
  • type,config_change:配置改变

  • table,那个表修改了,只需要@前面的。

  • key table的主键,比如网关名字。

网关的注册状态写入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"
}
`