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

Marc Haisenko haisenko at comdasys.com
Wed Nov 23 06:38:48 MST 2005


Hi folks,
I'm currently developing an application for Asterisk and have a hard time with 
what seems to be a simple problem: hanging up a SIP channel I've created.

My application is a "forking dial", which I base on app_conference (I've 
renamed my application app_fdial but of course left all copyright notices in 
place ;-). It should act like this:
1. an UA (source) calls Asterisk with my application (app_fdial)
2. app_fdial picks up
3. app_fdial calls first destination
4. source and destination should now be able to talk to each other
5. when a certain event happens app_fdial calls a second destination
6. for a short period of time (a few seconds) both destinations will be mixed, 
so in effect we have a conference with three participants
7. the first destination is hung up
8. steps 5 to 7 may repeat, switching the first and second destination of 
course

I should add that only SIP is involved and that I currently use Asterisk 
1.2.0-rc1 for testing this (1.0.5 behaved the same).



Now on to my problem:

To call a destination, a spawn a new thread (through ast_pthread_create) which 
uses ast_request_and_dial to call the destination. If it picks up, 
ast_request_and_dial returns a channel which is in AST_STATE_UP (this is 
checked and logged). But if I call ast_softhangup on that channel no BYE SIP 
message is ever sent, though the application notices that the channel went 
down.

I tried to debug this and for some reason sip_hangup is not called on the 
channel I've created. Calling ast_softhangup on the original (source) channel 
works as expected, the BYE is sent, but calling it on channels I've created 
doesn't seem to work.

When I set chan->hangupcause and call ast_hangup the application (and 
Asterisk) crashes (in some mutex function, it seems), but the BYE is sent ;-)

I guess I probably don't understand how to properly create/handle a channel. 
Could someone explain how I should handle such a channel ? Or have I hit a 
bug ? :-)

Thanks a lot,
	Marc
-- 
Marc Haisenko
Linux Solutions
Be O.K. service group GmbH

Rüdesheimer Straße 7
D-80686 München
Tel:   +49 (0)89 - 548 43 33 21
Fax:   +49 (0)89 - 548 43 33 29
e-mail: haisenko at be-ok.com
http://www.be-ok.com

-- 
Marc Haisenko
Comdasys AG

Rüdesheimer Straße 7
D-80686 München
Tel:   +49 (0)89 - 548 43 33 0
Fax:   +49 (0)89 - 548 43 33 29
e-mail: haisenko at comdasys.com
http://www.comdasys.com



More information about the asterisk-dev mailing list