feat: integrate analytics and fragment receipt improvements
This commit is contained in:
@@ -142,8 +142,13 @@ func pushReceiptWithResult(event DownstreamReceipt, allowRecovery bool) (Downstr
|
||||
when = parsed
|
||||
}
|
||||
}
|
||||
// Every inbound CMPP_SUBMIT fragment receives its own SUBMIT_RESP Msg_Id.
|
||||
// Rebuild that exact client Msg_Id from the fragment's original Sequence_Id;
|
||||
// the live session stores only connection state and must not collapse a long
|
||||
// message back to the first fragment's Msg_Id.
|
||||
receiptMessageID := downstreamReceiptMessageID(event, session)
|
||||
receipt := &cmpp.CmppReceiptPkt{
|
||||
MsgId: session.gatewayMsgID,
|
||||
MsgId: receiptMessageID,
|
||||
Stat: stat,
|
||||
SubmitTime: when.Format("0601021504"),
|
||||
DoneTime: when.Format("0601021504"),
|
||||
@@ -154,10 +159,20 @@ func pushReceiptWithResult(event DownstreamReceipt, allowRecovery bool) (Downstr
|
||||
if err != nil {
|
||||
return DownstreamSendResult{}, err
|
||||
}
|
||||
deliver := downstreamDeliverPacket(session, session.gatewayMsgID, session.srcID, defaultString(event.PhoneNumber, session.phoneNumber), 0, 1, string(receiptBytes))
|
||||
deliver := downstreamDeliverPacket(session, receiptMessageID, session.srcID, defaultString(event.PhoneNumber, session.phoneNumber), 0, 1, string(receiptBytes))
|
||||
return sendDownstream(session, deliver, event.DeliveryID)
|
||||
}
|
||||
|
||||
func downstreamReceiptMessageID(event DownstreamReceipt, session *downstreamSession) uint64 {
|
||||
if event.SubmitSequenceID != 0 {
|
||||
return messageIDFrom(defaultString(event.SubmitGroupMessageID, event.MessageID), event.SubmitSequenceID)
|
||||
}
|
||||
if session == nil {
|
||||
return 0
|
||||
}
|
||||
return session.gatewayMsgID
|
||||
}
|
||||
|
||||
func findReceiptSession(messageID string, account string) *downstreamSession {
|
||||
downstreamRegistry.RLock()
|
||||
defer downstreamRegistry.RUnlock()
|
||||
|
||||
Reference in New Issue
Block a user