java调用freeswitch完整例子,FreeSwitch FsClient 客户端

FsClient是一个C#编写的WPF应用,它演示了如何与FreeSwitch进行交互,实现VOIP客户端功能。项目包含Account、Call、Conference等核心类,以及EventSocket模块用于事件监听。FsClient还集成了多种库和插件,如mod_managed、JabraHeadsetPlugin等,提供了完整的FreeSwitch连接和通信示例。
摘要由CSDN通过智能技术生成

【实例简介】

与FreeSwitch 连接的客户端FsClient 源代码,采用C# 的WPF。可以作为 VOIP的客户端使用。

【实例截图】

【核心代码】

3b39bd1e-7d7c-445b-aa64-5fa0b45a12cf

└── FSClient

├── Account.cs

├── app.config

├── App.xaml

├── App.xaml.cs

├── bin

│   └── Debug

│   ├── conf

│   │   ├── freeswitch.serial

│   │   └── freeswitch.xml

│   ├── db

│   │   └── sofia_reg_softphone.db

│   ├── FreeSwitch.dll

│   ├── FreeSWITCH.Managed.dll

│   ├── FreeSwitch - 副本.dll

│   ├── FSClient.exe

│   ├── FSClient.exe.config

│   ├── FSClient.pdb

│   ├── FSClient.vshost.exe

│   ├── FSClient.vshost.exe.config

│   ├── FSClient.vshost.exe.manifest

│   ├── fs_cli.exe

│   ├── libapr.dll

│   ├── libaprutil.dll

│   ├── libbroadvoice.dll

│   ├── libeay32.dll

│   ├── libspandsp.dll

│   ├── libteletone.dll

│   ├── log

│   │   ├── freeswitch.log

│   │   └── freeswitch.xml.fsxml

│   ├── mod

│   │   ├── mod_bv.dll

│   │   ├── mod_celt.dll

│   │   ├── mod_commands.dll

│   │   ├── mod_conference.dll

│   │   ├── mod_console.dll

│   │   ├── mod_dialplan_xml.dll

│   │   ├── mod_dptools.dll

│   │   ├── mod_event_socket.dll

│   │   ├── mod_ilbc.dll

│   │   ├── mod_isac.dll

│   │   ├── mod_local_stream.dll

│   │   ├── mod_logfile.dll

│   │   ├── mod_loopback.dll

Certainly! Here's a basic example of a FreeSWITCH Java demo application that can make a phone call: ```java import org.freeswitch.esl.client.OutboundClient; import org.freeswitch.esl.client.transport.event.EslEvent; import org.freeswitch.esl.client.transport.message.EslMessage; public class FreeSwitchJavaDemo { public static void main(String[] args) { String host = "localhost"; int port = 8021; String password = "ClueCon"; try (OutboundClient client = new OutboundClient()) { client.connect(host, port, password); String destinationNumber = "1000"; String callerIdNumber = "1234"; EslMessage response = client.sendSyncApiCommand( String.format("originate {origination_caller_id_number=%s}sofia/gateway/mygateway/%s &echo", callerIdNumber, destinationNumber) ); if (response.getHeaderValue("Reply-Text").startsWith("+OK")) { System.out.println("Call successfully placed!"); } else { System.out.println("Failed to place the call!"); } // Listen for events client.addEventListener((EslEvent event) -> { // Handle and process events here }); // Wait for some time to receive events Thread.sleep(5000); } catch (Exception ex) { ex.printStackTrace(); } } } ``` In this example, we use the FreeSWITCH ESL (Event Socket Library) Java API to establish a connection with the FreeSWITCH server. We then use the `sendSyncApiCommand` method to send an originate command, which initiates a call from `callerIdNumber` to `destinationNumber`. We also add the `&echo` parameter to have an echo application handle the call. After sending the command, we check the response to see if the call was successfully placed. Additionally, we can add an event listener to handle and process events received from FreeSWITCH. Remember to replace `localhost`, `8021`, `ClueCon`, `1000`, and `1234` with your own FreeSWITCH server details, gateway, and desired phone numbers. This is just a basic example to get you started. You can explore the FreeSWITCH Java API documentation and sample applications for more advanced functionality and customization options.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值