What does reinvite do?

I used to have nat=comedia at the peer level, with nothing set at [general] in sip.conf. Then I decide to heed the warnings about extensions becoming discoverable and set nat=comedia under [general] instead.

There is one extension with canreinvite=no, and for this the RTP failed to connect to the end IP of the extension.

What does reinvite do and how does it affect the NAT process? Is the default value yes?

canreinvite is an obsolete alternative name for directmedia.

It controls whether Asterisk will issue a SIP Re-INVITE, to change the media destination to go direct to the other party, rather than through Asterisk. This reduces the load on Asterisk, and the network near to it. It will be ignored if Asterisk needs to monitor the media or RFC 2833/4733 DTMF signalling streams, or if there are no codecs in common between the two sides.

Call recording, listening in, and enabling any DTMF controlled features will normally inhibit the use of direct media.