signalwire / freeswitch

FreeSWITCH is a Software Defined Telecom Stack enabling the digital transformation from proprietary telecom switches to a versatile software implementation that runs on any commodity hardware. From a Raspberry PI to a multi-core server, FreeSWITCH can unlock the telecommunications potential of any device.
https://freeswitch.com/#getting-started
Other
3.62k stars 1.43k forks source link

Quirk behaviour of mod_xml_curl #1356

Closed dowusu closed 3 years ago

dowusu commented 3 years ago

I've configured mod_xml_curl bindings for only phrases, however from my web application logs - I see request being made with section as dialplan, directory or languages. Is this the expected behaviour - perusing the docs suggest that the request should only be triggered for the specified bindings. BTW I'm using the default example config, below is my xml_curl.conf.xml config

Also note that setting method to GET seem to have no effect on the request. Freeswitch 1.10.6

<configuration name="xml_curl.conf" description="cURL XML Gateway">
  <bindings>
     <binding name="phrase_macros">
      <param name="gateway-url" value="http://192.168.8.120:4000/phrases" bindings="phrases"/>
      <param name="method" value="GET"/>
    </binding>
  </bindings>
</configuration>
azzbcc commented 3 years ago

https://github.com/signalwire/freeswitch/blob/6827c663739e268e92d0e99572295f37dd40f23f/src/switch_xml.c#L253-L262

no phrases binding defined.

dowusu commented 3 years ago

I've gone through a great deal trying to get phrases to work with mod_xml_curl but eventually I run into the below error captured from the log files

switch_ivr_play_say.c:70 No language specified - Using [en] mod_xml_curl.c:324 XML response is in /tmp/2586cd52-1f72-11ec-a3cb-bf7e23032396.tmp.xml switch_ivr_play_say.c:145 Can't find macro vmg.

Below is the content of the mod_xml_response

<document type="freeswitch/xml">
  <section name="phrases">
    <macros>
      <language name="en">
        <macro name="vmg">
          <input pattern="(.*)">
            <match>
              <action function="play-file" data="http://192.168.8.120:4000/audio.vox/ENG/SS-000-001-EN.vox"/>
              <action function="play-file" data="http://192.168.8.120:4000/audio.vox/TWI/SS-000-001-EN.vox"/>
              <action function="play-file" data="http://192.168.8.120:4000/audio.vox/GA/SS-000-001-EN.vox"/>
              <action function="play-file" data="http://192.168.8.120:4000/audio.vox/DAGBANI/SS-000-001-EN.vox"/>
            </match>
          </input>
        </macro>
      </language>
    </macros>
  </section>

Binding configuration

 <binding name="phrases">
      <param name="gateway-url" value="http://192.168.8.120:4000/hello" bindings="languages"/>
      <param name="method" value="GET"/>
      <param name="enable-post-var" value="macro_name"/>
      <param name="enable-post-var" value="variable_sip_req_user"/>
      <param name="enable-post-var" value="variable_sip_from_user"/>
    </binding>

I'm not sure if I'm missing something, I've checked on slack, gone through the FS docs and still can't find any info.

azzbcc commented 3 years ago
<document type="freeswitch/xml">
  <section name="languages">
    <language name="en">
      <phrases>
        <macros>
          <macro name="vmg">
            <input pattern="(.*)">
              <match>
                <action function="play-file" data="http://192.168.8.120:4000/audio.vox/ENG/SS-000-001-EN.vox"/>
                <action function="play-file" data="http://192.168.8.120:4000/audio.vox/TWI/SS-000-001-EN.vox"/>
                <action function="play-file" data="http://192.168.8.120:4000/audio.vox/GA/SS-000-001-EN.vox"/>
                <action function="play-file" data="http://192.168.8.120:4000/audio.vox/DAGBANI/SS-000-001-EN.vox"/>
              </match>
            </input>
          </macro>
        </macros>
      </phrases>
    </language>
  </section>
</document>

which useable for phrase application.

dowusu commented 3 years ago

Thanks a bunch sir, you've made my day. It works perfectly. Kudos and keep up the good work.