OpenWSN implements CoAP-18 (https://datatracker.ietf.org/doc/draft-ietf-core-coap/):

Below is the state machine implemented in the Python CoAP module.