freeswitch_rs/
lib.rs

1//! Unofficial Rust bindings for [Freeswitch](https://signalwire.com/freeswitch)
2//!
3//! The goal is to provide a safe + ergonomic pit of success for mod authors and connect freeswitch to the wider rust ecosystem.
4//!
5//! To that end, it includes:
6//!
7//! - Bindings for basic freeswitch types via bindgen *_sys crate, type aliased here mostly for
8//!   organisation
9//! - 'New Type' wrappers over freeswitch types to help map ownership and standard marker traits
10//! - Rust friendly mod creation via proc macros that mimic the traditional C SDK.
11//!
12//!
13
14// mods
15mod frame;
16mod modules;
17mod session;
18mod utils;
19
20// rexports
21pub use frame::*;
22
23// Public mods
24pub mod channel;
25pub mod event;
26pub mod fslog;
27
28pub mod types {
29    pub use freeswitch_sys::switch_abc_type_t;
30    pub use freeswitch_sys::switch_api_interface_t;
31    pub use freeswitch_sys::switch_application_interface_t;
32    pub use freeswitch_sys::switch_core_session_t;
33    pub use freeswitch_sys::switch_event_types_t;
34    pub use freeswitch_sys::switch_frame_t;
35    pub use freeswitch_sys::switch_loadable_module_function_table;
36    pub use freeswitch_sys::switch_loadable_module_interface_t;
37    pub use freeswitch_sys::switch_memory_pool_t;
38    pub use freeswitch_sys::switch_module_interface_name_t;
39    pub use freeswitch_sys::switch_status_t;
40    pub use freeswitch_sys::switch_stream_handle_t;
41}
42
43pub mod prelude {
44    pub use crate::modules::*;
45    pub use crate::types::switch_status_t;
46    pub use crate::utils::FSNewType;
47    pub use crate::utils::{FSError, Result};
48
49    // macros
50    pub use freeswitch_rs_macros::switch_api_define;
51    pub use freeswitch_rs_macros::switch_module_define;
52
53    // logging
54    pub use crate::fslog::session_log;
55
56    pub use crate::fslog::SWITCH_CHANNEL_ID_EVENT;
57    pub use crate::fslog::SWITCH_CHANNEL_ID_LOG;
58    pub use crate::fslog::SWITCH_CHANNEL_ID_LOG_CLEAN;
59    pub use crate::fslog::SWITCH_CHANNEL_ID_SESSION;
60
61    pub(crate) use crate::utils::*;
62}
63
64#[doc(hidden)]
65pub use modules::*;
66
67pub mod core {
68    pub use crate::session::*;
69}
70
71#[doc(hidden)]
72pub use log;