Use pjsip_uri_get_uri on from_hdr->uri field, otherwise you won't handle the case when it is actually "display_name <URI>".