1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//! 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.
//! ```rust
//! extern crate libsip;
//! extern crate nom;
//!
//! use libsip::parse_message;
//! use nom::error::VerboseError;
//!
//! let packet = "SIP/2.0 200 OK\r\n\r\n";
//! let output = libsip::parse_message::<VerboseError<&[u8]>>(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.
//! ```rust
//! extern crate libsip;
//! extern crate nom;
//!
//! use nom::error::VerboseError;
//! 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::<VerboseError<&[u8]>>("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.
extern crate nom;
extern crate serde;
pub use crate::;