Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions pkg/sip/media_port.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,15 @@ func (p *MediaPort) disableTimeout() {
}

func (p *MediaPort) enableTimeout(initial, general time.Duration) {
if initial <= 0 || general <= 0 {
p.log.Warnw("attempting to set zero media timeout", nil, "initial", initial, "timeout", general)
if initial <= 0 {
initial = defaultMediaTimeoutInitial
}
if general <= 0 {
general = defaultMediaTimeout
}
}
p.timeoutInitial.Store(&initial)
p.timeoutGeneral.Store(&general)
select {
Expand All @@ -253,10 +262,6 @@ func (p *MediaPort) EnableTimeout(enabled bool) {
}

func (p *MediaPort) SetTimeout(initial, general time.Duration) {
if initial <= 0 {
p.disableTimeout()
return
}
p.enableTimeout(initial, general)
}

Expand Down
6 changes: 6 additions & 0 deletions pkg/sip/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ func NewService(region string, conf *config.Config, mon *stats.Monitor, log logg
if log == nil {
log = logger.GetLogger()
}
if conf.MediaTimeout <= 0 {
conf.MediaTimeout = defaultMediaTimeout
}
if conf.MediaTimeoutInitial <= 0 {
conf.MediaTimeoutInitial = defaultMediaTimeoutInitial
}
s := &Service{
conf: conf,
log: log,
Expand Down