diff --git a/res/res_pjsip/pjsip_options.c b/res/res_pjsip/pjsip_options.c index 6fd3c25757a20bd54fa14240f72a4e869db80035..662166c89b5e4aa5c5e412ebfabf445b19b8590a 100644 --- a/res/res_pjsip/pjsip_options.c +++ b/res/res_pjsip/pjsip_options.c @@ -1250,8 +1250,8 @@ int ast_sip_format_contact_ami(void *obj, void *arg, int flags) if (!ast_strlen_zero(contact->call_id)) { ast_str_append(&buf, 0, "CallID: %s\r\n", contact->call_id); } - ast_str_append(&buf, 0, "Status: %s\r\n", ast_sip_get_contact_status_label(status->status)); - if (status->status == UNKNOWN) { + ast_str_append(&buf, 0, "Status: %s\r\n", ast_sip_get_contact_status_label(status ? status->status : UNKNOWN)); + if (!status || status->status == UNKNOWN) { ast_str_append(&buf, 0, "RoundtripUsec: N/A\r\n"); } else { ast_str_append(&buf, 0, "RoundtripUsec: %" PRId64 "\r\n", status->rtt);