Freeswitch: Fsapi - xml_locate

Выводит древо активных параметров XML.

Использование:
xml_locate [root | <section> | <section> <tag> <tag_attr_name> <tag_attr_val>]

xml_locate root - вернет полную XML конфигурацию FreeSWITCH

xml_locate <section>: Вернет XML заданной секции

xml_locate directory
xml_locate configuration
xml_locate dialplan
xml_locate phrases

Примеры:

Directory

xml_locate directory domain name example.com

Configuration

xml_locate configuration configuration name ivr.conf

Dialplan

xml_locate dialplan context name default

Примеры фильтрации вывода:

sed

fs_cli -x 'xml_locate dialplan context name default' | sed -n '/unloop">$/,/extension>$/p'

awk

fs_cli -x 'xml_locate dialplan context name default' | awk '/unloop">$/,/extension>$/'

grep

fs_cli -x 'xml_locate dialplan context name default' | grep -C 8 unloop

Вывод:

<extension name="unloop">
    <condition field="${unroll_loops}" expression="^true$"></condition>
    <condition field="${sip_looped_call}" expression="^true$">
        <action application="deflect" data="${destination_number}"></action>
    </condition>
</extension>
fs_cli -x 'xml_locate directory domain name 192.168.1.123' | awk '/id="default">/,/\/user>$/'
<user id="default"> 
    <variables>
          <variable name="numbering_plan" value="US"></variable>
          <variable name="default_areacode" value="918"></variable>
          <variable name="default_gateway" value=""></variable>
    </variables>
  </user>
fs_cli -x 'xml_locate directory domain name 192.168.214.253' | awk '/user id|"pass/' 
          <user id="72800">
                  <param name="password" value="VeryStrongPassFor72800"></param>
          <user id="72801">
                  <param name="password" value="vERYsTRONGpASSfOR72801"></param>
          <user id="72802">
   ...

Freeswitch API

  • freeswitch/api/xml_locate.txt
  • Последние изменения: 2020/03/05