[Asterisk-code-review] Change in asterisk[master]: Detect potential forwarding loops based on count.

Matt Jordan (Code Review) asteriskteam at digium.com
Fri Apr 17 15:58:07 CDT 2015


Hello Joshua Colp,

I'd like you to reexamine a change.  Please visit

    https://gerrit.asterisk.org/117

to look at the new patch set (#5).

Change subject: Detect potential forwarding loops based on count.
......................................................................

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
---
M apps/app_dial.c
M apps/app_followme.c
M apps/app_queue.c
M funcs/func_channel.c
M include/asterisk/global_datastores.h
A include/asterisk/max_forwards.h
M main/ccss.c
M main/channel.c
M main/dial.c
M main/features.c
M main/global_datastores.c
A main/max_forwards.c
M res/res_pjsip_diversion.c
13 files changed, 335 insertions(+), 244 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/17/117/5
-- 
To view, visit https://gerrit.asterisk.org/117
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ia7e4b7cd3bccfbd34d9a859838356931bba56c23
Gerrit-PatchSet: 5
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>



More information about the asterisk-code-review mailing list