<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
tt
        {mso-style-priority:99;
        font-family:"Courier New";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal style='margin-left:.5in'><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] <b>On Behalf Of </b>Kevin Larsen<br><b>Sent:</b> Tuesday, June 2, 2015 5:12 PM<br><b>To:</b> Asterisk Users Mailing List - Non-Commercial Discussion<br><b>Subject:</b> Re: [asterisk-users] Forward loop protection...<o:p></o:p></span></p><p class=MsoNormal style='margin-left:.5in'><o:p> </o:p></p><p class=MsoNormal style='margin-left:.5in'><tt><span style='font-size:10.0pt'>>> The loop checking is a bit more challenging than that. If Bob </span></tt><span style='font-size:10.0pt;font-family:"Courier New"'><br><tt>>> forwards to Fred and Fred forwards to Sue, all is well when Bob and </tt><br><tt>>> Fred head out for a beer. A little later, we’re in deep doo-do0 when</tt><br><tt>>> Sue forwards to Bob. </tt></span><br><br><tt><span style='font-size:10.0pt'>> Could this possibly mean that any person who has CF set should never</span></tt><span style='font-size:10.0pt;font-family:"Courier New"'><br><tt>> be available as CF Destination. Simple db entry/check can have this done.</tt></span> <br><br><tt><span style='font-size:10.0pt'>That just goes to show that the problem can get complex pretty quickly. Using the original example above, it might be that you want to allow the Bob to Fred to Sue forwards, but only stop it if the Sue to Bob link is established, thus creating the loop. I wonder if you could do some kind of recursive check where you follow each forward and if you ever come back around to a number you have already checked you know there is a loop.</span></tt> <br><br><tt><span style='font-size:10.0pt'>To reuse the example above, on the creation of the Bob to Fred forward, the database is checked to see if Fred has any forwards. He doesn't, so is at the end of the forwarding chain. Now Fred forwards to Sue. Again, she is at the end of the chain, so it is allowed. When Sue goes to forward to Bob, the check shows that Bob has a forward. Not a problem, but we create a temporary list that has Sue's number in it. Then we check the next stage of forwarding. Bob forwards to Fred. Fred's is checked against our temporary list and doesn't match, so we are still good. Bob's number is now added to the temporary list and we check the forward Fred has in place. Fred forward's to Sue. We check Sue's number against the temporary list and it does exist. Thus we have a loop detected and the forward can now be denied.</span></tt> <br><br><tt><span style='font-size:10.0pt'>I am guessing with the recursion involved you might want to do the check outside of Asterisk and pass the result back in. I will also state that I have not had to do this deep checking in the past, so these are just some initial thoughts on how I would start approaching the problem. Of course, this also assumes that Bob, Fred, and Sue are all on the same phone system. If you don't have a shared database to look at, the problem just got harder indeed.</span></tt> <o:p></o:p></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Classic Centrex forwarding required that the target party answer or that call forwarding is forced by repeating the attempt. If calls were provisionally forwarded and an attempt was made to complete a call from the forwarding party to the target, it wouldn’t be too challenging to see if the forwarded call ends up at the initiating extension. This would be effective even if there were multiple phone systems involved (if caller ID wasn’t messed with).<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>  --Don<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p></div></body></html>