From 21d5c4a71e377a47f8e9a7a373a5db86792f7b2c Mon Sep 17 00:00:00 2001
From: Francesco Boscarino <francesco@bizmate.it>
Date: Mon, 7 Jan 2019 18:07:25 +0100
Subject: [PATCH] Changed how return value of WaitForDigit is built

---
 agi.go | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/agi.go b/agi.go
index d96b85e..a47c6f3 100644
--- a/agi.go
+++ b/agi.go
@@ -413,5 +413,6 @@ func (a *AGI) Verbose(msg string, level int) error {
 
 // WaitForDigit waits for a DTMF digit and returns what is received
 func (a *AGI) WaitForDigit(timeout time.Duration) (digit string, err error) {
-	return a.Command("WAIT FOR DIGIT", toMSec(timeout)).Val()
+	resp := a.Command("WAIT FOR DIGIT", toMSec(timeout))
+	return string(resp.Result), resp.Error
 }