freeswitch实战九(用户管理模块)

PHP批量创建用户注册

centOS7下

1. 安装mod_xml_curl模块
    1. 在源码目录下:
    2. make mod_xml_curl && make mod_xml_curl-install
2. cd /usr/local/freeswitch/conf/autoload_configs/目录下的modules.conf.xml文件取消
    1. <!-- <load module="mod_xml_curl"/> -->的注释
3. 为mod_xml_curl绑定网关
    1. 编辑/freeswitch/conf/autoload_configs/xml_curl.conf.xml
    2. 添加以下
      <binding name="all configs">
         <param name="gateway-url" value="http://192.168.0.103:80/callCenter/directory.php/" bindings="dialplan|configuration|directory|phrases"/>
     </binding>

4. 创建一个本地的http服务上面的地址就是创建的服务器地址的directory.php文件,编辑管理用户逻辑
     <?php
        header("content-type:text/html;charset=utf-8");
        require_once "include/common.php"; //全局引导文件
        require_once 'freeSwitchEsl.php';

        session_start();
    //$freeswitch = new Freeswitchesl();
    //$connect = $freeswitch->connect("192.168.0.126","8021","ClueCon");
    $tel = $_POST['user'];
    $domain = $_POST['domain'];
    //查询数据库用户名
    $query = $sqs_db->query("select * from fs_user WHERE username=$tel");

    while($row = $sqs_db->fetch_array($query))
    {
            $pwd=$row["password"];
    ?>
    <?php if($pwd){ ?>
    <document type="freeswitch/xml">
        <section name="directory">
            <domain name="<?php echo $domain;?>">
                <params>
                    <param name="dial-string" value="{presence_id=${dialed_user}@${dialed_domain}}${sofia_contact(${dialed_user}@${dialed_domain})}"/>
                </params>
                <groups>
                    <group name="default">
                        <users>
                            <user id="<?php echo $tel; ?>">
                                <params>
                                    <param name="password" value="<?php echo $pwd; ?>"/>
                                    <param name="vm-password" value="<?php echo $pwd; ?>"/>
                                </params>
                                <variables>
                                    <variable name="toll_allow" value="domestic,international,local"/>
                                    <variable name="accountcode" value="<?php echo $tel; ?>"/>
                                    <variable name="user_context" value="default"/>
                                    <variable name="effective_caller_id_name" value="FreeSWITCH-CN"/>
                                    <variable name="effective_caller_id_number" value="<?php echo     $tel;?>"/>
                                    <!-- <variable name="outbound_caller_id_name" value="$${outbound_caller_name}"/> -->
                                    <!-- <variable name="outbound_caller_id_number" value="$${outbound_caller_id}"/> -->
                                    <variable name="callgroup" value="default"/>
                                    <variable name="sip-force-contact" value="NDLB-connectile-dysfunction"/>
                                    <variable name="x-powered-by" value="http://www.freeswitch.org.cn"/>
                                </variables>
                            </user>
                        </users>
                    </group>
                </groups>
            </domain>
        </section>
    </document>
    <?php }else {
        echo "不符合要求";
    }
}?>
5. 然后再FS中执行reload mod_xml_curl
6. xml_curl debug_on命令可以开启日志

win7下配置

windows环境下模块已经安装,无需手动安装
1. 打开\conf\autoload_configs目录下的modules.conf,配置启动时自动加载mod_xml_curl模块
    <load module="mod_xml_curl"/>
2. 配置\conf\autoload_configs目录下的xml_curl.xml文件,添加链接的http地址
<bindings>
    <binding name="all configs">
         <param name="gateway-url" value="http://192.168.0.103:80/callCenter/directory.php/" bindings="directory"/>
    </binding>
</bindings>
3. php文件内容同上
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值