You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
855 B
Go
46 lines
855 B
Go
3 years ago
|
package icspacketparser
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"strconv"
|
||
|
"strings"
|
||
|
|
||
|
"gitlab.com/cinnamon/voiceagent/icserror"
|
||
|
)
|
||
|
|
||
|
type SDP struct {
|
||
|
Version uint8 // v
|
||
|
Owner string // o
|
||
|
Session string // s
|
||
|
Connection string // c
|
||
|
Timing string // t
|
||
|
Media *[]SDPMedia // m a
|
||
|
}
|
||
|
|
||
|
func (sd *SDP) setSdpStruct(name string, value string) (icserr *icserror.IcsError) {
|
||
|
switch strings.ToUpper(name) {
|
||
|
case "V":
|
||
|
numValue, err := strconv.ParseUint(value, 10, 64)
|
||
|
if err != nil {
|
||
|
return icserror.ICSERRSDPParser
|
||
|
}
|
||
|
sd.Version = uint8(numValue)
|
||
|
return nil
|
||
|
case "O":
|
||
|
sd.Owner = value
|
||
|
return nil
|
||
|
case "S":
|
||
|
sd.Session = value
|
||
|
return nil
|
||
|
case "C":
|
||
|
sd.Connection = value
|
||
|
return nil
|
||
|
case "T":
|
||
|
sd.Timing = value
|
||
|
return nil
|
||
|
default:
|
||
|
fmt.Println("SDP~~~~~~~~~~~~~~~~~whoAU~~~~~~~~~~~~~~~~~")
|
||
|
}
|
||
|
return nil
|
||
|
}
|