Webapi

From FreeSWITCH Wiki
Jump to: navigation, search

Contents

Introduction

FreeSWITCH includes a built-in web server that allows you to access data and issue commands. It also allows for the building of browser-based applications, such as the sample voicemail and telecast applications. (See Sample Applications below.)

Requirements

To access the built-in web server you need to have mod_xml_rpc loaded.
To access webmail you need mod_voicemail loaded.
To access the telecast page you need mod_shout loaded.

By default the server listens on port 8080. The authentication parameters are specified in xml_rpc.conf.xml and the listening port can be changed as well.

Sample Applications

Voicemail

Allows user to view his or her voicemails. Log in to web page with same username and password as the phone. The built-in MP3 player only works if the voicemail messages are recorded at 11kHz. Otherwise the user can click to download or play each message.

http://1.2.3.4:8080/webapi/voicemail/web

Telecast

The telecast interface shows a list of calls currently in progress. Links allow the user to click-and-listen in MP3 or M3U (e.g. iTunes) formats.

http://1.2.3.4:8080/webapi/telecast/index

Interfaces

You can use one of three methods to call the web server:

  • webapi - "webbish" way of getting data
  • txtapi - raw text return
  • api - somewhere in between
  • xmlapi - return XML doc instead of HTML

The best way to see the differences between each is to try them with the help command.
Try each of these with your browser. Replace "fs.ip" with your FreeSWITCH IP or host name:

  • http://fs.ip:8080/webapi/help
  • http://fs.ip:8080/api/help
  • http://fs.ip:8080/txtapi/help
  • http://fs.ip:8080/xmlapi/help

webapi

http://1.2.3.4:8080/webapi/command?arg1 arg2 arg3

txtapi

http://1.2.3.4:8080/txtapi/command?arg1 arg2 arg3

api

http://1.2.3.4:8080/api/command?arg1 arg2 arg3

xmlapi

http://1.2.3.4:8080/xmlapi/command?arg1 arg2 arg3

See Also