mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-08-19 05:03:55 +00:00
move MustCompile regex out of constructor
This commit is contained in:
@@ -27,6 +27,8 @@ type SipDTMFResponse struct {
|
||||
Digits string
|
||||
}
|
||||
|
||||
var validDTMFRegex = regexp.MustCompile(`^[0-9*#A-Da-d]+$`)
|
||||
|
||||
func (srdc *SipResponseDTMFCreate) Process(ctx context.Context, wrappedPayload common.WrappedPayload) (common.WrappedPayload, error) {
|
||||
|
||||
templateData := wrappedPayload
|
||||
@@ -103,7 +105,7 @@ func init() {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &SipResponseDTMFCreate{config: config, Digits: digitsTemplate, PreWait: int(preWaitNum), PostWait: int(postWaitNum), validDTMF: regexp.MustCompile(`^[0-9*#A-Da-d]+$`)}, nil
|
||||
return &SipResponseDTMFCreate{config: config, Digits: digitsTemplate, PreWait: int(preWaitNum), PostWait: int(postWaitNum), validDTMF: validDTMFRegex}, nil
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user