forked from percipia/eslgo
-
Notifications
You must be signed in to change notification settings - Fork 2
/
hangup.go
37 lines (32 loc) · 777 Bytes
/
hangup.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
/*
* Copyright (c) 2020 Percipia
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* Contributor(s):
* Andrew Querol <aquerol@percipia.com>
*/
package call
import (
"net/textproto"
"github.com/AkronimBlack/eslgo/command"
)
type Hangup struct {
UUID string
Cause string
Sync bool
SyncPri bool
}
func (h Hangup) BuildMessage() string {
sendMsg := command.SendMessage{
UUID: h.UUID,
Headers: make(textproto.MIMEHeader),
Sync: h.Sync,
SyncPri: h.SyncPri,
}
sendMsg.Headers.Set("call-command", "hangup")
sendMsg.Headers.Set("hangup-cause", h.Cause)
return sendMsg.BuildMessage()
}