Hi, <br><br>Thanks. That was useful. But it is more like calling myself and hence making a loop. <br><br>I was thinking of how Asterisk detects a loop where more than one participants are involved. Also whether for detection of the loop, Asterisk will require to store and receive information from the calling person that all these numbers have been call forwarded to since that will be needed to find out whether or not you are call forwarding to the same person.
<br><br>Thanks<br><br>Regards<br><br>Arpit<br><br><div><span class="gmail_quote">On 4/1/07, <b class="gmail_sendername">Leif Madsen</b> <<a href="mailto:leif.madsen@asteriskdocs.org">leif.madsen@asteriskdocs.org</a>> wrote:
</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">On Sunday 01 April 2007 03:34:53 Arpit Mehta wrote:<br>> I just want to know if Asterisk handles a looping case and where does it
<br>> handle that .<br>><br>> A--> B --> C--> D --> B<br>><br>> If A calls B ,<br>> B call fwds to C ,<br>> C call fwds to D ,<br>> D call fwds to B . Now there is a loop .<br>> How does asterisk prevent this loop? I just to know where (as in which
<br>> module in the Asterisk source code) and how is this prevented (that is if a<br>> data structure of all the numbers that it has call fwded to is passed on to<br>> B,C,D so that it can detect a loop)?<br>>
<br>> Thanks. I hope you understand my scenario. Any suggestions are welcome.<br><br>As far I might understand it, Asterisk would basically parse the Via: headers<br>to determine where the call was coming from, and if it detected a loop,
<br>*should* handle that (this does seem like a loop, and not a spiral).<br><br>I'll have to defer this to the SIP experts and C experts, but basically here<br>is the code that chan_sip.c (at line 13185 of my chan_sip.c file) that checks
<br>for the loop:<br><br> /* Check if this is a loop */<br> if (ast_test_flag(&p->flags[0], SIP_OUTGOING) && p->owner &&<br>(p->owner->_state != AST_STATE_UP)) {<br> /* This is a call to ourself. Send ourselves an error code
<br>and stop<br> processing immediately, as SIP really has no good mechanism<br>for<br> being able to call yourself */<br> /* If pedantic is on, we need to check the tags. If they're
<br>different, this is<br> in fact a forked call through a SIP proxy somewhere. */<br> transmit_response(p, "482 Loop Detected", req);<br> p->invitestate = INV_COMPLETED;
<br> sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);<br> return 0;<br> }<br><br>Leif Madsen.<br></blockquote></div><br><br clear="all"><br>-- <br>Arpit Mehta<br>Graduate Student<br>Department of Computer Science
<br>Columbia University<br><br>Tel: 1-646-387-5998