-
Notifications
You must be signed in to change notification settings - Fork 564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Dialog callbacks corrupting route stack and AVPs #2681
Comments
Here is a paste of OpenSIPS logs showing the issue: https://pastebin.com/nnarxseg It appears the dlg_on_hangup callback may be invoked twice and on the second invocation the test AVP I am printing has been cleared. |
Thank you for the nice report, @bcnewlin! It is very possible that the I will attempt to reproduce the bug(s) based on your instructions, then come up with a fix. |
@liviuchircu Thank you for the quick response. To be honest, I am less concerned with the route stack issue and more concerned with the disappearance of my AVPs after the callback. |
@bogdan-iancu I am not trying to access the AVPs from within the dialog route, except to print it in the trace I provided for clarity. The issue is that AVPs that are set in message processing before the dialog route is called are not all available after. I could be wrong, but I don't think it should be expected that using the dialog routes would cause AVPs to be removed from the transaction that is triggering them? |
So, what you are saying that the while being in the request route, for the BYE request, you have one set of AVPs before the |
Well not necessarily a different set, but at least some of the AVPs are not present after the |
I tested setting a new AVP right before the call to th_match and it did retain its value after the script resumed, which is why I said only some AVPs are disappearing. I don't know what the difference is between the two. The |
As an update, I've been able to work around this by switching back to events and using the new I do still think this issue warrants attention and I'm happy to reproduce or provide any more information needed. |
@bcnewlin , in regards to the issue with the AVPs, could you try the following patch:
|
@bogdan-iancu Unfortunately, using this patch results in a segfault.
Backtrace: https://pastebin.com/X2AvmLtD |
ups, a missing, but important init of a variable, this this new patch:
|
I have verified that with this patch applied:
I believe these all align with the intended design. |
@bogdan-iancu The route stack is still not correct after returning from the dialog callback. It would be a nice enhancement to fix that, but I will defer to you on whether you would like to keep this ticket open to track that or not. It is not of high importance to us at this time. |
@bcnewlin , you mean the |
Yes, the route stack after script execution resumes from the dialog route does not include any routes called prior to the dialog route. |
Any updates here? No progress has been made in the last 15 days, marking as stale. Will close this issue if no further updates are made in the next 30 days. |
@bcnewlin I was able to reproduce the route stack bug, thank you for the info! A fix should be available soon. |
@bcnewlin please don't test this patch right away, as I just realized I forgot to turn on |
The idea of "callback routes" was missed during the development of $route, with this feature having been first introduced in 3.1. Conceptually, a "callback route" is a contextless route that may be invoked in a nested fashion, during the processing of a SIP message in any of the routes. For example, on a SIP BYE: 1. route 1.1 loose_route() (this triggers the "callback route", e.g. see dlg_on_hangup()) 1.2 route "dlg_on_hangup" is run, contextless! 2. script processing continues! <--- here, $route output was broken This patch fixes the issue, by adding recursion detection into the run_top_route() function, such that the $route variable works as expected regardless of how many (nested) times it is called. Many thanks to Ben Newlin for catching this issue, as well as providing a detailed report! Fixes #2681 (cherry picked from commit bb1fcc2)
OK, now it's fully fixed and backported to |
@liviuchircu Thank you! |
OpenSIPS version you are running
Describe the bug
Invoking the registered
dlg_on_hangup
callback is corrupting the route stack trace and dropping some AVP variables.To Reproduce
dlg_on_hangup
callback.Expected behavior
The route stack and AVPs should not be affected by the registered dialog callbacks
Relevant System Logs
OS/environment information
Additional context
The text was updated successfully, but these errors were encountered: