From 13fcfffcd63a542b351ff1195e903ffc06a77652 Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Fri, 12 Dec 2025 21:53:09 +0000 Subject: [PATCH] Add debugging endpoints for SMS hooks These work, barely, I'm not getting any of the data I wanted to be getting. --- endpoint.go | 17 +++++++++++++++++ main.go | 3 +++ 2 files changed, 20 insertions(+) diff --git a/endpoint.go b/endpoint.go index 4136deb9..397632ba 100644 --- a/endpoint.go +++ b/endpoint.go @@ -2,6 +2,7 @@ package main import ( "errors" + "fmt" "net/http" "strconv" "strings" @@ -177,6 +178,22 @@ func getSource(w http.ResponseWriter, r *http.Request, u *models.User) { htmlSource(w, r, u, globalid) } +func getSMS(w http.ResponseWriter, r *http.Request) { + org := chi.URLParam(r, "org") + + to := r.URL.Query().Get("error") + from := r.URL.Query().Get("error") + message := r.URL.Query().Get("error") + files := r.URL.Query().Get("error") + id := r.URL.Query().Get("error") + date := r.URL.Query().Get("error") + + log.Info().Str("org", org).Str("to", to).Str("from", from).Str("message", message).Str("files", files).Str("id", id).Str("date", date).Msg("Got SMS Message") + w.WriteHeader(http.StatusOK) + w.Header().Set("Content-type", "text/plain") + // Signifies to Voip.ms that the callback worked. + fmt.Fprintf(w, "ok") +} func getVectorTiles(w http.ResponseWriter, r *http.Request, u *models.User) { org_id := chi.URLParam(r, "org_id") tileset_id := chi.URLParam(r, "tileset_id") diff --git a/main.go b/main.go index 81efd47e..f6d1c0e0 100644 --- a/main.go +++ b/main.go @@ -131,6 +131,9 @@ func main() { r.Post("/signin", postSignin) r.Get("/signup", getSignup) r.Post("/signup", postSignup) + r.Get("/sms", getSMS) + r.Get("/sms.php", getSMS) + r.Get("/sms/{org}", getSMS) // Authenticated endpoints r.Method("GET", "/cell/{cell}", NewEnsureAuth(getCellDetails))