fix: reject CMPP daily limit synchronously
This commit is contained in:
@@ -61,6 +61,7 @@ type submitResponseMessage struct {
|
||||
|
||||
type submitResponse struct {
|
||||
Accepted bool `json:"accepted"`
|
||||
Result uint32 `json:"result,omitempty"`
|
||||
MessageID string `json:"messageId"`
|
||||
Messages []submitResponseMessage `json:"messages,omitempty"`
|
||||
}
|
||||
@@ -316,11 +317,15 @@ func (s Server) handleSubmit(response *cmpp.Response, packet *cmpp.Packet, logge
|
||||
if err != nil {
|
||||
reason = err.Error()
|
||||
}
|
||||
responseResult := result.Result
|
||||
if responseResult == 0 {
|
||||
responseResult = 9
|
||||
}
|
||||
logger.Printf(
|
||||
"cmpp inbound event=submit_rejected protocol=%s packet_type=%s account=%s remote=%s seq=%d phone=%s result=9 stage=business duration_ms=%d content_chars=%d content_hash=%s reason=%q",
|
||||
clientProtocol, req.protocol, account, remote, req.sequenceID, phone, time.Since(startedAt).Milliseconds(), len([]rune(content)), contentHash, reason,
|
||||
"cmpp inbound event=submit_rejected protocol=%s packet_type=%s account=%s remote=%s seq=%d phone=%s result=%d stage=business duration_ms=%d content_chars=%d content_hash=%s reason=%q",
|
||||
clientProtocol, req.protocol, account, remote, req.sequenceID, phone, responseResult, time.Since(startedAt).Milliseconds(), len([]rune(content)), contentHash, reason,
|
||||
)
|
||||
setInboundSubmitResponse(response.Packer, 0, 9)
|
||||
setInboundSubmitResponse(response.Packer, 0, responseResult)
|
||||
return false, nil
|
||||
}
|
||||
gatewayMsgID := messageIDFrom(result.MessageID, req.sequenceID)
|
||||
|
||||
Reference in New Issue
Block a user