Skip to content

Freeswitch Example

Lorenzo Mangani edited this page May 13, 2017 · 1 revision

Freeswitch Example

Modules:

mod_curl

CURL Example

 <extension name="announce">
      <condition field="destination_number" expression="^6000$">
        <action application="curl" data="http://blacklist.xx.com:3001/api/get/${network_addr} json" inline="true" />
        <action application="set" data="blocked=${system echo '${curl_response_data}' | jq -r '.body' | jq -r '.blocked' | tr -d '\n'}" inline="true"/>
        <condition field="blocked" expression="^true$">
                <anti-action application="respond" data="503"/>
        </condition>
        <condition field="blocked" expression="^false$">
                <action application="set" data="curl_response_data=" inline="true"/>
                <action application="info"/>
                <action application="set" data="rtcp_audio_interval_msec=5000"/>
                <action application="answer"/>
                <action application="sleep" data="2000"/>
                <action application="ivr" data="demo_ivr"/>
        </condition>
      </condition>
    </extension>
Clone this wiki locally