forked from sippy/go-b2bua
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sip_user_agent.go
56 lines (45 loc) · 983 Bytes
/
sip_user_agent.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
package sippy_header
import (
"github.com/egovorukhin/go-b2bua/sippy/net"
)
type SipUserAgent struct {
normalName
UserAgent string
}
var sipUserAgent normalName = newNormalName("User-Agent")
func NewSipUserAgent(name string) *SipUserAgent {
return &SipUserAgent{
normalName: sipUserAgent,
UserAgent: name,
}
}
func CreateSipUserAgent(body string) []SipHeader {
return []SipHeader{
&SipUserAgent{
normalName: sipUserAgent,
UserAgent: body,
},
}
}
func (s *SipUserAgent) StringBody() string {
return s.UserAgent
}
func (s *SipUserAgent) String() string {
return s.Name() + ": " + s.UserAgent
}
func (s *SipUserAgent) LocalStr(*sippy_net.HostPort, bool) string {
return s.String()
}
func (s *SipUserAgent) AsSipServer() *SipServer {
if s == nil {
return nil
}
return NewSipServer(s.UserAgent)
}
func (s *SipUserAgent) GetCopy() *SipUserAgent {
tmp := *s
return &tmp
}
func (s *SipUserAgent) GetCopyAsIface() SipHeader {
return s.GetCopy()
}