changeset 162:83022d408071

sip-out: handle responses to UAC CANCEL
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 12 Oct 2022 13:44:16 -0800
parents c0a391f28e91
children bfa9f0c0f0ac
files sip-out/uac_resp.c
diffstat 1 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/sip-out/uac_resp.c	Wed Oct 12 13:38:40 2022 -0800
+++ b/sip-out/uac_resp.c	Wed Oct 12 13:44:16 2022 -0800
@@ -20,6 +20,7 @@
 
 extern struct call *find_call_by_sip_id();
 
+extern unsigned sip_linger_timeout;
 extern unsigned sip_linger_bye_out_ok;
 extern unsigned sip_linger_bye_out_err;
 
@@ -44,6 +45,26 @@
 }
 
 void
+handle_cancel_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 CANCEL: %.64s",
+			msg->status_str);
+	if (msg->status_code < 200)
+		return;
+	if (call->sip_state == SIP_STATE_CANCEL_SENT) {
+		call->sip_state = SIP_STATE_ACCEPT_200;
+		if (msg->status_code <= 299)
+			sip_mark_end_time(call, sip_linger_timeout);
+		else
+			sip_mark_end_time(call, sip_linger_bye_out_err);
+	}
+}
+
+void
 process_sip_response(msg, sin)
 	struct sip_pkt_rx *msg;
 	struct sockaddr_in *sin;