freeswitch 使用mod_xml_curl 模块做用户注册鉴权报错提示:No dial-string available, please check your user directory.
mod_xml_curl 模块可以让api接口动态返回配置,非常有用! 官方文档地址:
https://developer.signalwire.com/freeswitch/FreeSWITCH-Explained/Modules/mod_xml_curl_1049001/
freeswitch 使用mod_xml_curl模块做用户注册鉴权,根据接口返回的用户xml 配置,分机号1234可以通过软电话注册上,也可以拨打其他分机。但是用执行originate 命令时报错:
originate user/1234 &echo()
-ERR MANDATORY_IE_MISSING
2025-09-02 10:25:51.245773 [DEBUG] switch_ivr_originate.c:2142 Parsing global variables
2025-09-02 10:25:51.245773 [ERR] mod_dptools.c:4218 No dial-string available, please check your user directory.
原因是缺少dial-string 参数,鉴权api返回的xml结构中加上dial-string 那一行就可以了,这一行配置原本在配置文件default.xml 中有。所以通过配置文件注册用户时在执行类似:originate user/1234 &echo() 时不会报错。
鉴权api返回的完整xml如下:
<document type="freeswitch/xml">
<section name="directory">
<domain name="172.26.129.54">
<user id="1234">
<params>
<param name="password" value="password1234"></param>
<param name="vm-password" value="1234"></param>
<param name="dial-string" value="{^^:sip_invite_domain=${dialed_domain}:presence_id=${dialed_user}@${dialed_domain}}${sofia_contact(*/${dialed_user}@${dialed_domain})},${verto_contact(${dialed_user}@${dialed_domain})}"></param>
<param name="auth-acl" value="192.168.1.100/32,192.168.2.0/24,10.0.0.1/32"></param>
</params>
<variables>
<variable name="toll_allow" value="domestic,international,local"></variable>
<variable name="accountcode" value="5364"></variable>
<variable name="user_context" value="default"></variable>
<variable name="effective_caller_id_name" value="Extension 1234"></variable>
<variable name="effective_caller_id_number" value="1234"></variable>
<variable name="outbound_caller_id_name" value="$${outbound_caller_name}"></variable>
<variable name="outbound_caller_id_number" value="$${outbound_caller_id}"></variable>
<variable name="callgroup" value="techsupport"></variable>
</variables>
</user>
</domain>
</section>
</document>
说明:
<domain name="172.26.129.54">中的 172.26.129.54 是 fs的发起请求鉴权api时的domain参数的值,fs的默认配置里domain是取值服务器的内网ip。api服务器和fs服务器可能不在同一台机器,以fs发起请求时的domain参数为准,如果随意写则导致配置的域不同,没法通过注册验证。<user id="1234">中id写分机号。- 这一行很重要,
<param name="auth-acl" value="192.168.1.100/32,192.168.2.0/24,10.0.0.1/32"></param>是允许注册发起的ip,支持多个可以用逗号分隔。192.168.1.100/32 作用是允许ip为192.168.1.100的客户端发起注册。是否可以直接写192.168.1.100未尝试,应该也是可以的。测试时写的都是公网ip地址。未尝试软电话客户端和fs在同一网络内时,写客户端内网ip的情况。
总结:在使用 mod_xml_curl模块时,如果api接口返回的配置并没有生效,或者配置使用报错。可以根据报错查找对比原来文件配置,尝试加上,看能否解决问题。

浙公网安备 33010602011771号