No, I have already checked and that function returns empty value when queried as it is also explained in the manual:
contact - R/O The name of the contact associated with this channel. Use the PJSIP_CONTACT function to obtain further contact related information. Note this may not be present and if so is only available on outgoing legs.
Just to be clear, I am receiving the invite from the phone and I want to check its user agent.