changeset 161:c0a391f28e91

sip-out: handle responses to UAC BYE
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 12 Oct 2022 13:38:40 -0800
parents 4b35a5a400f1
children 83022d408071
files sip-out/uac_resp.c
diffstat 1 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/sip-out/uac_resp.c	Wed Oct 12 13:05:26 2022 -0800
+++ b/sip-out/uac_resp.c	Wed Oct 12 13:38:40 2022 -0800
@@ -20,6 +20,29 @@
 
 extern struct call *find_call_by_sip_id();
 
+extern unsigned sip_linger_bye_out_ok;
+extern unsigned sip_linger_bye_out_err;
+
+void
+handle_bye_response(call, msg, sin)
+	struct call *call;
+	struct sip_pkt_rx *msg;
+	struct sockaddr_in *sin;
+{
+	if (msg->status_code != 200)
+		syslog(LOG_ERR, "non-200 response to BYE: %.64s",
+			msg->status_str);
+	if (msg->status_code < 200)
+		return;
+	if (call->sip_state == SIP_STATE_BYE_SENT) {
+		call->sip_state = SIP_STATE_ENDED;
+		if (msg->status_code <= 299)
+			sip_mark_end_time(call, sip_linger_bye_out_ok);
+		else
+			sip_mark_end_time(call, sip_linger_bye_out_err);
+	}
+}
+
 void
 process_sip_response(msg, sin)
 	struct sip_pkt_rx *msg;