In the method `acquire_spi`, the condition of acquiring and releasing is not aligned. It seems the lock would be acquired but released only when `spi_data->spi_val == initial_val`, Would it lead to missing lock release? https://github.com/kamailio/kamailio/blob/1ddc27f199061025a6a43da3e8a1388fca... https://github.com/kamailio/kamailio/blob/1ddc27f199061025a6a43da3e8a1388fca...
In the method `release_spi`, the lock may be re-acquired so missing lock release in the method `acquire_spi` could lead to a deadlock. https://github.com/kamailio/kamailio/blob/1ddc27f199061025a6a43da3e8a1388fca...
I suggest you made a pull request with the changes you consider to fix the issues, then we can review easier and merge if all ok. Otherwise, there are not many developers working on IMS extensions these days, therefore making the PR should be faster than waiting for someone else to look at it.
Closed #2939.
Just for reference, this seems to be not needed after discussion in the linked pull request.