package icspacketparser import ( "strconv" "strings" "gitlab.com/ics_cinnamon/voicegateway/icserror" ) type SDPMedia struct { MediaDescription string // m Attributes []string // a Payload []string // codec } func (sdm *SDPMedia) setSdpMediaStruct(name string, value string) (icserr *icserror.IcsError) { switch strings.ToUpper(name) { case "M": //fmt.Println(name, value) sdm.MediaDescription = value spaceSplitValue := strings.Split(value, " ") for i, fieldValue := range spaceSplitValue { intValue, err := strconv.Atoi(strings.TrimSpace(fieldValue)) if i >= 3 && err == nil { sdm.Payload = append(sdm.Payload, strconv.Itoa(intValue)) } } // fmt.Println("sdm.Payload >>>>>>>>>>>", sdm.Payload) return nil case "A": sdm.Attributes = append(sdm.Attributes, value) return nil default: //fmt.Println("SDP Media~~~~~~~~~~~~~~~~~whoAU~~~~~~~~~~~~~~~~~") } return nil }