Peter Dunkley writes:
if (parse_contact(msg->contact) < 0) { LM_ERR("parsing Contact: header body\n"); return 0; } contact = ((contact_body_t *)msg->contact->parsed)->contacts;
after the above, have you tried simply contact->reg_id and contact->instance?
-- juha