how to get the contact field of the sip message "invite" or "200 ok" in the dialplan xml?

how to get the registering ip address of an endpoint in the dialplan xml (as we have sofia_contact in the command line)?