FreeSWITCH API 接口文档

FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application

Introduction
Supported Platforms
Freeswitch has been built on the following platforms:

Linux (x86 & x86_64)

Windows (MSVC 2012/2013 & VC++ EE 2012/2013)

Mac OS X 10.7/10.8/10.9 (x86_64 Intel)

FreeBSD 8/9/10

NetBSD 6.x

OpenBSD 5.x

Dependencies
Freeswitch makes heavy use of external libraries.

libFreeSWITCH:

APR (http://apr.apache.org)

APR-Util (http://apr.apache.org)

SQLite (http://www.sqlite.org)

Pcre (http://www.pcre.org/)

SRTP (http://srtp.sourceforge.net/srtp.html)

Additionally, the various external modules make use of several external modules:

ASR/TTS mod_cepstral

Cepstral (commercial) (http://www.cepstral.com/)

mod_flite

Flite (http://www.speech.cs.cmu.edu/flite/)

mod_pocketsphinx

PocketSphinx (http://www.speech.cs.cmu.edu/pocketsphinx/)

mod_unimrcp

MRCP (http://www.unimrcp.org/)

Codecs mod_amr

Passthru codec for amr narrowband (8kHz)

mod_amrwb

Passthru codec for amr wideband (16kHz)

mod_b64

Base64 codec tranfers data base64 encoded (http://www.b64codec.org)

mod_bv

BroadVoice16 (8kHz) and BroadVoice32 (16kHz) (https://www.broadcom.com/support/broadvoice)

mod_codec2

Codec2 is an open source low bit rate speech at 2400 bit/s and below. (http://www.rowetel.com/blog/?page_id=452)

mod_speex

libspeex (http://www.speex.org/)

mod_siren

libg722_1 (http://www.polycom.com/company/about_us/technology/siren22/index.html)

Digital Signal Processing mod_spandsp

codec, fax and modem (http://www.soft-switch.org/)

Directories mod_ldap

openldap (*nix only http://www.openldap.org/)

Endpoints mod_portaudio

portaudio (http://www.portaudio.com/)

mod_dingaling

libdingaling (internal library distributed with freeswitch which depends on)

APR (http://apr.apache.org)

iksemel (http://iksemel.jabberstudio.org/)

mod_sofia

sofia-sip (http://opensource.nokia.com/projects/sofia-sip/)

mod_opal

libopal (http://www.opalvoip.org)

mod_freetdm

freetdm (http://wiki.freeswitch.org/wiki/FreeTDM)

Event Hanlders mod_xmpp_event

iksemel (http://iksemel.jabberstudio.org/)

Formats mod_sndfile

libsndfile (http://www.mega-nerd.com/libsndfile/)

Languages mod_perl

perl (http://www.perl.org/)

mod_lua

lua (http://www.lua.org)

XML interfaces mod_xml_rpc

xmlrpc-c (http://xmlrpc-c.sourceforge.net/)

mod_xml_curl

libcurl (http://curl.haxx.se/)

Network services mod_http

Abyss (http://www.aprelium.com/)

mod_enum

udns (http://www.corpit.ru/mjt/udns.html)
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
FreeSWITCH提供了Java API,允许Java开发人员在Java应用程序中集成FreeSWITCH的功能。使用Java API,您可以在Java应用程序中实现以下功能: 1. 发起呼叫并进行呼叫控制,如拨号、挂机、保持、转移等。 2. 处理媒体,如播放音频、录制音频、实时音频处理等。 3. 监听事件并做出相应的响应,如处理呼叫事件、媒体事件等。 4. 访问FreeSWITCH的配置文件和状态信息。 在Java应用程序中使用FreeSWITCH Java API需要以下步骤: 1. 下载FreeSWITCH Java API的jar包,并将其添加到Java应用程序的classpath中。 2. 创建FreeSWITCH连接对象,并连接到FreeSWITCH服务器。 3. 创建呼叫对象并发起呼叫。 4. 处理呼叫事件和媒体事件。 5. 断开与FreeSWITCH服务器的连接。 以下是一个使用FreeSWITCH Java API实现呼叫控制和媒体处理的示例代码: ```java import org.freeswitch.esl.client.inbound.Client; import org.freeswitch.esl.client.inbound.InboundConnectionFailure; import org.freeswitch.esl.client.internal.Context; import org.freeswitch.esl.client.internal.IModEslApi.EventFormat; import org.freeswitch.esl.client.transport.message.EslMessage; public class FreeSwitchApiTest { public static void main(String[] args) throws InboundConnectionFailure { Client client = new Client(); client.connect("localhost", 8021, "ClueCon", 10); Context context = new Context(); context.addEvent("CHANNEL_ANSWER CHANNEL_HANGUP_COMPLETE CUSTOM"); client.addEventListener(context); String uuid = client.originate("sofia/internal/1000", "1001", "playback", "/var/lib/freeswitch/sounds/music/8000/suite-espanola-op47-leyenda.wav", "true"); while (true) { EslMessage message = client.getEventChannel().readEvent(EventFormat.PLAIN); if (message == null) { break; } String eventName = message.getEventName(); switch (eventName) { case "CHANNEL_ANSWER": System.out.println("Channel answered, UUID: " + message.getEventHeaders().get("Unique-ID")); break; case "CHANNEL_HANGUP_COMPLETE": System.out.println("Channel hangup, UUID: " + message.getEventHeaders().get("Unique-ID")); break; case "CUSTOM": String customEventName = message.getEventHeaders().get("Event-Subclass"); System.out.println("Custom event received, name: " + customEventName); break; default: break; } } client.close(); } } ``` 这个例子中,我们使用FreeSWITCH Java API发起了一个呼叫,播放了一个音频文件,并处理了呼叫事件和自定义事件。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ai语音机器人

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值