Closed laduchesneau closed 1 year ago
I never like adding func (t *receivable) Respond(p pdu.PDU) error
to both receivable and transceivable. What if OnAllPDU had a return vlaue ?
OnAllPDU func(pdu pdu.PDU) pdu.PDU
And receivable just check if the return pdu wasnt nil.
if t.settings.OnAllPDU != nil {
r := t.settings.OnAllPDU(p)
if r != nil {
t.settings.response(r)
}
return
}
I like this better.
@laduchesneau Yes, I like the second approach too:
if t.settings.OnAllPDU != nil {
r := t.settings.OnAllPDU(p)
if r != nil {
t.settings.response(r)
}
return
}
Return value added to OnAllPDU
, I like this a lot more, code is simpler.
Removed a lot of change from initial commit in PR. When/if it gets merge, recommend squashing all commits.
LGTM. Could you please have a look too @goten4
As propose in #96 and in #107
What: This feature allows the ESME to control PDU response by using a new setting that will handle all PDU. This proposed feature does not interfere with current user behaviour.
Why: Some ESME need to validate incoming PDUs, like DeliverSm and DataSM, before returning a response.
How:
OnAllPDU
setting that lets users choose how to handle PDUs from SMSCOnPDU
Warning: This setting, if set, overrides
OnPDU
and bypass all auto response feature, Enquirelink and Unbind request must be handled by user.Added a new example called
transcceiver_with_manual_response
to see how it can be used, moved old example intransceiver_with_auto_response
.