0

我正在 Ubuntu Precise Pangoline 服务器上的 freeswitch PBX 上运行一些测试。我使用的 Freeswitch 版本是来自 git repo 的版本。我添加了一个 SIP 用户并从 SIP 电话访问 Freeswitch 我不断收到以下错误消息:

2013-04-22 08:34:20.146022 [CONSOLE] switch_core.c:2096
FreeSWITCH Version 1.5.1b+git~20130417T225111Z~54d47599e9 (git 54d4759 2013-04-17 22:51:11Z)

FreeSWITCH Started
Max Sessions [1000]
Session Rate [30]
SQL [Enabled]

freeswitch@moses> 2013-04-22 08:35:20.688573 [WARNING] sofia_reg.c:2621 Can't find user [1100@192.168.125.128] from 192.168.125.1
You must define a domain called '192.168.125.128' in your directory and add a user with the id="1100" attribute
and you must configure your device to use the proper domain in it's authentication credentials.

这些是我创建 SIP 用户所采取的步骤。正如 conf 目录中的 freeswitch.xml 中所述,所有配置设置都应该在 vanilla 文件夹中完成。我去了那里,在目录文件夹中,我通过复制默认值之一创建了用户 xml 文件并更改了设置:

root@moses:/usr/local/src/freeswitch/conf/vanilla/directory/default# vim 1100.xml
<include>
  <user id="1100">
    <params>
      <param name="password" value="$${default_password}"/>
      <param name="vm-password" value="1100"/>
    </params>
    <variables>
      <variable name="toll_allow" value="domestic,international,local"/>
      <variable name="accountcode" value="1100"/>
      <variable name="user_context" value="default"/>
      <variable name="effective_caller_id_name" value="Gwen"/>
      <variable name="effective_caller_id_number" value="1100"/>
      <variable name="outbound_caller_id_name" value="$${outbound_caller_name}"/>
      <variable name="outbound_caller_id_number" value="$${outbound_caller_id}"/>
      <variable name="callgroup" value="techsupport"/>
    </variables>
  </user>
</include>

后来我编辑了拨号方案文件夹的 default.xml 文件,并在 Local_Extension 下将 1100 添加到正则表达式中,如下所示:

root@moses:/usr/local/src/freeswitch/conf/vanilla/dialplan# vim default.xml
<?xml version="1.0" encoding="utf-8"?>
<!--
    NOTICE:

    This context is usually accessed via authenticated callers on the sip profile on port 5060
    or transfered callers from the public context which arrived via the sip profile on port 5080.

    Authenticated users will use the user_context variable on the user to determine what context
    they can access.  You can also add a user in the directory with the cidr= attribute acl.conf.xml
    will build the domains ACL using this value.
-->
<!-- http://wiki.freeswitch.org/wiki/Dialplan_XML -->
<include>
   ...................
    <extension name="Local_Extension">
      <!--<condition field="destination_number" expression="^(10[01][0-9]|1100)$"> -->
      <condition field="destination_number" expression="^1100$">
        <action application="export" data="dialed_extension=$1"/>
        <!-- bind_meta_app can have these args <key> [a|b|ab] [a|b|o|s] <app> -->
        <action application="bind_meta_app" data="1 b s execute_extension::dx XML features"/>
        <action application="bind_meta_app" data="2 b s record_session::$${recordings_dir}/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
        <action application="bind_meta_app" data="3 b s execute_extension::cf XML features"/>
        <action application="bind_meta_app" data="4 b s execute_extension::att_xfer XML features"/>
        <action application="set" data="ringback=${us-ring}"/>
        <action application="set" data="transfer_ringback=$${hold_music}"/>
        <action application="set" data="call_timeout=30"/>
        <!-- <action application="set" data="sip_exclude_contact=${network_addr}"/> -->
        <action application="set" data="hangup_after_bridge=true"/>
        <!--<action application="set" data="continue_on_fail=NORMAL_TEMPORARY_FAILURE,USER_BUSY,NO_ANSWER,TIMEOUT,NO_ROUTE_DESTINATION"/> -->
        <action application="set" data="continue_on_fail=true"/>
        <action application="hash" data="insert/${domain_name}-call_return/${dialed_extension}/${caller_id_number}"/>
        <action application="hash" data="insert/${domain_name}-last_dial_ext/${dialed_extension}/${uuid}"/>
        <action application="set" data="called_party_callgroup=${user_data(${dialed_extension}@${domain_name} var callgroup)}"/>
        <action application="hash" data="insert/${domain_name}-last_dial_ext/${called_party_callgroup}/${uuid}"/>
        <action application="hash" data="insert/${domain_name}-last_dial_ext/global/${uuid}"/>
        <!--<action application="export" data="nolocal:rtp_secure_media=${user_data(${dialed_extension}@${domain_name} var rtp_secure_media)}"/>-->
        <action application="hash" data="insert/${domain_name}-last_dial/${called_party_callgroup}/${uuid}"/>
        <action application="bridge" data="user/${dialed_extension}@${domain_name}"/>
        <action application="answer"/>
        <action application="sleep" data="1000"/>
        <action application="bridge" data="loopback/app=voicemail:default ${domain_name} ${dialed_extension}"/>
      </condition>
    </extension>

    ............
</include>

到目前为止,我已经尝试了通过在网上的 vars.xml 中设置我的 local_ip_v4 找到的所有解决方案,但它们没有工作。有人能帮我吗?

4

1 回答 1

3

您的问题是您修改后的正则表达式不再进行捕获。请注意,1100 周围没有括号将其放入变量 $1。

<condition field="destination_number" expression="^1100$">

在条件 XML 块中,您看到的第一个条目是:

<action application="export" data="dialed_extension=$1"/>

dialed_extension 变量应该被分配从表达式中捕获的值,但是由于不再有捕获,所以这会失败。

相反,您可以修改原始条件块,即您注释掉的那个,以便它也包括 1100 系列用户:

<!--<condition field="destination_number" expression="^(1[01][01][0-9])$"> -->

请记住,您可能需要禁用任何使用 1100 系列的扩展块以避免冲突。

除此之外,如果您无法使用默认用户和默认配置进行调用,则不应尝试创建用户,因为您很可能有其他问题。

于 2013-09-20T19:49:41.880 回答