How to stop a channel by Asterisk CLI?

How to stop a channel by Asterisk CLI? Which command can manage it?

CLI>soft hangup
“soft hangup: Request a hangup on a given channel”

While we on this topic. Soft hangup does hang up the channel the next time it is read or written to but I would like to know if anybody is aware of a way to force a channel to be destroyed except to do a restart of Asterisk. (those orphan channels that occurs sometimes and never gets written or read again once they are in that stage)

The command named “soft hangup” seems to be used for stopping zap channel (but I can not affirm it ). Then how to stop a sip channel ?

In addition :
" Usage: soft hangup " -----> what parameter is need for “” ?

Thanks in advance!

your channel name, see example below:
poluxCLI> show channels
Channel Location State Application(Data)
0 active channels
0 active calls
– Executing Dial(“SIP/10-0819b800”, “SIP/13”) in new stack
– Called 13
– SIP/13-081a2600 is ringing
– SIP/13-081a2600 answered SIP/10-0819b800
– Attempting native bridge of SIP/10-0819b800 and SIP/13-081a2600
polux
CLI> show channels
Channel Location State Application(Data)
SIP/13-081a2600 (None) Up Bridged Call(SIP/10-0819b800)
SIP/10-0819b800 13@polycom:1 Up Dial(SIP/13)
2 active channels
1 active call (SIP/10 is talking with SIP/13)
poluxCLI> soft hangup SIP/10-0819b800 (cause i want to hangup SIP/10)
Requested Hangup on channel 'SIP/10-0819b800’es
polux
CLI> show channels
Channel Location State Application(Data)
0 active channels
0 active calls (boom, channels disapears)
polux*CLI>

I’m also facing this problem atleast 5 channels in a day goes to this state and not able to hangup from any command and i end up in stopping (stop now) and starting asterisk.

Any idea why this happens and any fixes for it?

what you are looking for is: “channel request hangup SIP/…”

cheers

If Asterisk fails to hangup a channel properly it is probably unwise to do anything with that channel as there is a good chance that something could try and use it after you really get rid of it, resulting in a crash. That is why you won’t find a way of cleaning up channels that fail to hangup completely.