libsip/core/
code.rs

1/// Get the response code string for the given SIP response code.
2pub fn error_code_to_str(code: u32) -> Option<&'static str> {
3    match code {
4        100 => Some("Trying"),
5        180 => Some("Ringing"),
6        181 => Some("Call is Being Forwarded"),
7        182 => Some("Queued"),
8        183 => Some("Session Progress"),
9        199 => Some("Early Dialog Terminated"),
10        200 => Some("OK"),
11        202 => Some("Accepted"),
12        204 => Some("No Notification"),
13        300 => Some("Multiple Choices"),
14        301 => Some("Moved Permanently"),
15        302 => Some("Moved Temporarily"),
16        305 => Some("Use Proxy"),
17        380 => Some("Alternative Service"),
18        400 => Some("Bad Request"),
19        401 => Some("Unauthorized"),
20        402 => Some("Payment Required"),
21        403 => Some("Forbidden"),
22        404 => Some("Not Found"),
23        405 => Some("Method Not Allowed"),
24        406 => Some("Not Acceptable"),
25        407 => Some("Proxy Authentication Required"),
26        408 => Some("Request Timeout"),
27        409 => Some("Conflict"),
28        410 => Some("Gone"),
29        411 => Some("Length Required"),
30        412 => Some("Conditional Request Failed"),
31        413 => Some("Request Entity Too Large"),
32        414 => Some("Request-URI Too Long"),
33        415 => Some("Unsupported Media Type"),
34        416 => Some("Unsupported URI Scheme"),
35        417 => Some("Unknown Resource-Priority"),
36        420 => Some("Bad Extension"),
37        421 => Some("Extension Required"),
38        422 => Some("Session Interval Too Small"),
39        423 => Some("Interval Too Brief"),
40        424 => Some("Bad Location Information"),
41        428 => Some("Use Identity Header"),
42        429 => Some("Provide Referrer Identity"),
43        433 => Some("Anonymity Disallowed"),
44        436 => Some("Bad Identity-Info"),
45        437 => Some("Unsupported Certificate"),
46        438 => Some("Invalid Identity Header"),
47        439 => Some("First Hop Lacks Outbound Support"),
48        440 => Some("Max-Breadth Exceeded"),
49        469 => Some("Bad Info Package"),
50        470 => Some("Consent Needed"),
51        480 => Some("Temporarily Unavailable"),
52        481 => Some("Call/Transaction Does Not Exist"),
53        482 => Some("Loop Detected"),
54        483 => Some("Too Many Hops"),
55        484 => Some("Address Incomplete"),
56        485 => Some("Ambiguous"),
57        486 => Some("Busy Here"),
58        487 => Some("Request Terminated"),
59        488 => Some("Not Acceptable Here"),
60        489 => Some("Bad Event"),
61        491 => Some("Request Pending"),
62        493 => Some("Undecipherable"),
63        494 => Some("Security Agreement Required"),
64        500 => Some("Server Internal Error"),
65        501 => Some("Not Implemented"),
66        502 => Some("Bad Gateway"),
67        503 => Some("Service Unavailable"),
68        504 => Some("Server Time-out"),
69        505 => Some("Version Not Supported"),
70        513 => Some("Message Too Large"),
71        580 => Some("Precondition Failure"),
72        600 => Some("Busy Everywhere"),
73        603 => Some("Decline"),
74        604 => Some("Does Not Exist Anywhere"),
75        606 => Some("Not Acceptable"),
76        607 => Some("Unwanted"),
77        _ => None,
78    }
79}