When is a contact considered unreachable in PJSIP?
The same as chan_sip, when an OPTIONS is sent out and we don’t get a response.
What happens when a call to an unreachable contact is placed, does the Invite still get sent to the IP address known last?
Latest versions match the same behavior as chan_sip, which is to not send the call.
Can that be changed?
No, there is no option or configuration to control that.
The main point in testing for unreachability is to stop time being wasted by waiting for responses from INVITEs that are most probably not going to produce any responses. Don’t test for reachability at all if you intend to ignore unreachable states on outgoing calls.