Skip to content

Commit

Permalink
hangup command
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Klaban committed Feb 5, 2025
1 parent 3ae1cfd commit a9a974d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions gsm/gsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type GsmCommand struct {

type GsmSettings struct {
DialCommand string
HangUpCommand string
InitCommands []GsmCommand
Escape string
EscapePause time.Duration
Expand All @@ -41,7 +42,8 @@ type GsmSettings struct {

func DefaultSettings() GsmSettings {
return GsmSettings{
DialCommand: "ATDT",
DialCommand: "ATDT",
HangUpCommand: "ATH",
InitCommands: []GsmCommand{
{Command: "ATH", OkAnswerRex: _ok, BadAnswerRex: _err},
{Command: "ATI", OkAnswerRex: _ok, BadAnswerRex: _err},
Expand Down Expand Up @@ -118,7 +120,7 @@ func (g *gsm) hangup() error {
g.logf("error hanging up (but ignoring): %v", err)
}
for ii := 0; ii < 3; ii++ {
err = g.sendCommand(GsmCommand{Command: "ATH", OkAnswerRex: _ok, BadAnswerRex: _err})
err = g.sendCommand(GsmCommand{Command: g.settings.HangUpCommand, OkAnswerRex: _ok, BadAnswerRex: _err})
if err != nil {
g.logf("error hanging up (but ignoring): %v", err)
} else {
Expand Down

0 comments on commit a9a974d

Please sign in to comment.