pub struct Session(/* private fields */);Implementations§
Source§impl Session
impl Session
Sourcepub fn locate(id: &CStr) -> Option<LocateGuard>
pub fn locate(id: &CStr) -> Option<LocateGuard>
Locate a session by UUID. See: switch_core_session_perform_locate.
Sourcepub fn remove_media_bug(&self, bug: MediaBugHandle) -> Result<()>
pub fn remove_media_bug(&self, bug: MediaBugHandle) -> Result<()>
Remove a media bug from the session. See: switch_core_media_bug_remove.
Sourcepub fn add_media_bug<F>(
&self,
function: Option<CString>,
target: Option<CString>,
flags: MediaBugFlags,
callback: F,
) -> Result<MediaBugHandle>
pub fn add_media_bug<F>( &self, function: Option<CString>, target: Option<CString>, flags: MediaBugFlags, callback: F, ) -> Result<MediaBugHandle>
Add a media bug to the session. See: switch_core_media_bug_add.
§Examples
use freeswitch_rs::{Session, MediaBugFlags};
use freeswitch_sys::{switch_abc_type_t, switch_media_bug_flag_t};
use std::ffi::CString;
let session = Session::locate("uuid").unwrap();
let handle = session.add_media_bug(
Some(CString::new("my_function").unwrap()),
None,
switch_media_bug_flag_t(switch_media_bug_flag_t::SWITCH_MEDIA_BUG_FLAG_READ),
|bug, abc_type| {
match abc_type {
switch_abc_type_t::SWITCH_ABC_TYPE_INIT => {
// Initialize
}
switch_abc_type_t::SWITCH_ABC_TYPE_READ => {
// Read media
}
switch_abc_type_t::SWITCH_ABC_TYPE_CLOSE => {
// Cleanup
}
_ => {}
}
true
}
).unwrap();Trait Implementations§
Source§impl FSNewType for Session
impl FSNewType for Session
type Inner = *mut switch_core_session
fn from_ptr(ptr: *mut switch_core_session_t) -> Self
fn as_ptr(&self) -> *mut switch_core_session_t
Source§impl SessionExt for Session
impl SessionExt for Session
Source§fn get_uuid(&self) -> &CStr
fn get_uuid(&self) -> &CStr
Retrieve the unique identifier from a session. See:
switch_core_session_get_uuid.Source§fn get_channel(&self) -> Option<Channel<'_>>
fn get_channel(&self) -> Option<Channel<'_>>
Retrieve a reference to the channel object associated with a given session. See:
switch_core_session_get_channel.Auto Trait Implementations§
impl Freeze for Session
impl RefUnwindSafe for Session
impl !Send for Session
impl !Sync for Session
impl Unpin for Session
impl UnwindSafe for Session
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more