[−][src]Crate libsip
libsip has three basic components a parser and managers.
Managers are utility struct's meant to ease one specifc asspect of the sip protocol, the only manager currently implemented is for endpoint registration.
Parsing
libsip exposes many parsing function though only one parse_message
is needed.
extern crate libsip; use libsip::parse_message; let packet = "SIP/2.0 200 OK\r\n\r\n"; let output = libsip::parse_message(packet.as_ref()).unwrap();
Creating Messages
This crate provides 2 abstraction's to aid in building sip messages.
The ResponseGenerator
is used to create sip response's and the
RequestGenerator
is used to generate sip requests.
extern crate libsip; use libsip::ResponseGenerator; use libsip::RequestGenerator; use libsip::Method; use libsip::uri::parse_uri; let _res = ResponseGenerator::new() .code(200) .build() .unwrap(); let uri = parse_uri("sip:1@0.0.0.0:5060;transport=UDP".as_ref()).unwrap().1; let _req = RequestGenerator::new() .method(Method::Invite) .uri(uri) .build() .unwrap();
Registration
The registration manager is used to generate REGISTER requests. Once
that is sent to the server you must wait for the Challange response pass
it to the set_challenge
method of the RegistrationManager.
reqpeatedly calling the get_request
method will cause the c_nonce
counter to be incremented and a new hash computed.
Re-exports
pub use crate::core::Method; |
pub use crate::core::Version; |
pub use crate::headers::Header; |
pub use crate::headers::Headers; |
pub use crate::uri::Domain; |
pub use crate::uri::Uri; |
pub use crate::core::message::parse_message; |
pub use crate::core::SipMessage; |
pub use crate::request::RequestGenerator; |
pub use crate::response::ResponseGenerator; |
Modules
client | |
core | |
headers | |
request | |
response | |
uri |
Macros
domain | Generate a URI domain from an domain name. |
ip_domain | Generate a URI domain from an ip address. |
named_header | Generate |
uri_auth | Generate a URI authentication from credentials. |