]> git.ipfire.org Git - thirdparty/asterisk.git/commit
Detect potential forwarding loops based on count. 20/220/1
authorMark Michelson <mmichelson@digium.com>
Wed, 15 Apr 2015 15:38:02 +0000 (10:38 -0500)
committerMatt Jordan <mjordan@digium.com>
Wed, 22 Apr 2015 20:01:48 +0000 (15:01 -0500)
commit1bb6122f35dfb5bc86160e67d2aa6c5c779e1795
treec22231af3174f54094ace59fe81d06555c6574d4
parentcb67aae596c8b37b90da20d9d25528109b401b63
Detect potential forwarding loops based on count.

A potential problem that can arise is the following:

* Bob's phone is programmed to automatically forward to Carol.
* Carol's phone is programmed to automatically forward to Bob.
* Alice calls Bob.

If left unchecked, this results in an endless loops of call forwards
that would eventually result in some sort of fiery crash.

Asterisk's method of solving this issue was to track which interfaces
had been dialed. If a destination were dialed a second time, then
the attempt to call that destination would fail since a loop was
detected.

The problem with this method is that call forwarding has evolved. Some
SIP phones allow for a user to manually forward an incoming call to an
ad-hoc destination. This can mean that:

* There are legitimate use cases where a device may be dialed multiple
times, or
* There can be human error when forwarding calls.

This change removes the old method of detecting forwarding loops in
favor of keeping a count of the number of destinations a channel has
dialed on a particular branch of a call. If the number exceeds the
set number of max forwards, then the call fails. This approach has
the following advantages over the old:

* It is much simpler.
* It can detect loops involving local channels.
* It is user configurable.

The only disadvantage it has is that in the case where there is a
legitimate forwarding loop present, it takes longer to detect it.
However, the forwarding loop is still properly detected and the
call is cleaned up as it should be.

Address review feedback on gerrit.

* Correct "mfgium" to "Digium"
* Decrement max forwards by one in the case where allocation of the
  max forwards datastore is required.
* Remove irrelevant code change from pjsip_global_headers.c

ASTERISK-24958 #close

Change-Id: Ia7e4b7cd3bccfbd34d9a859838356931bba56c23
13 files changed:
apps/app_dial.c
apps/app_followme.c
apps/app_queue.c
funcs/func_channel.c
include/asterisk/global_datastores.h
include/asterisk/max_forwards.h [new file with mode: 0644]
main/ccss.c
main/channel.c
main/dial.c
main/features.c
main/global_datastores.c
main/max_forwards.c [new file with mode: 0644]
res/res_pjsip_diversion.c