|
|
|
package sipasm
|
|
|
|
|
|
|
|
type ICSSIP_METHOD_TYPE uint
|
|
|
|
type ICSSIP_HEADER_TYPE uint
|
|
|
|
type ICSSIP_STATUSCODE_TYPE uint
|
|
|
|
|
|
|
|
var ICSSIP_METHOD_STRING map[ICSSIP_METHOD_TYPE]string
|
|
|
|
var ICSSIP_HEADER_STRING map[ICSSIP_HEADER_TYPE]string
|
|
|
|
var ICSSIP_STATUSCODE_STRING map[ICSSIP_STATUSCODE_TYPE]string
|
|
|
|
|
|
|
|
var ICSSIP_HEADER_STRING2TYPE map[string]ICSSIP_HEADER_TYPE
|
|
|
|
|
|
|
|
type ICSSDP_MEDIA_TYPE int
|
|
|
|
|
|
|
|
const (
|
|
|
|
ICSSDP_MEDIA_AUDIO ICSSDP_MEDIA_TYPE = iota
|
|
|
|
ICSSDP_MEDIA_VIDEO
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
ICSSIP_METHOD_REGISTER ICSSIP_METHOD_TYPE = iota
|
|
|
|
ICSSIP_METHOD_ACK
|
|
|
|
ICSSIP_METHOD_INVITE
|
|
|
|
ICSSIP_METHOD_BYE
|
|
|
|
ICSSIP_METHOD_CANCEL
|
|
|
|
ICSSIP_METHOD_INFO
|
|
|
|
ICSSIP_METHOD_PRACK
|
|
|
|
ICSSIP_METHOD_SUBSCRIBE
|
|
|
|
ICSSIP_METHOD_NOTIFY
|
|
|
|
ICSSIP_METHOD_PUBLISH
|
|
|
|
ICSSIP_METHOD_REFER
|
|
|
|
ICSSIP_METHOD_MESSAGE
|
|
|
|
ICSSIP_METHOD_UPDATE
|
|
|
|
ICSSIP_METHOD_OPTIONS
|
|
|
|
ICSSIP_METHOD_SIP20
|
|
|
|
ICSSIP_METHOD_MAX
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
ICSSIP_HEADER_VIA ICSSIP_HEADER_TYPE = iota
|
|
|
|
ICSSIP_HEADER_MAX_FORWARDS
|
|
|
|
ICSSIP_HEADER_FROM
|
|
|
|
ICSSIP_HEADER_TO
|
|
|
|
ICSSIP_HEADER_CALL_ID
|
|
|
|
ICSSIP_HEADER_CSEQ
|
|
|
|
ICSSIP_HEADER_CONTACT
|
|
|
|
ICSSIP_HEADER_XAICALL
|
|
|
|
ICSSIP_HEADER_ACCEPT
|
|
|
|
ICSSIP_HEADER_ACCEPT_ENCODING
|
|
|
|
ICSSIP_HEADER_ACCEPT_LANGUAGE
|
|
|
|
ICSSIP_HEADER_ALERT_INFO
|
|
|
|
ICSSIP_HEADER_ALLOW
|
|
|
|
ICSSIP_HEADER_AUTHENTICATION_INFO
|
|
|
|
ICSSIP_HEADER_AUTHORIZATION
|
|
|
|
ICSSIP_HEADER_CALL_INFO
|
|
|
|
ICSSIP_HEADER_DATE
|
|
|
|
ICSSIP_HEADER_ERROR_INFO
|
|
|
|
ICSSIP_HEADER_EXPIRES
|
|
|
|
ICSSIP_HEADER_IN_REPLY_TO
|
|
|
|
ICSSIP_HEADER_MIN_EXPIRES
|
|
|
|
ICSSIP_HEADER_MIME_VERSION
|
|
|
|
ICSSIP_HEADER_ORGANIZATION
|
|
|
|
ICSSIP_HEADER_PRIORITY
|
|
|
|
ICSSIP_HEADER_PROXY_AUTHENTICATE
|
|
|
|
ICSSIP_HEADER_PROXY_AUTHORIZATION
|
|
|
|
ICSSIP_HEADER_PROXY_REQUIRE
|
|
|
|
ICSSIP_HEADER_RECORD_ROUTE
|
|
|
|
ICSSIP_HEADER_REFER_TO
|
|
|
|
ICSSIP_HEADER_REPLY_TO
|
|
|
|
ICSSIP_HEADER_REQUIRE
|
|
|
|
ICSSIP_HEADER_RETRY_AFTER
|
|
|
|
ICSSIP_HEADER_ROUTE
|
|
|
|
ICSSIP_HEADER_RSEQ
|
|
|
|
ICSSIP_HEADER_RACK
|
|
|
|
ICSSIP_HEADER_SERVER
|
|
|
|
ICSSIP_HEADER_SUBJECT
|
|
|
|
ICSSIP_HEADER_SUPPORTED
|
|
|
|
ICSSIP_HEADER_TIMESTAMP
|
|
|
|
ICSSIP_HEADER_UNSUPPORTED
|
|
|
|
ICSSIP_HEADER_USER_AGENT
|
|
|
|
ICSSIP_HEADER_WARNING
|
|
|
|
ICSSIP_HEADER_WWW_AUTHENTICATE
|
|
|
|
ICSSIP_HEADER_CONTENT_TYPE
|
|
|
|
ICSSIP_HEADER_CONTENT_DISPOSITION
|
|
|
|
ICSSIP_HEADER_CONTENT_ENCODING
|
|
|
|
ICSSIP_HEADER_CONTENT_LANGUAGE
|
|
|
|
ICSSIP_HEADER_CONTENT_LENGTH
|
|
|
|
ICSSIP_HEADER_TERMINATOR
|
|
|
|
ICSSIP_HEADER_NOT_DEFINED
|
|
|
|
ICSSIP_HEADER_MAX
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
ICSSIP_STATUSCODE_100 ICSSIP_STATUSCODE_TYPE = 100
|
|
|
|
ICSSIP_STATUSCODE_180 ICSSIP_STATUSCODE_TYPE = 180
|
|
|
|
ICSSIP_STATUSCODE_181 ICSSIP_STATUSCODE_TYPE = 181
|
|
|
|
ICSSIP_STATUSCODE_182 ICSSIP_STATUSCODE_TYPE = 182
|
|
|
|
ICSSIP_STATUSCODE_183 ICSSIP_STATUSCODE_TYPE = 183
|
|
|
|
ICSSIP_STATUSCODE_200 ICSSIP_STATUSCODE_TYPE = 200
|
|
|
|
ICSSIP_STATUSCODE_300 ICSSIP_STATUSCODE_TYPE = 300
|
|
|
|
ICSSIP_STATUSCODE_301 ICSSIP_STATUSCODE_TYPE = 301
|
|
|
|
ICSSIP_STATUSCODE_302 ICSSIP_STATUSCODE_TYPE = 302
|
|
|
|
ICSSIP_STATUSCODE_305 ICSSIP_STATUSCODE_TYPE = 305
|
|
|
|
ICSSIP_STATUSCODE_380 ICSSIP_STATUSCODE_TYPE = 380
|
|
|
|
ICSSIP_STATUSCODE_400 ICSSIP_STATUSCODE_TYPE = 400
|
|
|
|
ICSSIP_STATUSCODE_401 ICSSIP_STATUSCODE_TYPE = 401
|
|
|
|
ICSSIP_STATUSCODE_402 ICSSIP_STATUSCODE_TYPE = 402
|
|
|
|
ICSSIP_STATUSCODE_403 ICSSIP_STATUSCODE_TYPE = 403
|
|
|
|
ICSSIP_STATUSCODE_404 ICSSIP_STATUSCODE_TYPE = 404
|
|
|
|
ICSSIP_STATUSCODE_405 ICSSIP_STATUSCODE_TYPE = 405
|
|
|
|
ICSSIP_STATUSCODE_406 ICSSIP_STATUSCODE_TYPE = 406
|
|
|
|
ICSSIP_STATUSCODE_407 ICSSIP_STATUSCODE_TYPE = 407
|
|
|
|
ICSSIP_STATUSCODE_408 ICSSIP_STATUSCODE_TYPE = 408
|
|
|
|
ICSSIP_STATUSCODE_410 ICSSIP_STATUSCODE_TYPE = 410
|
|
|
|
ICSSIP_STATUSCODE_413 ICSSIP_STATUSCODE_TYPE = 413
|
|
|
|
ICSSIP_STATUSCODE_414 ICSSIP_STATUSCODE_TYPE = 414
|
|
|
|
ICSSIP_STATUSCODE_415 ICSSIP_STATUSCODE_TYPE = 415
|
|
|
|
ICSSIP_STATUSCODE_416 ICSSIP_STATUSCODE_TYPE = 416
|
|
|
|
ICSSIP_STATUSCODE_420 ICSSIP_STATUSCODE_TYPE = 420
|
|
|
|
ICSSIP_STATUSCODE_421 ICSSIP_STATUSCODE_TYPE = 421
|
|
|
|
ICSSIP_STATUSCODE_423 ICSSIP_STATUSCODE_TYPE = 423
|
|
|
|
ICSSIP_STATUSCODE_480 ICSSIP_STATUSCODE_TYPE = 480
|
|
|
|
ICSSIP_STATUSCODE_481 ICSSIP_STATUSCODE_TYPE = 481
|
|
|
|
ICSSIP_STATUSCODE_482 ICSSIP_STATUSCODE_TYPE = 482
|
|
|
|
ICSSIP_STATUSCODE_483 ICSSIP_STATUSCODE_TYPE = 483
|
|
|
|
ICSSIP_STATUSCODE_484 ICSSIP_STATUSCODE_TYPE = 484
|
|
|
|
ICSSIP_STATUSCODE_485 ICSSIP_STATUSCODE_TYPE = 485
|
|
|
|
ICSSIP_STATUSCODE_486 ICSSIP_STATUSCODE_TYPE = 486
|
|
|
|
ICSSIP_STATUSCODE_487 ICSSIP_STATUSCODE_TYPE = 487
|
|
|
|
ICSSIP_STATUSCODE_488 ICSSIP_STATUSCODE_TYPE = 488
|
|
|
|
ICSSIP_STATUSCODE_491 ICSSIP_STATUSCODE_TYPE = 491
|
|
|
|
ICSSIP_STATUSCODE_493 ICSSIP_STATUSCODE_TYPE = 493
|
|
|
|
ICSSIP_STATUSCODE_500 ICSSIP_STATUSCODE_TYPE = 500
|
|
|
|
ICSSIP_STATUSCODE_501 ICSSIP_STATUSCODE_TYPE = 551
|
|
|
|
ICSSIP_STATUSCODE_502 ICSSIP_STATUSCODE_TYPE = 502
|
|
|
|
ICSSIP_STATUSCODE_503 ICSSIP_STATUSCODE_TYPE = 503
|
|
|
|
ICSSIP_STATUSCODE_504 ICSSIP_STATUSCODE_TYPE = 594
|
|
|
|
ICSSIP_STATUSCODE_505 ICSSIP_STATUSCODE_TYPE = 555
|
|
|
|
ICSSIP_STATUSCODE_513 ICSSIP_STATUSCODE_TYPE = 513
|
|
|
|
ICSSIP_STATUSCODE_600 ICSSIP_STATUSCODE_TYPE = 600
|
|
|
|
ICSSIP_STATUSCODE_603 ICSSIP_STATUSCODE_TYPE = 603
|
|
|
|
ICSSIP_STATUSCODE_604 ICSSIP_STATUSCODE_TYPE = 604
|
|
|
|
ICSSIP_STATUSCODE_606 ICSSIP_STATUSCODE_TYPE = 605
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
//init templetes
|
|
|
|
initMethodString()
|
|
|
|
initHeaderString()
|
|
|
|
initStatusCodeString()
|
|
|
|
}
|
|
|
|
|
|
|
|
func initMethodString() {
|
|
|
|
ICSSIP_METHOD_STRING = make(map[ICSSIP_METHOD_TYPE]string)
|
|
|
|
ICSSIP_METHOD_STRING[ICSSIP_METHOD_REGISTER] = "REGISTER %s\r\n"
|
|
|
|
ICSSIP_METHOD_STRING[ICSSIP_METHOD_ACK] = "ACK %s\r\n"
|
|
|
|
ICSSIP_METHOD_STRING[ICSSIP_METHOD_INVITE] = "INVITE %s\r\n"
|
|
|
|
ICSSIP_METHOD_STRING[ICSSIP_METHOD_BYE] = "BYE %s\r\n"
|
|
|
|
ICSSIP_METHOD_STRING[ICSSIP_METHOD_CANCEL] = "CANCEL %s\r\n"
|
|
|
|
ICSSIP_METHOD_STRING[ICSSIP_METHOD_INFO] = "INFO %s\r\n"
|
|
|
|
ICSSIP_METHOD_STRING[ICSSIP_METHOD_PRACK] = "PRACK %s\r\n"
|
|
|
|
ICSSIP_METHOD_STRING[ICSSIP_METHOD_SUBSCRIBE] = "SUBSCRIBE %s\r\n"
|
|
|
|
ICSSIP_METHOD_STRING[ICSSIP_METHOD_NOTIFY] = "NOTIFY %s\r\n"
|
|
|
|
ICSSIP_METHOD_STRING[ICSSIP_METHOD_PUBLISH] = "PUBLISH %s\r\n"
|
|
|
|
ICSSIP_METHOD_STRING[ICSSIP_METHOD_REFER] = "REFER %s\r\n"
|
|
|
|
ICSSIP_METHOD_STRING[ICSSIP_METHOD_MESSAGE] = "MESSAGE %s\r\n"
|
|
|
|
ICSSIP_METHOD_STRING[ICSSIP_METHOD_UPDATE] = "UPDATE %s\r\n"
|
|
|
|
ICSSIP_METHOD_STRING[ICSSIP_METHOD_OPTIONS] = "OPTIONS %s\r\n"
|
|
|
|
ICSSIP_METHOD_STRING[ICSSIP_METHOD_SIP20] = "SIP/2.0 %s\r\n"
|
|
|
|
}
|
|
|
|
|
|
|
|
func initHeaderString() {
|
|
|
|
ICSSIP_HEADER_STRING = make(map[ICSSIP_HEADER_TYPE]string)
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_ACCEPT] = "Accept: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_ACCEPT_ENCODING] = "Accept-Encoding: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_ACCEPT_LANGUAGE] = "Accept-Language: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_ALERT_INFO] = "Alert-Info: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_ALLOW] = "Allow: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_AUTHENTICATION_INFO] = "Authentication-Info: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_AUTHORIZATION] = "Authorization: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_CALL_ID] = "Call-ID: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_CALL_INFO] = "Call-Info: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_CONTACT] = "Contact: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_XAICALL] = "X-AICALL: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_CONTENT_DISPOSITION] = "Content-Disposition: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_CONTENT_ENCODING] = "Content-Encoding: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_CONTENT_LANGUAGE] = "Content-Language: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_CONTENT_LENGTH] = "Content-Length: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_CONTENT_TYPE] = "Content-Type: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_CSEQ] = "CSeq: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_DATE] = "Date: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_ERROR_INFO] = "Error-Info: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_EXPIRES] = "Expires: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_FROM] = "From: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_IN_REPLY_TO] = "In-Reply-To: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_MAX_FORWARDS] = "Max-Forwards: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_MIN_EXPIRES] = "Min-Expires: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_MIME_VERSION] = "Mime-Version: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_ORGANIZATION] = "Organization: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_PRIORITY] = "Priority: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_PROXY_AUTHENTICATE] = "Proxy-Authenticate: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_PROXY_AUTHORIZATION] = "Proxy-Authorization: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_PROXY_REQUIRE] = "Proxy-Require: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_RECORD_ROUTE] = "Record-Route: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_REPLY_TO] = "Reply-To: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_REFER_TO] = "Refer-To: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_REQUIRE] = "Require: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_RETRY_AFTER] = "Retry-After: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_ROUTE] = "Route: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_RACK] = "RAck: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_RSEQ] = "RSeq: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_SERVER] = "Server: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_SUBJECT] = "Subject: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_SUPPORTED] = "Supported: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_TIMESTAMP] = "Timestamp: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_TO] = "To: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_UNSUPPORTED] = "Unsupported: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_USER_AGENT] = "User-Agent: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_VIA] = "Via: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_WARNING] = "Warning: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_WWW_AUTHENTICATE] = "WWW-Authenticate: %s\r\n"
|
|
|
|
ICSSIP_HEADER_STRING[ICSSIP_HEADER_TERMINATOR] = "\r\n"
|
|
|
|
|
|
|
|
ICSSIP_HEADER_STRING2TYPE = make(map[string]ICSSIP_HEADER_TYPE)
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["ACCEPT"] = ICSSIP_HEADER_ACCEPT
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["ACCEPT-ENCODING"] = ICSSIP_HEADER_ACCEPT_ENCODING
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["ACCEPT-LANGUAGE"] = ICSSIP_HEADER_ACCEPT_LANGUAGE
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["ALERT-INFO"] = ICSSIP_HEADER_ALERT_INFO
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["ALLOW"] = ICSSIP_HEADER_ALLOW
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["AUTHENTICATION-INFO"] = ICSSIP_HEADER_AUTHENTICATION_INFO
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["AUTHORIZATION"] = ICSSIP_HEADER_AUTHORIZATION
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["CALL-ID"] = ICSSIP_HEADER_CALL_ID
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["CALL-INFO"] = ICSSIP_HEADER_CALL_INFO
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["CONTACT"] = ICSSIP_HEADER_CONTACT
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["XAICALL"] = ICSSIP_HEADER_XAICALL
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["CONTENT-DISPOSITION"] = ICSSIP_HEADER_CONTENT_DISPOSITION
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["CONTENT-ENCODING"] = ICSSIP_HEADER_CONTENT_ENCODING
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["CONTENT-LANGUAGE"] = ICSSIP_HEADER_CONTENT_LANGUAGE
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["CONTENT-LENGTH"] = ICSSIP_HEADER_CONTENT_LENGTH
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["CONTENT-TYPE"] = ICSSIP_HEADER_CONTENT_TYPE
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["CSEQ"] = ICSSIP_HEADER_CSEQ
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["DATE"] = ICSSIP_HEADER_DATE
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["ERROR-INFO"] = ICSSIP_HEADER_ERROR_INFO
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["EXPIRES"] = ICSSIP_HEADER_EXPIRES
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["FROM"] = ICSSIP_HEADER_FROM
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["IN-REPLY-TO"] = ICSSIP_HEADER_IN_REPLY_TO
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["MAX-FORWARDS"] = ICSSIP_HEADER_MAX_FORWARDS
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["MIN-EXPIRES"] = ICSSIP_HEADER_MIN_EXPIRES
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["MIME-VERSION"] = ICSSIP_HEADER_MIME_VERSION
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["ORGANIZATION"] = ICSSIP_HEADER_ORGANIZATION
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["PRIORITY"] = ICSSIP_HEADER_PRIORITY
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["PROXY-AUTHENTICATE"] = ICSSIP_HEADER_PROXY_AUTHENTICATE
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["PROXY-AUTHORIZATION"] = ICSSIP_HEADER_PROXY_AUTHORIZATION
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["PROXY-REQUIRE"] = ICSSIP_HEADER_PROXY_REQUIRE
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["RECORD-ROUTE"] = ICSSIP_HEADER_RECORD_ROUTE
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["REPLY-TO"] = ICSSIP_HEADER_REPLY_TO
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["REQUIRE"] = ICSSIP_HEADER_REQUIRE
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["RETRY-AFTER"] = ICSSIP_HEADER_RETRY_AFTER
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["ROUTE"] = ICSSIP_HEADER_ROUTE
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["RACK"] = ICSSIP_HEADER_RACK
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["RSEQ"] = ICSSIP_HEADER_RSEQ
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["SERVER"] = ICSSIP_HEADER_SERVER
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["SUBJECT"] = ICSSIP_HEADER_SUBJECT
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["SUPPORTED"] = ICSSIP_HEADER_SUPPORTED
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["TIMESTAMP"] = ICSSIP_HEADER_TIMESTAMP
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["TO"] = ICSSIP_HEADER_TO
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["UNSUPPORTED"] = ICSSIP_HEADER_UNSUPPORTED
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["USER-AGENT"] = ICSSIP_HEADER_USER_AGENT
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["VIA"] = ICSSIP_HEADER_VIA
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["WARNING"] = ICSSIP_HEADER_WARNING
|
|
|
|
ICSSIP_HEADER_STRING2TYPE["WWW-AUTHENTICATE"] = ICSSIP_HEADER_WWW_AUTHENTICATE
|
|
|
|
}
|
|
|
|
|
|
|
|
func initStatusCodeString() {
|
|
|
|
ICSSIP_STATUSCODE_STRING = make(map[ICSSIP_STATUSCODE_TYPE]string)
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_100] = "100 Trying"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_180] = "180 Ringing"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_181] = "181 Call Is Being Forwarded"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_182] = "182 Queued"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_183] = "183 Session Progress"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_200] = "200 OK"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_300] = "300 Multiple Choices"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_301] = "301 Moved Permanentily"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_302] = "302 Moved Temporarily"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_305] = "305 Use Proxy"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_380] = "380 Alternative Service"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_400] = "400 Bad Request"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_401] = "401 Unauthorized"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_402] = "402 Payment Required"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_403] = "403 Forbidden"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_404] = "404 Not Found"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_405] = "405 Method Not Allowed"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_406] = "406 Not Acceptable"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_407] = "407 Proxy Authentication Required"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_408] = "408 Request Timeout"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_410] = "410 Gone"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_413] = "413 Request Entity Too Large"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_414] = "414 Request-URI Too Long"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_415] = "415 Unsupported Media Type"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_416] = "416 Unsupported URI Scheme"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_420] = "420 Bad Extension"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_421] = "421 Extension Required"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_423] = "423 Interval Too Brief"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_480] = "480 Temporarily Unavailable"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_481] = "481 Call/Transaction Does Not Exist"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_482] = "482 Loop Detected"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_483] = "483 Too Many Hops"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_484] = "484 Address Incomplete"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_485] = "485 Ambiguous"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_486] = "486 Busy Here"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_487] = "487 Request Terminated"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_488] = "488 Not Acceptable Here"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_491] = "491 Request Pending"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_493] = "493 Undecipherable"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_500] = "500 Server Internal Error"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_501] = "501 Not Implemented"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_502] = "502 Bad Gateway"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_503] = "503 Service Unavailable"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_504] = "504 Server Time-out"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_505] = "505 Version Not Supported"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_513] = "513 Message Too Large"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_600] = "600 Busy Everywhere"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_603] = "603 Decline"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_604] = "604 Does Not Exist Anywhere"
|
|
|
|
ICSSIP_STATUSCODE_STRING[ICSSIP_STATUSCODE_606] = "606 Not Acceptable"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func Init() {
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
ICSSIP_METHOD_REGISTER ICSSIP_METHOD_TYPE = iota
|
|
|
|
ICSSIP_METHOD_ACK
|
|
|
|
ICSSIP_METHOD_INVITE
|
|
|
|
ICSSIP_METHOD_BYE
|
|
|
|
ICSSIP_METHOD_CANCEL
|
|
|
|
ICSSIP_METHOD_INFO
|
|
|
|
ICSSIP_METHOD_PRACK
|
|
|
|
ICSSIP_METHOD_SUBSCRIBE
|
|
|
|
ICSSIP_METHOD_NOTIFY
|
|
|
|
ICSSIP_METHOD_PUBLISH
|
|
|
|
ICSSIP_METHOD_REFER
|
|
|
|
ICSSIP_METHOD_MESSAGE
|
|
|
|
ICSSIP_METHOD_UPDATE
|
|
|
|
ICSSIP_METHOD_OPTIONS
|
|
|
|
ICSSIP_METHOD_SIP20
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
Accept
|
|
|
|
Accept-Encoding
|
|
|
|
Accept-Language
|
|
|
|
Alert-Info
|
|
|
|
Allow
|
|
|
|
Authentication-Info
|
|
|
|
Authorization
|
|
|
|
Call-ID
|
|
|
|
Call-Info
|
|
|
|
Contact
|
|
|
|
Content-Disposition
|
|
|
|
Content-Encoding
|
|
|
|
Content-Language
|
|
|
|
Content-Length
|
|
|
|
Content-Type
|
|
|
|
CSeq
|
|
|
|
Date
|
|
|
|
Error-Info
|
|
|
|
Expires
|
|
|
|
From
|
|
|
|
In-Reply-To
|
|
|
|
Max-Forwards
|
|
|
|
Min-Expires
|
|
|
|
MIME-Version
|
|
|
|
Organization
|
|
|
|
Priority
|
|
|
|
Proxy-Authenticate
|
|
|
|
Proxy-Authorization
|
|
|
|
Proxy-Require
|
|
|
|
Record-Route
|
|
|
|
Reply-To
|
|
|
|
Require
|
|
|
|
Retry-After
|
|
|
|
Route
|
|
|
|
Server
|
|
|
|
Subject
|
|
|
|
Supported
|
|
|
|
Timestamp
|
|
|
|
To
|
|
|
|
Unsupported
|
|
|
|
User-Agent
|
|
|
|
Via
|
|
|
|
Warning
|
|
|
|
WWW-Authenticate
|
|
|
|
|
|
|
|
Accept
|
|
|
|
Accept-Encoding
|
|
|
|
Accept-Language
|
|
|
|
Alert-Info
|
|
|
|
Allow
|
|
|
|
Authentication-Info
|
|
|
|
Authorization
|
|
|
|
Call-ID
|
|
|
|
Call-Info
|
|
|
|
Contact
|
|
|
|
Content-Disposition
|
|
|
|
Content-Encoding
|
|
|
|
Content-Language
|
|
|
|
Content-Length
|
|
|
|
Content-Type
|
|
|
|
CSeq
|
|
|
|
Date
|
|
|
|
Error-Info
|
|
|
|
Expires
|
|
|
|
From
|
|
|
|
In-Reply-To
|
|
|
|
Max-Forwards
|
|
|
|
Min-Expires
|
|
|
|
MIME-Version
|
|
|
|
Organization
|
|
|
|
Priority
|
|
|
|
Proxy-Authenticate
|
|
|
|
Proxy-Authorization
|
|
|
|
Proxy-Require
|
|
|
|
Record-Route
|
|
|
|
Reply-To
|
|
|
|
Require
|
|
|
|
Retry-After
|
|
|
|
Route
|
|
|
|
Server
|
|
|
|
Subject
|
|
|
|
Supported
|
|
|
|
Timestamp
|
|
|
|
To
|
|
|
|
Unsupported
|
|
|
|
User-Agent
|
|
|
|
Via
|
|
|
|
Warning
|
|
|
|
WWW-Authenticate
|
|
|
|
|
|
|
|
*/
|