[OpenSIPS-Devel] [OpenSIPS/opensips] bb1fcc: $route variable: Add support for script "callback ...

Liviu Chircu noreply at github.com
Tue Dec 21 13:43:02 UTC 2021

  Branch: refs/heads/master
  Home:   https://github.com/OpenSIPS/opensips
  Commit: bb1fcc27e279e3021537d197e97bee900fbbae37
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2021-12-21 (Tue, 21 Dec 2021)

  Changed paths:
    M action.c
    M action.h
    M pvar.c
    M route.c

  Log Message:
  $route variable: Add support for script "callback routes"

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

More information about the Devel mailing list