Skip to content

Commit

Permalink
♻️ refactor: updated asterisk model #9
Browse files Browse the repository at this point in the history
  • Loading branch information
arisnguyen215 committed Dec 13, 2023
1 parent 0597d5b commit 809a127
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 57 deletions.
10 changes: 5 additions & 5 deletions asterisk/asterisk.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ func (t *TelephonyConfig) AppendPhonePrefix(values ...string) *TelephonyConfig {
return t
}

func (t *TelephonyConfig) SetDigitsExten(values []interface{}) *TelephonyConfig {
t.DigitsExten = values
func (t *TelephonyConfig) SetDigitExtensions(values []interface{}) *TelephonyConfig {
t.DigitExtensions = values
return t
}

func (t *TelephonyConfig) AppendDigitExten(values ...interface{}) *TelephonyConfig {
t.DigitsExten = append(t.DigitsExten, values...)
func (t *TelephonyConfig) AppendDigitExtensions(values ...interface{}) *TelephonyConfig {
t.DigitExtensions = append(t.DigitExtensions, values...)
return t
}

Expand Down Expand Up @@ -103,7 +103,7 @@ func GetAsteriskConfigSample() *AsteriskConfig {
a := NewAsteriskConfig()
t := NewTelephonyConfig()
t.SetRegion("VN")
t.AppendDigitExten(4, 5, 6)
t.AppendDigitExtensions(4, 5, 6)
t.AppendPhonePrefix("9", "6064")
a.SetEnabled(true)
a.SetHost("http://127.0.0.1")
Expand Down
8 changes: 4 additions & 4 deletions asterisk/asterisk_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package asterisk
import "time"

type TelephonyConfig struct {
Region string `json:"region" yaml:"region"`
PhonePrefix []string `json:"phone_prefix" yaml:"phone-prefix"`
DigitsExten []interface{} `json:"digits_exten" yaml:"digits-exten"`
Region string `json:"region" yaml:"region"`
PhonePrefix []string `json:"phone_prefix" yaml:"phone_prefix"`
DigitExtensions []interface{} `json:"digit_extensions" yaml:"digit_extensions"`
}

type AsteriskConfig struct {
Expand All @@ -16,7 +16,7 @@ type AsteriskConfig struct {
Username string `json:"username" binding:"required" yaml:"username"`
Password string `json:"-" yaml:"password"`
Telephony TelephonyConfig `json:"telephony" yaml:"telephony"`
Timeout time.Duration `json:"-" yaml:"-"`
Timeout time.Duration `json:"timeout" yaml:"timeout"`
}

type asteriskOptionConfig struct {
Expand Down
32 changes: 16 additions & 16 deletions keys/default_cluster_multi_tenant_conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ clusters:
password: pwd
telephony:
region: VN
phone-prefix:
phone_prefix:
- "9"
- "6064"
digits-exten:
digit_extensions:
- 4
- 5
- 6
Expand Down Expand Up @@ -275,10 +275,10 @@ clusters:
password: pwd
telephony:
region: VN
phone-prefix:
phone_prefix:
- "9"
- "6064"
digits-exten:
digit_extensions:
- 4
- 5
- 6
Expand Down Expand Up @@ -500,10 +500,10 @@ clusters:
password: pwd
telephony:
region: VN
phone-prefix:
phone_prefix:
- "9"
- "6064"
digits-exten:
digit_extensions:
- 4
- 5
- 6
Expand Down Expand Up @@ -764,10 +764,10 @@ clusters:
password: pwd
telephony:
region: VN
phone-prefix:
phone_prefix:
- "9"
- "6064"
digits-exten:
digit_extensions:
- 4
- 5
- 6
Expand Down Expand Up @@ -989,10 +989,10 @@ clusters:
password: pwd
telephony:
region: VN
phone-prefix:
phone_prefix:
- "9"
- "6064"
digits-exten:
digit_extensions:
- 4
- 5
- 6
Expand Down Expand Up @@ -1253,10 +1253,10 @@ clusters:
password: pwd
telephony:
region: VN
phone-prefix:
phone_prefix:
- "9"
- "6064"
digits-exten:
digit_extensions:
- 4
- 5
- 6
Expand Down Expand Up @@ -1478,10 +1478,10 @@ clusters:
password: pwd
telephony:
region: VN
phone-prefix:
phone_prefix:
- "9"
- "6064"
digits-exten:
digit_extensions:
- 4
- 5
- 6
Expand Down Expand Up @@ -1742,10 +1742,10 @@ clusters:
password: pwd
telephony:
region: VN
phone-prefix:
phone_prefix:
- "9"
- "6064"
digits-exten:
digit_extensions:
- 4
- 5
- 6
Expand Down
32 changes: 16 additions & 16 deletions keys/default_cluster_multi_tenant_conf_v1.0.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ clusters:
password: pwd
telephony:
region: VN
phone-prefix:
phone_prefix:
- "9"
- "6064"
digits-exten:
digit_extensions:
- 4
- 5
- 6
Expand Down Expand Up @@ -194,10 +194,10 @@ clusters:
password: pwd
telephony:
region: VN
phone-prefix:
phone_prefix:
- "9"
- "6064"
digits-exten:
digit_extensions:
- 4
- 5
- 6
Expand Down Expand Up @@ -325,10 +325,10 @@ clusters:
password: pwd
telephony:
region: VN
phone-prefix:
phone_prefix:
- "9"
- "6064"
digits-exten:
digit_extensions:
- 4
- 5
- 6
Expand Down Expand Up @@ -508,10 +508,10 @@ clusters:
password: pwd
telephony:
region: VN
phone-prefix:
phone_prefix:
- "9"
- "6064"
digits-exten:
digit_extensions:
- 4
- 5
- 6
Expand Down Expand Up @@ -639,10 +639,10 @@ clusters:
password: pwd
telephony:
region: VN
phone-prefix:
phone_prefix:
- "9"
- "6064"
digits-exten:
digit_extensions:
- 4
- 5
- 6
Expand Down Expand Up @@ -822,10 +822,10 @@ clusters:
password: pwd
telephony:
region: VN
phone-prefix:
phone_prefix:
- "9"
- "6064"
digits-exten:
digit_extensions:
- 4
- 5
- 6
Expand Down Expand Up @@ -953,10 +953,10 @@ clusters:
password: pwd
telephony:
region: VN
phone-prefix:
phone_prefix:
- "9"
- "6064"
digits-exten:
digit_extensions:
- 4
- 5
- 6
Expand Down Expand Up @@ -1136,10 +1136,10 @@ clusters:
password: pwd
telephony:
region: VN
phone-prefix:
phone_prefix:
- "9"
- "6064"
digits-exten:
digit_extensions:
- 4
- 5
- 6
Expand Down
8 changes: 4 additions & 4 deletions keys/default_conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ asterisk:
password: pwd
telephony:
region: VN
phone-prefix:
phone_prefix:
- "9"
- "6064"
digits-exten:
digit_extensions:
- 4
- 5
- 6
Expand Down Expand Up @@ -335,10 +335,10 @@ asterisk-seekers:
password: pwd
telephony:
region: VN
phone-prefix:
phone_prefix:
- "9"
- "6064"
digits-exten:
digit_extensions:
- 4
- 5
- 6
Expand Down
8 changes: 4 additions & 4 deletions keys/default_conf_v1.0.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ asterisk:
password: pwd
telephony:
region: VN
phone-prefix:
phone_prefix:
- "9"
- "6064"
digits-exten:
digit_extensions:
- 4
- 5
- 6
Expand Down Expand Up @@ -246,10 +246,10 @@ asterisk-seekers:
password: pwd
telephony:
region: VN
phone-prefix:
phone_prefix:
- "9"
- "6064"
digits-exten:
digit_extensions:
- 4
- 5
- 6
Expand Down
8 changes: 4 additions & 4 deletions keys/default_multi_tenant_conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ config:
password: pwd
telephony:
region: VN
phone-prefix:
phone_prefix:
- "9"
- "6064"
digits-exten:
digit_extensions:
- 4
- 5
- 6
Expand Down Expand Up @@ -274,10 +274,10 @@ config:
password: pwd
telephony:
region: VN
phone-prefix:
phone_prefix:
- "9"
- "6064"
digits-exten:
digit_extensions:
- 4
- 5
- 6
Expand Down
8 changes: 4 additions & 4 deletions keys/default_multi_tenant_conf_v1.0.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ config:
password: pwd
telephony:
region: VN
phone-prefix:
phone_prefix:
- "9"
- "6064"
digits-exten:
digit_extensions:
- 4
- 5
- 6
Expand Down Expand Up @@ -193,10 +193,10 @@ config:
password: pwd
telephony:
region: VN
phone-prefix:
phone_prefix:
- "9"
- "6064"
digits-exten:
digit_extensions:
- 4
- 5
- 6
Expand Down

0 comments on commit 809a127

Please sign in to comment.