FreeSWITCH blacklist function settings

Function description: filter the number of calls

step:

1. Compile the mod_blacklist module: enter the source directory /usr/local/src/freeswitch --> make mod_blacklist-install

2. Load mod_blacklist module: fs_cli --> reload mod_blacklist or modules.conf.xml add --> <load module="mod_blacklist"/> restart FS

3. Set the mod_blacklist module: the default blacklist.conf.xml is as follows:

  <configuration name="mod_blacklist.conf" description="Blacklist module">
    <lists>

      <list name="example" filename="/usr/local/freeswitch/blacklists/blocked.list"/>
    </lists>
  </configuration>

  Create blocked.list in the /usr/local/freeswitch/blacklists directory, enter the content of the blacklist number, one per line, save it, and modify the user group of the file to be the same as FS, and the permissions can be read and written.

4. Set dialing rules:

  1> To call out blacklist restrictions, add the following rules at the top of default.xml

  <extension name="blacklist_check">
    <condition field="${blacklist(check example ${destination_number})}" expression="^true$">
      <action application="answer" data=""/>
      <action application="playback" data="$${base_dir}/sounds/music/city_of_sky.wav"/>
      <action application="hungup" data=""/>
    </condition>
  </extension>

  2> If you need to call into the blacklist restriction, add the following rules at the top of public.xml

  <extension name="blacklist_check">
    <condition field="${blacklist(check example ${caller_id_number})}" expression="^true$">
      <action application="answer" data=""/>
      <action application="playback" data="$${base_dir}/sounds/music/Speak.wav"/>
      <action application="hangup" data=""/>
    </condition>
  </extension>

  Note: The above blacklists for incoming and outgoing calls are placed in the blacklist of list name= example, and the incoming and outgoing calls can also be split into separate files for use. For configuration, you only need to modify the corresponding listname value in the dialing rules.

5 Blacklist API

1
2
3
4
5
6
7
>blacklist  help
blacklist check <listname> <item>    / /  检查内存中黑名单列表是否有item,有返回true,没有则返回false
blacklist add <listname> <item>      / /  在内存 listname 对应的列表中增加 item 项
blacklist  del  <listname> <item>      / /  在内存 listname 对应的列表中删除 item 项
blacklist save <listname>            / /  将内存 listname 中的所有 item 写入对应的文件中,如  / usr / local / freeswitch / blacklists / blocked. list
blacklist  reload                     / /  将文件中的数据更新到 内存中
blacklist  help                       / /  显示该模块所有的API

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324776646&siteId=291194637