@@ -37,14 +37,16 @@ const (
37
37
BufLen = 4096
38
38
SerializePlain = 0
39
39
SerializeJson = 1
40
- FSStatusReply = `UP %d years, %d days, %d hours, %d minutes, %d seconds, %d milliseconds, %d microseconds
40
+ FSApiResponseHeader = `Content-Length: %d
41
+ Content-Type: api/response`
42
+ FSStatusReply = `UP %d years, %d days, %d hours, %d minutes, %d seconds, %d milliseconds, %d microseconds
41
43
FreeSWITCH (Version 1.8.7 git 6047ebd 2019-07-02 20:06:09Z 64bit) is ready
42
44
0 session(s) since startup
43
45
0 session(s) - peak 0, last 5min 0
44
46
0 session(s) per Sec out of max 30, peak 0, last 5min 0
45
47
1000 session(s) max
46
48
min idle cpu 0.00/99.73
47
- Current Stack Size/Max 240K/8192K`
49
+ Current Stack Size/Max 240K/8192K\n\n `
48
50
)
49
51
50
52
type Worker struct {
@@ -175,11 +177,19 @@ func (fs *Worker) processCommand(s string) {
175
177
if args [0 ] == "status" {
176
178
Y , M , D , H , m , sec := diff (time .Now (), fs .startTime )
177
179
reply = fmt .Sprintf (FSStatusReply , Y , M , D , H , m , sec , 0 )
180
+ s := fmt .Sprintf (FSApiResponseHeader , len (reply )+ 1 )
181
+ if _ , err := fs .conn .Write ([]byte (s )); err != nil {
182
+ fs .stop = true
183
+ return
184
+ }
185
+ if _ , err := fs .conn .Write ([]byte (fmt .Sprintf ("%s\n " , reply ))); err != nil {
186
+ fs .stop = true
187
+ return
188
+ }
178
189
} else {
179
- reply = FsErrCommandNotFound
180
- }
181
- if _ , err := fs .conn .Write ([]byte (reply )); err != nil {
182
- fs .stop = true
190
+ if _ , err := fs .conn .Write ([]byte (FsErrCommandNotFound )); err != nil {
191
+ fs .stop = true
192
+ }
183
193
}
184
194
default :
185
195
if _ , err := fs .conn .Write ([]byte (FsErrCommandNotFound )); err != nil {
0 commit comments