Skip to content

Commit 31cf29f

Browse files
committed
New AGI method IsHungup
1 parent ad0bc7d commit 31cf29f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

agi.go

+5
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ func (agi *AGI) EnvArgs() []string {
9797
return agi.arg
9898
}
9999

100+
// IsHungup returns true if AGI channel recieved HANGUP signal
101+
func (agi *AGI) IsHungup() bool {
102+
return agi.isHUP
103+
}
104+
100105
func (agi *AGI) sessionInit() ([]string, error) {
101106
agi.dbg("[>] sessionInit")
102107
buf := bufio.NewReader(agi.reader)

agi_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ func TestReadResponseWithHangup(t *testing.T) {
146146
assert.Nil(t, err)
147147
assert.Equal(t, "200 result=1\n", res)
148148
assert.Equal(t, codeSucc, code)
149-
assert.True(t, agi.isHUP)
149+
assert.True(t, agi.IsHungup())
150150
}
151151

152152
func TestReadResponseLongError520(t *testing.T) {
@@ -164,7 +164,7 @@ func TestReadResponseLongError520(t *testing.T) {
164164
assert.Nil(t, err)
165165
assert.Equal(t, input[7:], res)
166166
assert.Equal(t, codeE520, code)
167-
assert.True(t, agi.isHUP)
167+
assert.True(t, agi.IsHungup())
168168
}
169169

170170
func TestReadResponseGarbage(t *testing.T) {

0 commit comments

Comments
 (0)