diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 3e4524db66928034b1f2dbdc14adec7b09079623..e7d794532ca491ad6468bf286d1ac88233e45feb 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -18610,11 +18610,12 @@ static void check_pendings(struct sip_pvt *p)
 {
 	if (ast_test_flag(&p->flags[0], SIP_PENDINGBYE)) {
 		/* if we can't BYE, then this is really a pending CANCEL */
-		if (p->invitestate == INV_PROCEEDING || p->invitestate == INV_EARLY_MEDIA)
+		if (p->invitestate == INV_PROCEEDING || p->invitestate == INV_EARLY_MEDIA) {
+			p->invitestate = INV_CANCELLED;
 			transmit_request(p, SIP_CANCEL, p->lastinvite, XMIT_RELIABLE, FALSE);
 			/* Actually don't destroy us yet, wait for the 487 on our original
 			   INVITE, but do set an autodestruct just in case we never get it. */
-		else {
+		} else {
 			/* We have a pending outbound invite, don't send something
 				new in-transaction */
 			if (p->pendinginvite)