[asterisk-dev] Problem with SDP session id in 200 OK during ReInvite

Michael Maier m1278468 at mailbox.org
Mon Oct 26 12:02:16 CDT 2020


Hello!

I'm facing the problem, that *sometimes* the SDP session ID isn't incremented in the 200 OK, which asterisk sends as answer to a ReInvite it got from the peer (use case: session
timer handling). This leads to broken calls, because the SDP session ID must be incremented if the session description has changed (the session description has changed).

Modifying the SDP session ID is possible in res/res_pjsip/pjsip_message_filter.c / filter_on_tx_message() for SDPs contained in an Invite, which is created and sent by asterisk.
At the moment, I'm already modifying the SDP session ID at this place, because of another problem:

--- asterisk-16.5.0/res/res_pjsip/pjsip_message_filter.c	2019-04-04 16:49:57.000000000 +0200
+++ asterisk-16.5.0/res/res_pjsip/pjsip_message_filter.c	2019-06-18 14:46:57.784000000 +0200
@@ -340,6 +340,23 @@
 			}
 		}

+		/* set new sdp version */
+		ast_debug(5, "increment SDP version, starting from %x\n",sdp->origin.version);
+		time_t sec;
+		time_t cseqt=1;
+		sec = time(NULL);
+		cseq = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_CSEQ, NULL);
+		if (cseq) {
+		    cseqt=cseq->cseq;
+		    }
+		if (sec + cseqt <= sdp->origin.version) {
+		    /* actual time can be same if sdp is generated more often than once a second */
+		    sdp->origin.version = sec + cseqt + (sdp->origin.version - (sec + cseqt)) + 1;
+		    }
+		else {
+		    sdp->origin.version=sec + cseqt;
+		    }
+
 		pjsip_tx_data_invalidate_msg(tdata);
 	}

Maybe it's too late and the processing of the 200 OK doesn't hit this part at all?

Or is there any other possibility to modify the SDP session ID contained in the 200 OK, that is sent by asterisk as an answer to a ReInvite?


Thanks
Michael



More information about the asterisk-dev mailing list