d6956395c8
Rename the whole project from CommGate to gsmnode and re-skin every surface onto the new signal-green + ink design system (Space Grotesk / IBM Plex Sans / JetBrains Mono, flat surfaces, two-arrow routing mark, lowercase gsm+node wordmark). - Web App + API panel: rewrite token layer, gn-* utilities, data-gsm-theme, new logo/favicon assets; both builds verified. - Phone App (Flutter): green theme, new mark/wordmark widgets, adaptive launcher icons; rename Android applicationId/package to app.gsmnode.phone; bump AGP to 8.6.0 and google_fonts to 8.1.0; debug APK build verified. - API Server (Go): panel routes, User-Agent, health service id, branding. - Home Assistant Plugin: rename integration domain sms_gateway to gsmnode (folder, DOMAIN, services, entity ids, classes); py_compile verified. - Update all READMEs; add .gitignore (excludes Design/, build artifacts). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
55 lines
1.4 KiB
Go
55 lines
1.4 KiB
Go
package api
|
|
|
|
import (
|
|
"net/http"
|
|
"strings"
|
|
|
|
"smsgateway/apiserver/internal/pb"
|
|
)
|
|
|
|
type enqueueCallRequest struct {
|
|
PhoneNumber string `json:"phone_number"`
|
|
DeviceID string `json:"device_id"`
|
|
}
|
|
|
|
// handleEnqueueCall queues an outbound phone call for one of the user's devices.
|
|
// A call is stored as a message with type "call"; the device pulls it through
|
|
// the same mobile pipeline as SMS and places the call natively.
|
|
func (s *Server) handleEnqueueCall(w http.ResponseWriter, r *http.Request) {
|
|
uid, _ := userFromCtx(r.Context())
|
|
|
|
var req enqueueCallRequest
|
|
if err := decodeJSON(r, &req); err != nil {
|
|
writeError(w, http.StatusBadRequest, "invalid request body")
|
|
return
|
|
}
|
|
phone := strings.TrimSpace(req.PhoneNumber)
|
|
if phone == "" {
|
|
writeError(w, http.StatusBadRequest, "phone_number is required")
|
|
return
|
|
}
|
|
|
|
deviceRecID, err := s.resolveDevice(r, uid, req.DeviceID)
|
|
if err != nil {
|
|
writeUpstreamError(w, err)
|
|
return
|
|
}
|
|
if deviceRecID == "" {
|
|
writeError(w, http.StatusBadRequest, "no device available; register a device first")
|
|
return
|
|
}
|
|
|
|
rec, err := s.pb.Create(r.Context(), colMessages, pb.Record{
|
|
"phone_numbers": []string{phone},
|
|
"type": msgTypeCall,
|
|
"device": deviceRecID,
|
|
"owner": uid,
|
|
"status": statusPending,
|
|
})
|
|
if err != nil {
|
|
writeUpstreamError(w, err)
|
|
return
|
|
}
|
|
writeJSON(w, http.StatusAccepted, recordToMessage(rec))
|
|
}
|