Asterisk 18.17.0 and 20.2.0 were released recently with support for PJSIP 2.13. This version of PJSIP includes an important change to deal with race conditions on subscription termination (see this link for more info.) This caused us to have to rework some things in res_pjsip. The long version is spelled out in detail here.
Working this out included a few bumps along the way but these are things we can learn from to make the future process better.
The initial merge attempt for PJSIP 2.13 came from the community. When this or any patch is submitted, it runs through the Asterisk Testsuite by our CI process. Because the Testsuite includes testing to make sure a subscription can be established and terminated, it was found pretty quickly that additional work was needed.
Unfortunately, the work that is required would almost certainly not be backwards compatible with previous versions of PJSIP. This means automake has to be able to detect which version of PJSIP Asterisk is being compiled against and build accordingly. These changes were rounded into an initial merge, but there were still issues. Ones that did not get picked up by the test suite.
The first was that under some conditions, PJSIP was still looking for a NOTIFY message to be sent and would assert if it did not. This was not always appropriate and so required a patch from PJProject. The community was crucial in helping us find this issue and in showing that the patch resolved the issue.
Unfortunately, there were still issues where subscriptions were not removed on termination. The initial attempt at handling the change in PJSIP relied on the change in call order from PJSIP, moving the subscription cleanup to the refresh callback. This caused further issues, mostly leaking subscriptions. Again, the community was key in helping us find this issue and the result was a much smaller, better code change. This change resulted in point releases on each of the released branches.
And as we try to do with new issues as they are discovered, a test has been added to the Asterisk Testsuite to walk through the different subscription termination scenarios making sure that they all execute properly, cleaning the subscriptions. So if we run into a similar situation in the future, CI will pick it up immediately.
Thank you for being committed to this process and helping to make Asterisk and the Testsuite stronger!