[asterisk-dev] Hangup channel

Rafael Seste rseste at gmail.com
Fri Aug 7 13:26:12 CDT 2009


On Fri, Aug 7, 2009 at 11:37 AM, Russell Bryant<russell at digium.com> wrote:
> Tilghman Lesher wrote:
>> On Thursday 06 August 2009 16:28:52 Rafael Seste wrote:
>>> Hi all!
>>>
>>> I'm trying to solve some bugs on asterisk channel that I found on the
>>> internet, it is the chan_usbb2k. It is a channel to work with a
>>> usb-fxs adpater
>>> I know that it is not part of asterisk but I need some help on how
>>> asterisk handle channels.
>>>
>>> This channel is not hanging  up when I on-hook the phone (fxs). The
>>> channel stays busy for ever.
>>>
>>> How can I hangup this channel when it on-hook the phone???
>>> I know when it on-hooks I just need to know how to inform asterisk
>>> that the channel hanged up.
>>>
>>> thanks in advance
>>
>> Have you considered emailing the author of that 3rd party channel driver?  He
>> or she may not be aware of this issue and may help you figure out where the
>> problem lies.  This is the same as us:  we can't fix a problem until somebody
>> lets us know that it's occurring.
>>

I emailed him but he did not answered yet.

>
> However, to answer the question directly, you should call
> ast_queue_hangup() on the associated ast_channel structure.
>
The channel call this function but it is not hanging up
This code is based on chan_alsa.
Here is the function:

static int usbb2k_hangup(void)
{
	int res = RESULT_SUCCESS;
	stop_sound();
	ast_mutex_lock(&usbb3g_lock);
	if (!chan_yealink.owner /*&& !hookstate*/) {
		res = RESULT_FAILURE;
		usbb2k_setmode(USB_MODE);
		HANGUP_PSTN(chan);
		UNJOIN_PSTN(chan);
		hookstate = 0;
	} else {
		hookstate = 0;
		grab_owner();
		if (chan_yealink.owner) {
			grab_owner();
			ast_queue_hangup(chan_yealink.owner);
			ast_channel_unlock(chan_yealink.owner);
		}
		ast_verbose(VERBOSE_PREFIX_2 "USBB2K USB hangup properly\n");
		usbb2k_setmode(USB_MODE);
		HANGUP_PSTN(chan);
		UNJOIN_PSTN(chan);
	}
	ast_mutex_unlock(&usbb3g_lock);
	return res;
}

Is there another way to do this or is there something wrong with this
function???


> --
> Russell Bryant
> Digium, Inc. | Engineering Manager, Open Source Software
> 445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
> Check us out at: www.digium.com & www.asterisk.org
>
> _______________________________________________
> --Bandwidth and Colocation Provided by http://www.api-digital.com--
>
> AstriCon 2009 - October 13 - 15 Phoenix, Arizona
> Register Now: http://www.astricon.net
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-dev
>



-- 
Rafael S. Seste



More information about the asterisk-dev mailing list