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

Matt Jordan (Code Review) asteriskteam at digium.com
Thu Apr 16 06:37:47 CDT 2015


Matt Jordan has uploaded a new patch set (#2).

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.

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/pjsip_global_headers.c
M res/res_pjsip_diversion.c
14 files changed, 345 insertions(+), 245 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/21/121/2
-- 
To view, visit https://gerrit.asterisk.org/121
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ia7e4b7cd3bccfbd34d9a859838356931bba56c23
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-code-review mailing list