[Asterisk-Dev] Problem with hanging up a SIP channel

imran ahmed codentest at gmail.com
Wed Nov 23 10:44:39 MST 2005


I think I forgot to add this:
You are not allowed to call ast_hangup from within an application on a
channel you havent created.
But if the channel was created inside the application such as app_dial
then it should be hungup inside app_dial using ast_hangup and not
ast_softhangup. ast_softhangup is only suitable to hangup a channel
asynchronously from some other thread (which infact doesnt hangup the
channel but only sets up a flag that the channel needs to be hungup),
and ultimately ast_hangup has to be called to complete terminate a
channel.

On 11/23/05, imran ahmed <codentest at gmail.com> wrote:
> I have seen in app_dial.c and even in pbx.c that ast_hangup is called
> after the channel is done with. app_dial.c calls ast_hangup only on
> those channels that are not in the dialplan and those in the dialplan
> are hungup by the ast_hangup call in __ast_pbx_run() call in pbx.c
> I also see that the channels hangup routine itself is called in
> ast_hangup and If what you say is true then this would be turn to a
> recursive call.
> Please correct me!
> Thanks
> Imran
>
> On 11/23/05, Tilghman Lesher <tilghman at mail.jeffandtilghman.com> wrote:
> > On Wednesday 23 November 2005 10:45, imran ahmed wrote:
> > > You need to use ast_hangup on channels that are not in the dialplan.
> > > May be you are holding the channel lock before calling ast_hangup in
> > > this case.
> >
> > ast_hangup() should only ever be called by a channel driver on its own
> > channel (and even then, only in the channel's hangup routine).  For all
> > other cases, you need to request the hangup via ast_softhangup() and
> > let the channel process the hangup when it is ready.
> >
> > --
> > Tilghman
> > _______________________________________________
> > Asterisk-Dev mailing list
> > Asterisk-Dev at lists.digium.com
> > http://lists.digium.com/mailman/listinfo/asterisk-dev
> > To UNSUBSCRIBE or update options visit:
> >   http://lists.digium.com/mailman/listinfo/asterisk-dev
> >
>



More information about the asterisk-dev mailing list