CyCoreSystems / ari

Golang Asterisk REST Interface (ARI) library
Apache License 2.0
191 stars 73 forks source link

playbeep option remove the record file #156

Closed AyaMagdyMohamed closed 1 year ago

AyaMagdyMohamed commented 1 year ago

Opts := []record.OptionFunc{} Opts = append(Opts, record.IfExists("overwrite"), record.TerminateOn(recordOpt.TerminateOn)) if recordOpt.MaxDuration == 0 { recordOpt.MaxDuration = config.RecordConf.MaxRecordTime }

Opts = append(Opts, record.MaxDuration(time.Duration(time.Second*time.Duration(recordOpt.MaxDuration))))
Opts = append(Opts, record.MaxSilence(time.Duration(time.Second*time.Duration(recordOpt.MaxSilence))))
if recordOpt.Format == "" {
    recordOpt.Format = config.RecordConf.RecordDefaultFormat
}

if recordOpt.Playbeep {
    Opts = append(Opts, record.Beep())
}
recordFileName := uuid.NewString()
Opts = append(Opts, record.Name(recordFileName))

Opts = append(Opts, record.Format(recordOpt.Format))
rs := record.Record(context.Background(), ca.legA, Opts...)
res, _ := rs.Result()
// take uri and store it in s3
uri := res.URI()
uriRes := strings.Split(uri, ":")
fileName := uriRes[1]
fmt.Println("---------fileName---------", fileName)

why when i use playbeep option cannot find the recording file

AyaMagdyMohamed commented 1 year ago

The problem that the peeb sound was not exists in asterisk , so i run this command sudo apt-get install asterisk-core-sounds-en-wav

and it is working fine now