[asterisk-dev] Call Forwarding Detail Needed

Arpit Mehta am2866 at columbia.edu
Sun Apr 1 13:58:47 MST 2007


Hi,

Thanks. That was useful. But it is more like calling myself and hence making
a loop.

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.

Thanks

Regards

Arpit

On 4/1/07, Leif Madsen <leif.madsen at asteriskdocs.org> wrote:
>
> On Sunday 01 April 2007 03:34:53 Arpit Mehta wrote:
> > I just want to know if Asterisk handles a looping case and where does it
> > handle that .
> >
> > A--> B --> C--> D --> B
> >
> > If A calls  B ,
> >   B call fwds to C ,
> >   C call fwds to D ,
> >   D call fwds to B . Now there is a loop .
> > How does asterisk prevent this loop? I just to know where (as in which
> > module in the Asterisk source code) and how is this prevented (that is
> if a
> > data structure of all the numbers that it has call fwded to is passed on
> to
> > B,C,D so that it can detect a loop)?
> >
> > Thanks. I hope you understand my scenario. Any suggestions are welcome.
>
> As far I might understand it, Asterisk would basically parse the Via:
> headers
> to determine where the call was coming from, and if it detected a loop,
> *should* handle that (this does seem like a loop, and not a spiral).
>
> I'll have to defer this to the SIP experts and C experts, but basically
> here
> is the code that chan_sip.c (at line 13185 of my chan_sip.c file) that
> checks
> for the loop:
>
>         /* Check if this is a loop */
>         if (ast_test_flag(&p->flags[0], SIP_OUTGOING) && p->owner &&
> (p->owner->_state != AST_STATE_UP)) {
>                 /* This is a call to ourself.  Send ourselves an error
> code
> and stop
>                 processing immediately, as SIP really has no good
> mechanism
> for
>                 being able to call yourself */
>                 /* If pedantic is on, we need to check the tags. If
> they're
> different, this is
>                 in fact a forked call through a SIP proxy somewhere. */
>                 transmit_response(p, "482 Loop Detected", req);
>                 p->invitestate = INV_COMPLETED;
>                 sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
>                 return 0;
>         }
>
> Leif Madsen.
>



-- 
Arpit Mehta
Graduate Student
Department of Computer Science
Columbia University

Tel: 1-646-387-5998
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-dev/attachments/20070401/d758ea54/attachment-0001.htm


More information about the asterisk-dev mailing list