hist = requests.get(f"{base}/api/v2/analytics/outbound/campaigns/summary", params=qs)
trend = seasonal_decompose(hist.json())[-1]
requests.put(f"{base}/api/v2/outbound/campaigns/{cid}", json={"callsPerMinute": trend})
``` The time-series decomposition spits out negative rates when intervals stay sparse.
Adjusting the pacing parameters throws a 400 on negative values. The campaign API doesn't accept them. I've tried clamping the output but the forecast drifts off during peak hours anyway. Need a solid way to force consistent granularity on the analytics pull.
import numpy as np
raw_trend = seasonal_decompose(hist.json())[-1]
clamped_trend = np.maximum(raw_trend, 0.0)
payload = {
"callsPerMinute": round(float(clamped_trend), 2)
}
requests.put(f"{base}/api/v2/outbound/campaigns/{cid}", json=payload)
The CALLS_PER_MINUTE parameter inside the OUTBOUND_CAMPAIGN_CONFIG strictly enforces non-negative floats. Sparse intervals cause the decomposition model to dip below zero. The validation layer doesn’t accept negative pacing values. Clamping the array at zero handles the drift. You’ll need to apply the floor before constructing the JSON body. The FLOW_CONFIGURATION routing logic also ignores negative pacing metrics anyway. Setting a baseline prevents the payload rejection. The server-side checks run on every PUT request. Just filter the negatives out. The endpoint expects clean floats. The gateway drops anything below zero without logging a trace.
Cause: The decomposition model treats sparse intervals like a failed ICE candidate exchange, dropping below zero just like a malformed SDP negotiation in RFC 3264.
Solution: Clamp the output at zero using np.maximum() before the PUT request, exactly as the workaround above shows, and you’ll bypass the 400. The API rejects negative pacing the same way an SBC drops a broken s= line.
SIP/2.0 400 Bad Request
Content-Type: application/json
