diff sip-in/retrans.c @ 109:9b87894704eb

sip-in: first step toward final call clearing
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 28 Sep 2022 16:32:13 -0800
parents 0d6435808bcd
children c1c94b7fc2e2
line wrap: on
line diff
--- a/sip-in/retrans.c	Wed Sep 28 14:29:10 2022 -0800
+++ b/sip-in/retrans.c	Wed Sep 28 16:32:13 2022 -0800
@@ -5,6 +5,7 @@
 
 #include <sys/types.h>
 #include <sys/socket.h>
+#include <sys/time.h>
 #include <netinet/in.h>
 #include <stdio.h>
 #include <stdint.h>
@@ -17,6 +18,7 @@
 #include "call.h"
 
 extern unsigned cfg_retrans_count;
+extern unsigned sip_linger_error;
 extern struct call *call_list;
 
 void
@@ -66,16 +68,20 @@
 				out_msg_finish(&msg);
 				sip_tx_packet(&msg, &call->udp_sin);
 				call->sip_tx_count++;
-			} else
+			} else {
 				call->sip_state = SIP_STATE_ENDED;
+				sip_mark_end_time(call, sip_linger_error);
+			}
 			break;
 		case SIP_STATE_BYE_SENT:
 			if (call->sip_tx_count < cfg_retrans_count) {
 				fill_bye_out_msg(&msg, call);
 				sip_tx_packet(&msg, &call->udp_sin);
 				call->sip_tx_count++;
-			} else
+			} else {
 				call->sip_state = SIP_STATE_ENDED;
+				sip_mark_end_time(call, sip_linger_error);
+			}
 			break;
 		}
 	}