Call Us Today! 877.742.2583

Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Current »


mod_xml_rpc allows you to use the webapi - firing any API from the web browser just as you would from the FS console!

API command documentation can be found in the mod_commands section.


To use, you must enable this module within the conf/autoload_configs/modules.conf.xml file and restart the switch. You can configure the module (HTTP port, domain, login/password) within the conf/autoload_configs/xml_rpc.conf.xml file.

The basic syntax would be:

http://<freeswitch-hostname-or-IP>:8080/webapi/<api command>

For example:


  • HTTP only, no HTTPS
  • port 8080
  • Typical HTTP authentication - username, password (default is freeswitch/works)

Generally, the web root is {prefix}/freeswitch/htdocs.

Other HTML/JavaScript/etc. files in htdocs will get served up as requested.

When using an API command that has more than one word, use a question mark to separate the first and second words, then a space for the rest.


Returning data to the webpage using Lua and stream:write

To execute a FS command from a web page and display the result in the webpage use:

Using webapi with curl


show channels, text output
curl -s -S -G -X GET \
      --user login:password  \
      --data-urlencode "channels" \
5d2ae508-ab6b-11ea-88cb-311ce82e049e,inbound,2020-06-10 18:40:20,1591828820,sofia/internal/1019@,CS_EXECUTE,1019,1019,,55,echo,,XML,default,PCMU,8000,64000,PCMU,8000,64000,,hostname.local,1019@,,1019,ACTIVE,,,,,,,1019,1019,,55,XML,default

1 total.

show channels, xml output
curl -s -S -G -X GET \
      --user login:password  \
      --data-urlencode "channels as xml" \
<result row_count="1">
  <row row_id="1">
    <created>2020-06-10 18:40:20</created>

show channels, json output
curl -s -S -G -X GET \
      --user login:password  \
      --data-urlencode "channels as json" \
      '' | jq
  "row_count": 1,
  "rows": [
      "uuid": "5d2ae508-ab6b-11ea-88cb-311ce82e049e",
      "direction": "inbound",
      "created": "2020-06-10 18:40:20",
      "created_epoch": "1591828820",
      "name": "sofia/internal/1019@",
      "state": "CS_EXECUTE",
      "cid_name": "1019",
      "cid_num": "1019",
      "ip_addr": "",
      "dest": "55",
      "application": "echo",
      "application_data": "",
      "dialplan": "XML",
      "context": "default",
      "read_codec": "PCMU",
      "read_rate": "8000",
      "read_bit_rate": "64000",
      "write_codec": "PCMU",
      "write_rate": "8000",
      "write_bit_rate": "64000",
      "secure": "",
      "hostname": "hostname.local",
      "presence_id": "1019@",
      "presence_data": "",
      "accountcode": "1019",
      "callstate": "ACTIVE",
      "callee_name": "",
      "callee_num": "",
      "callee_direction": "",
      "call_uuid": "",
      "sent_callee_name": "",
      "sent_callee_num": "",
      "initial_cid_name": "1019",
      "initial_cid_num": "1019",
      "initial_ip_addr": "",
      "initial_dest": "55",
      "initial_dialplan": "XML",
      "initial_context": "default"

curl -s -S -G -X GET \
      --user login:password   \
      --data-urlencode "<uuid> record_sample_rate 8000" \
start stream rtmp
curl -s -S -G -X GET \
      --user login:password   \
      --data-urlencode "<uuid> start rtmp://domain.local/stream:teststream" \

use uuid_buglist
curl -s -S -G -X GET \
      --user login:password   \
      --data-urlencode "<uuid>" \

Initiate call with silence in channel
curl -s -S -G -X GET \
       --user login:password \
       --data-urlencode "{origination_caller_id_number={number from}}sofia/{profile}/sip:{user}@{domain} silence XML play" \
  <context name="play">
	<extension name="play-silence_stream" continue="true">
      <condition field="destination_number" expression="^silence$">
        <action application="answer"/>
        <action application="endless_playback" data="silence_stream://-1"/>
Start stream media in the channel
curl -s -S -G -X GET \
      --user login:password  \
      --data-urlencode "{uuid} {/path/to/file/file} both" \
Pause/resume stream in the channel
curl -s -S -G -X GET \
      --user login:password  \
      --data-urlencode "{uuid} pause" \

See also

  • No labels