it came to my mind that if sip ua runs on the same host as sip proxy (which is very common in test environments at least) then it seem that is_first_hop does not work for replies.
it may not be a good idea to introduce this function for replies if it has such a hole.
-- juha