Adding tm function t_reply_by_callid #2937
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This is to permit to use opensips as a UAS and "park" incoming calls on it by replying to INVITEs using t_reply(180, "Ringing") or t_reply(183, "Session Progress"). Then later when we get CANCEL or BYE for the INVITE transaction, to be able to send a reply to that transaction (that would be usually a "487 Request Terminated'").
This is based on this discussion:
https://opensips.org/pipermail/users/2022-October/046310.html
(I'm not the OP, I just have a similar use case).
Details
This PR implements new function t_reply_by_callid on module tm.
Basically, I want to act on an INVITE and reply to it with '180 Ringing'
Then, later when the INVITE is cancelled by CANCEL or BYE, I want to be able to reply with '487 Request Terminated' to the original transaction.
The current way to permit this (as discussed in the mailing list thread is):
So the motivation is:
Solution
With t_reply_by_callid, everything can be done by opensips.cfg without need of database or external app/script.
Sample usage: https://pastebin.com/dhKm6TDi
I tested 3 scenarios using sipp:
Functional tests were performed respectively as:
Then I removed the "-m 1" option which limits sipp to generate a single call and the load tests (ongoing) reached millions of calls without issues so far.
Compatibility
There should be no compatibility issues as we don't modify any existing underlying function.
We just create and expose a new function using the code that already exist.