From 31f17abe449c2a9b43ef4e820792fb52d4b27d7a Mon Sep 17 00:00:00 2001 From: Alexei Gradinari Date: Thu, 19 May 2016 15:56:26 -0400 Subject: res_pjsip: add "via_addr", "via_port", "call_id" to contact As res_pjsip_nat rewrites contact's address, only the last Via header can contain the source address of registered endpoint. Also Call-Id header may contain the source address of registered endpoint. Added "via_addr", "via_port", "call_id" to contact. Added new fields ViaAddress, CallID to AMI event ContactStatus. ASTERISK-26011 Change-Id: I36bcc0bf422b3e0623680152d80486aeafe4c576 --- res/res_pjsip/pjsip_options.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'res/res_pjsip/pjsip_options.c') diff --git a/res/res_pjsip/pjsip_options.c b/res/res_pjsip/pjsip_options.c index 62640fe4e..1114336bd 100644 --- a/res/res_pjsip/pjsip_options.c +++ b/res/res_pjsip/pjsip_options.c @@ -1156,6 +1156,16 @@ static int format_contact_status(void *obj, void *arg, int flags) ast_str_append(&buf, 0, "URI: %s\r\n", contact->uri); ast_str_append(&buf, 0, "UserAgent: %s\r\n", contact->user_agent); ast_str_append(&buf, 0, "RegExpire: %ld\r\n", contact->expiration_time.tv_sec); + if (!ast_strlen_zero(contact->via_addr)) { + ast_str_append(&buf, 0, "ViaAddress: %s", contact->via_addr); + if (contact->via_port) { + ast_str_append(&buf, 0, ":%d", contact->via_port); + } + ast_str_append(&buf, 0, "\r\n"); + } + 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, "RoundtripUsec: N/A\r\n"); -- cgit v1.2.3