forked from jart/gosip
-
Notifications
You must be signed in to change notification settings - Fork 1
/
status.go
executable file
·190 lines (180 loc) · 8.75 KB
/
status.go
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
// Copyright 2020 Justine Alexandra Roberts Tunney
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// SIP Protocol Status Definitions
//
// http://www.iana.org/assignments/sip-parameters
package sip
const (
// 1xx: Provisional -- request received, continuing to process the request.
StatusTrying = 100 // Indicates server is not totally pwnd.
StatusRinging = 180 // Remote phone is definitely ringing.
StatusCallIsBeingForwarded = 181
StatusQueued = 182
StatusSessionProgress = 183 // Establish early media (PSTN ringback)
// 2xx: Success -- the action was successfully received, understood,
// and accepted;
StatusOK = 200 // Call is answered
StatusAccepted = 202 // [RFC3265]
StatusNoNotification = 204 // [RFC5839]
// 3xx: Redirection -- further action needs to be taken in order to
// complete the request;
StatusMultipleChoices = 300
StatusMovedPermanently = 301
StatusMovedTemporarily = 302 // Send your call there instead kthx.
StatusUseProxy = 305 // You fool! Send your call there instead.
StatusAlternativeService = 380
// 4xx: Client Error -- the request contains bad syntax or cannot be
// fulfilled at this server;
StatusBadRequest = 400 // Missing headers, bad format, etc.
StatusUnauthorized = 401 // Resend request with auth header.
StatusPaymentRequired = 402 // I am greedy.
StatusForbidden = 403 // gtfo
StatusNotFound = 404 // wat?
StatusMethodNotAllowed = 405 // I don't support that type of request.
StatusNotAcceptable = 406
StatusProxyAuthenticationRequired = 407
StatusRequestTimeout = 408
StatusConflict = 409
StatusGone = 410 // Shaniqua don't live here no more.
StatusLengthRequired = 411
StatusConditionalRequestFailed = 412 // [RFC3903]
StatusRequestEntityTooLarge = 413
StatusRequestURITooLong = 414
StatusUnsupportedMediaType = 415
StatusUnsupportedURIScheme = 416
StatusUnknownResourcePriority = 417
StatusBadExtension = 420
StatusExtensionRequired = 421
StatusSessionIntervalTooSmall = 422 // [RFC4028]
StatusIntervalTooBrief = 423
StatusUseIdentityHeader = 428 // [RFC4474]
StatusProvideReferrerIdentity = 429 // [RFC3892]
StatusFlowFailed = 430 // [RFC5626]
StatusAnonymityDisallowed = 433 // [RFC5079]
StatusBadIdentityInfo = 436 // [RFC4474]
StatusUnsupportedCertificate = 437 // [RFC4474]
StatusInvalidIdentityHeader = 438 // [RFC4474]
StatusFirstHopLacksOutboundSupport = 439 // [RFC5626]
StatusMaxBreadthExceeded = 440 // [RFC5393]
StatusConsentNeeded = 470 // [RFC5360]
StatusTemporarilyUnavailable = 480 // fast busy or soft fail
StatusCallTransactionDoesNotExist = 481 // Bad news
StatusLoopDetected = 482 // Froot looping
StatusTooManyHops = 483 // Froot looping
StatusAddressIncomplete = 484
StatusAmbiguous = 485
StatusBusyHere = 486
StatusRequestTerminated = 487
StatusNotAcceptableHere = 488
StatusBadEvent = 489 // [RFC3265]
StatusRequestPending = 491
StatusUndecipherable = 493
StatusSecurityAgreementRequired = 494 // [RFC3329]
// 5xx: Server Error -- the server failed to fulfill an apparently
// valid request;
StatusInternalServerError = 500
StatusNotImplemented = 501
StatusBadGateway = 502
StatusServiceUnavailable = 503
StatusGatewayTimeout = 504
StatusVersionNotSupported = 505
StatusMessageTooLarge = 513
StatusPreconditionFailure = 580 // [RFC3312]
// 6xx: Global Failure -- the request cannot be fulfilled at any
// server.
StatusBusyEverywhere = 600
StatusDecline = 603
StatusDoesNotExistAnywhere = 604
StatusNotAcceptable606 = 606
StatusDialogTerminated = 687
)
func Phrase(status int) string {
if phrase, ok := phrases[status]; ok {
return phrase
}
return "Unknown Status Code"
}
var phrases = map[int]string{
StatusTrying: "Trying",
StatusRinging: "Ringing",
StatusCallIsBeingForwarded: "Call Is Being Forwarded",
StatusQueued: "Queued",
StatusSessionProgress: "Session Progress",
StatusOK: "OK",
StatusAccepted: "Accepted",
StatusNoNotification: "No Notification",
StatusMultipleChoices: "Multiple Choices",
StatusMovedPermanently: "Moved Permanently",
StatusMovedTemporarily: "Moved Temporarily",
StatusUseProxy: "Use Proxy",
StatusAlternativeService: "Alternative Service",
StatusBadRequest: "Bad Request",
StatusUnauthorized: "Unauthorized",
StatusPaymentRequired: "Payment Required",
StatusForbidden: "Forbidden",
StatusNotFound: "Not Found",
StatusMethodNotAllowed: "Method Not Allowed",
StatusNotAcceptable: "Not Acceptable",
StatusProxyAuthenticationRequired: "Proxy Authentication Required",
StatusRequestTimeout: "Request Timeout",
StatusConflict: "Conflict",
StatusGone: "Gone",
StatusLengthRequired: "Length Required",
StatusConditionalRequestFailed: "Conditional Request Failed",
StatusRequestEntityTooLarge: "Request Entity Too Large",
StatusRequestURITooLong: "Request-URI Too Long",
StatusUnsupportedMediaType: "Unsupported Media Type",
StatusUnsupportedURIScheme: "Unsupported URI Scheme",
StatusUnknownResourcePriority: "Unknown Resource-Priority",
StatusBadExtension: "Bad Extension",
StatusExtensionRequired: "Extension Required",
StatusSessionIntervalTooSmall: "Session Interval Too Small",
StatusIntervalTooBrief: "Interval Too Brief",
StatusUseIdentityHeader: "Use Identity Header",
StatusProvideReferrerIdentity: "Provide Referrer Identity",
StatusFlowFailed: "Flow Failed",
StatusAnonymityDisallowed: "Anonymity Disallowed",
StatusBadIdentityInfo: "Bad Identity-Info",
StatusUnsupportedCertificate: "Unsupported Certificate",
StatusInvalidIdentityHeader: "Invalid Identity Header",
StatusFirstHopLacksOutboundSupport: "First Hop Lacks Outbound Support",
StatusMaxBreadthExceeded: "Max-Breadth Exceeded",
StatusConsentNeeded: "Consent Needed",
StatusTemporarilyUnavailable: "Temporarily Unavailable",
StatusCallTransactionDoesNotExist: "Call/Transaction Does Not Exist",
StatusLoopDetected: "Loop Detected",
StatusTooManyHops: "Too Many Hops",
StatusAddressIncomplete: "Address StatusIncomplete",
StatusAmbiguous: "Ambiguous",
StatusBusyHere: "Busy Here",
StatusRequestTerminated: "Request Terminated",
StatusNotAcceptableHere: "Not Acceptable Here",
StatusBadEvent: "Bad Event",
StatusRequestPending: "Request Pending",
StatusUndecipherable: "Undecipherable",
StatusSecurityAgreementRequired: "Security Agreement Required",
StatusInternalServerError: "Internal Server Error",
StatusNotImplemented: "Not Implemented",
StatusBadGateway: "Bad Gateway",
StatusServiceUnavailable: "Service Unavailable",
StatusGatewayTimeout: "Gateway Time-out",
StatusVersionNotSupported: "Version Not Supported",
StatusMessageTooLarge: "Message Too Large",
StatusPreconditionFailure: "Precondition Failure",
StatusBusyEverywhere: "Busy Everywhere",
StatusDecline: "Decline",
StatusDoesNotExistAnywhere: "Does Not Exist Anywhere",
StatusNotAcceptable606: "Not Acceptable",
StatusDialogTerminated: "Dialog Terminated",
}