Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
dwilkie committed Mar 27, 2024
1 parent 0cbcfb1 commit 3adc0d0
Show file tree
Hide file tree
Showing 3 changed files with 407 additions and 8 deletions.
10 changes: 7 additions & 3 deletions components/freeswitch_event_logger/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ func customEventHandler(ctx context.Context, rdb *redis.Client, eventStr string)
}

eventPayload := make(map[string]any)
err := json.Unmarshal([]byte(eventMap["Event-Payload"]), &eventPayload)
if err != nil {
parsePayloadError := json.Unmarshal([]byte(eventMap["Event-Payload"]), &eventPayload)
if parsePayloadError != nil {
fmt.Println("Failed to parse Event Payload: " + eventMap["Event-Payload"])
return
}
Expand All @@ -57,7 +57,11 @@ func customEventHandler(ctx context.Context, rdb *redis.Client, eventStr string)
}

fmt.Println("Publishing Event:" + eventMap["Event-Payload"])
rdb.Publish(ctx, modTwilioStreamPrefix+":"+streamSid, eventPayload)
redisChannel := modTwilioStreamPrefix + ":" + streamSid
redisError := rdb.Publish(ctx, redisChannel, eventMap["Event-Payload"]).Err()
if redisError != nil {
fmt.Println("Problem publishing to Redis channel: " + redisChannel + " Payload: " + eventMap["Event-Payload"] + " Error: " + redisError.Error())
}
}

func fibDuration(durationUnit, maxDuration time.Duration) func() time.Duration {
Expand Down
Loading

0 comments on commit 3adc0d0

Please sign in to comment.