Freeswitch SIP用户创建问题

时间:2013-04-22 08:51:22

标签: freeswitch

我正在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>

后来我编辑了dialplan文件夹的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尝试了我找到的所有解决方案,但是它们没有用。 有人能帮助我吗?

1 个答案:

答案 0 :(得分: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系列的任何扩展程序块以避免冲突。

除此之外,如果您无法使用默认用户和默认配置拨打电话,则不应尝试创建用户,因为您可能还有其他错误。