libpurple/protocols/simple/simple.c

branch
release-2.x.y
changeset 41322
acd1360af5cb
parent 40922
128a40bc6e88
--- a/libpurple/protocols/simple/simple.c	Fri Mar 04 00:08:27 2022 -0600
+++ b/libpurple/protocols/simple/simple.c	Thu Apr 07 22:33:38 2022 -0500
@@ -620,6 +620,11 @@
 	if (cseq) {
 		while(transactions) {
 			trans = transactions->data;
+
+			purple_debug_info("simple",
+			                  "received CSeq %s vs known transaction CSeq %s\n",
+			                  cseq, trans->cseq);
+
 			if(purple_strequal(trans->cseq, cseq)) {
 				return trans;
 			}
@@ -1570,7 +1575,7 @@
 							/* This is encountered when a generic (MESSAGE, NOTIFY, etc)
 							 * was denied until further authorization is provided.
 							 */
-							gchar *resend, *auth;
+							gchar *resend, *auth, *cseq;
 							const gchar *ptmp;
 
 							if(sip->registrar.retries > SIMPLE_REGISTER_RETRY_MAX) return;
@@ -1583,10 +1588,22 @@
 							sipmsg_remove_header(trans->msg, "Authorization");
 							sipmsg_add_header(trans->msg, "Authorization", auth);
 							g_free(auth);
+
+							/* bump cseq */
+							sipmsg_remove_header(trans->msg, "CSeq");
+							sip->cseq++;
+							cseq = g_strdup_printf("%d %s", sip->cseq, trans->msg->method);
+							sipmsg_add_header(trans->msg, "CSeq", cseq);
+							g_free(cseq);
+							trans->cseq = sipmsg_find_header(trans->msg, "CSeq");
+
 							resend = sipmsg_to_string(trans->msg);
 							/* resend request */
 							sendout_pkt(sip->gc, resend);
 							g_free(resend);
+
+							/* exit here - no need to call callback, don't remove trans */
+							return;
 						} else {
 							/* Reset any count of retries that may have
 							 * accumulated in the above branch.

mercurial