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
|
macro_rules! status_enum {
($v:vis enum $name:ident { $($variant:ident = $value:literal),*, }) => {
$v enum $name { $($variant),*, Other(u16) }
impl $name { pub fn from_code(c: u16) -> Self { match c { $($value => Self::$variant),*, x => Self::Other(x) } } }
impl $name { pub fn to_code(&self) -> u16 { match self { $(Self::$variant => $value),*, Self::Other(x) => *x } } }
};
}
status_enum!(
pub enum Status {
Trying = 100,
Ringing = 180,
CallIsBeingForwarded = 181,
Queued = 182,
SessionProgress = 183,
Ok = 200,
MultipleChoices = 300,
MovedPermanently = 301,
MovedTemporarily = 302,
UseProxy = 305,
AlternativeService = 380,
BadRequest = 400,
Unauthorized = 401,
PaymentRequired = 402,
Forbidden = 403,
NotFound = 404,
MethodNotAllowed = 405,
NotAcceptable = 406,
ProxyAuthenticationRequired = 407,
RequestTimeout = 408,
Gone = 410,
RequestEntityTooLarge = 413,
RequestURITooLarge = 414,
UnsupportedMediaType = 415,
UnsupportedURIScheme = 416,
BadExtension = 420,
ExtensionRequired = 421,
IntervalTooBrief = 423,
TemporarilyNotAvailable = 480,
CallLegTransactionDoesNotExist = 481,
LoopDetected = 482,
TooManyHops = 483,
AddressIncomplete = 484,
Ambiguous = 485,
BusyHere = 486,
RequestTerminated = 487,
NotAcceptableHere = 488,
RequestPending = 491,
Undecipherable = 493,
InternalServerError = 500,
NotImplemented = 501,
BadGateway = 502,
ServiceUnavailable = 503,
ServerTimeout = 504,
SIPVersionNotSupported = 505,
MessageTooLarge = 513,
BusyEverywhere = 600,
Decline = 603,
DoesNotExistAnywhere = 604,
GlobalNotAcceptable = 606,
}
);
|