FreeSWITCH中文网,电话机器人开发网 ,微信订阅号:

FreeSWITCH及VOIP,Openser,电话机器人等产品中文技术资讯、交流、沟通、培训、咨询、服务一体化网络。QQ群:293697898

FreeSwitch multi-domain extension auth service


tags:FreeSwitch multi-domain extension auth service 创建时间:2016-09-14 19:11:46

Here is a auth service for FreeSwitch multi domain ,It can running on Windows or Debian 8.

client setup:

Debian 8 64bit FreeSwitch multi doamin extension auth service,download:

http://pan.baidu.com/s/1kVoAVD9

Windows 10/2008/2012/2003 64bit FreeSwitch multi doamin extension auth service,download:

http://pan.baidu.com/s/1kVlnj5l

主要用于避免去配odbc,支持多核多线程,同时启动一个应用即可完成工作而用。

  1. 用于Windows下对FreeSWITCH在使用postgresql对extension数据存储时的认证

  2. 数据库结构如下:

domain表

CREATE TABLE call_domain
(
  id bigserial NOT NULL,
  domain_name character varying(50),
  domain_description text
)

extenstion表

CREATE TABLE call_extension
(
  id bigserial NOT NULL,
  extension_name character varying(50) NOT NULL, -- 分机名称
  extension_number character varying(50) NOT NULL, -- 分机号码
  callout_number character varying(50), -- 外呼时的号码
  extension_type bigint, -- 分机类型
  group_id bigint,
  extension_pswd character varying(130) DEFAULT 'nway.com.cn'::character varying,
  extension_login_state character varying(50) DEFAULT 'success'::character varying,
  extension_reg_state character varying(50), -- 注册状态
  callout_gateway bigint,
  is_allow_callout boolean DEFAULT true,
  call_state integer, -- 该分机的通话状态,空闲为0,正在通话中1
  is_record boolean DEFAULT false, -- 是否录音
  answer_without_state boolean DEFAULT false, -- 在不上线,不置闲的情况下就可以进行应答,默认是必须由客户端上线等
  say_job_number boolean DEFAULT false, -- 是否要报工号,不管是与否,当answerwithoutstate为true时,它都无效,报工号时,在本工号接听时,播放工号语音
  job_number character varying(40) DEFAULT '::character varying, -- 工号,最大为40个字符串
  domain_id bigint DEFAULT 0,

)

配置文件中的参数:

#数据库连接字符串
dbstring = user=postgres dbname=nwaycloud password=nway2013 host=192.168.1.208 port=5432 sslmode=disable

#user auth part
#分机表名
tablename = call_extension
#分机名
extensionuser = extension_number
#分机密码
extensionpswd = extension_pswd
#分机domain
extensiondomain_id = domain_id

groupname = group_name

#domain part
#域表名
domaintable = call_domain
#域字段名
domainname = domain_name
#数据库类型
dbcategory = postgresql

tablename = extension_number

fields :
extension_number,extension_pswd,extension_domain,group_name,outbound_caller_id_number

当进行查询时为如下语句,当然也可以在Nway.conf中配置相关字段名和表名,但不会由这个应用创建,而是已建好的。

select a.extension_pswd  from call_extension a,call_domain b where a.extension_number='1000' and a.domain_id=b.id and b.domain_name='nway.com.cn'
  1. 在WINDOWS的FreeSWITCH下,conf/autoload_configs/modules.conf.xml中配置


    主要是让mod_xml_curl模块自动加载 接下来配置 conf/autoload_configs/xml_curl.conf.xml 用以下内容替换整个文件内容

    <binding name="directory"> 
      <param name="gateway-url" value="http://127.0.0.1:3000" bindings="directory"/> 
    </binding>
    

  2. 启动本应用程序

  3. 重启FreeSWITCH

  4. 当认证失败时会自动瞎匹配18621575908到程序中

    Fusionpbx info:

    CREATE TABLE v_extensions ( extension_uuid uuid NOT NULL, domain_uuid uuid, extension text, number_alias text, password text, provisioning_list text, mailbox text, vm_password text, accountcode text, effective_caller_id_name text, effective_caller_id_number text, outbound_caller_id_name text, outbound_caller_id_number text, emergency_caller_id_number text, directory_full_name text, directory_visible text, directory_exten_visible text, limit_max numeric, limit_destination text, vm_enabled text, vm_mailto text, vm_attach_file text, vm_keep_local_after_email text, user_context text, toll_allow text, call_timeout numeric, call_group text, hold_music text, auth_acl text, cidr text, sip_force_contact text, nibble_account numeric, sip_force_expires numeric, mwi_account text, sip_bypass_media text, unique_id numeric, dial_string text, dial_user text, dial_domain text, do_not_disturb text, forward_all_destination text, forward_all_enabled text, forward_busy_destination text, forward_busy_enabled text, follow_me_uuid uuid, enabled text, description text, CONSTRAINT v_extensions_pkey PRIMARY KEY (extension_uuid) )

    CREATE TABLE v_domains ( domain_uuid uuid NOT NULL, domain_name text, domain_description text, CONSTRAINT v_domains_pkey PRIMARY KEY (domain_uuid) )

so it releation by uuid ,can modify it to using fusionpbx



上海老李,QQ:1354608370,FreeSWITCH QQ群: