// Setup, connection handling, etc.
b := bytes.NewBufferString("event json DTMF\n")
b.WriteTo(conn)
// Some other code and then this runs in a goroutine for us
for {
msg, err := conn.ReadMessage()
// For JSON events this ends up being ""
msgType := msg.GetHeader("Content-Type")
switch msgType {
case "text/disconnect-notice":
done <- true
case "text/event-plain":
// assuming "event plain DTMF" is sent instead of JSON this will trigger
case "text/event-json":
// This will never trigger
}
//This is my current hack
if eventName, ok := msg.Headers["Event-Name"]; ok {
switch eventName {
case "DTMF":
logger.Errorf("DTMF: %s", msg.Headers["DTMF-Digit"])
}
}
}
Our current version of gesl:
revision = "1cd1251c682b6645e93bdc58ba48de5ed75fbd48"
version = "1.0"
Sample code:
Our current version of gesl: revision = "1cd1251c682b6645e93bdc58ba48de5ed75fbd48" version = "1.0"