Summary: | ASTERISK-03198: [patch] [request] permit softhangup to operate on partial channel name | ||
Reporter: | cherso (cherso) | Labels: | |
Date Opened: | 2005-01-06 13:37:30.000-0600 | Date Closed: | 2008-01-15 15:21:20.000-0600 |
Priority: | Major | Regression? | No |
Status: | Closed/Complete | Components: | Core/General |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) softhangup.patch.txt | |
Description: | softhangup() requires the actual channel name be given (e.g. Zap/1-1) rather than a partial name such (e.g. Zap/1). It would be nice to have an option to be able to match a partial name. dialing Zap/5 asterisk returns -- Zap/5-1 answered SIP/2-9b6e executing a softhangup(zap/5) asterisk does not hangup the channel -- Executing SoftHangup("SIP/1-c552", "Zap/5") in new stack softhangup is usually in the emergency extension so I think it's important | ||
Comments: | By: cherso (cherso) 2005-01-06 13:39:03.000-0600 sorry, I didn't change the severity field :-( By: nick (nick) 2005-01-06 13:58:06.000-0600 When posting bugs, please include your CVS verison! Is this the latest CVS? By: nick (nick) 2005-01-06 14:06:38.000-0600 Uhh... wait a minute. What do you have in your extensions.conf that's calling the soft hangup? Also, a show channels right before its executed would be nice. edited on: 01-06-05 14:10 By: cherso (cherso) 2005-01-06 14:11:45.000-0600 latest cvs 2 hours ago exten => 112,1,softhangup(Zap/5) but I need to use it with capi so exten => 112,1,softhangup(CAPI/${MSN}) the channel will be created like this CAPI/contr1/MSN/1 edited on: 01-06-05 15:46 By: nick (nick) 2005-01-06 16:08:26.000-0600 wolfson confirmed this with a SIP->Zap call. He said he heard a click but no hangup. I was able to hangup a SIP call just fine, so this looks to me like a zap-specific bug. By: cherso (cherso) 2005-01-06 17:12:42.000-0600 zap and capi problem chanisavail cmd is working good on zap edited on: 01-06-05 17:14 By: Clod Patry (junky) 2005-01-06 17:12:49.000-0600 i dont have that problem for SIP->Zap with version: CVS-HEAD-01/06/05-06:53:44 this is my output: *CLI> show channels Channel (Context Extension Pri ) State Appl. Data Zap/1-1 (default s 1 ) Up Bridged Call SIP/101-b01a SIP/101-b01a (test_sip 5015096 1 ) Up Dial Zap/1/5015096 IAX2/66.250.68.194:4569/1 ( s 1 ) Up Bridged Call SIP/101-d965 SIP/101-d965 (test_sip 996 1 ) Up Dial IAX2/guest@66.250.68.194/996 4 active channel(s) *CLI> soft hangup IAX2/66.250.68.194:4569/1 SIP/101-b01a SIP/101-d965 Zap/1-1 *CLI> soft hangup IAX2/66.250.68.194:4569/1 SIP/101-b01a SIP/101-d965 Zap/1-1 *CLI> soft hangup Zap/1-1 Requested Hangup on channel 'Zap/1-1' *CLI> show channels Channel (Context Extension Pri ) State Appl. Data IAX2/66.250.68.194:4569/1 ( s 1 ) Up Bridged Call SIP/101-d965 SIP/101-d965 (test_sip 996 1 ) Up Dial IAX2/guest@66.250.68.194/996 2 active channel(s) *CLI> By: cherso (cherso) 2005-01-06 17:15:47.000-0600 for junky: you have to try a soft hangup zap/1 in the dialplan you can't know the session id of a zap or capi channel so the softhungup() should check the session id of the channel before By: Clod Patry (junky) 2005-01-06 18:05:28.000-0600 I'm not sure to get your point here, could ya paste that part of dialplan please? this is my CLI's output: -- Executing SoftHangup("SIP/102-d6fc", "Zap/1") in new stack -- Executing NoOp("SIP/102-d6fc", "done") in new stack show ch channel channels channeltypes *CLI> show channels Channel (Context Extension Pri ) State Appl. Data SIP/102-d6fc (test_sip 3207 3 ) Ring (None) (None) Zap/1-1 (default s 1 ) Up Bridged Call SIP/101-2023 SIP/101-2023 (test_sip 3206 1 ) Up Dial Zap/1/5015096 3 active channel(s) I've put: exten => 3207,1,SoftHangup(Zap/1); exten => 3207,2,NoOp(done); and my line on Zap/1 wasn't hangup, if it's what you mean. edited on: 01-06-05 18:19 By: Clod Patry (junky) 2005-01-06 18:29:15.000-0600 *CLI> soft hangup Zap/1-1 is called in handle_softhangup in cli.c. and exten => 3207,1,SoftHangup(Zap/1); is calling app_softhangup.c. i'll take a deeper look on this when i'll have time. and -- Executing SoftHangup("SIP/102-7e54", "Zap/1-1") in new stack -- Hungup 'Zap/1-1' with: exten => 3207,1,SoftHangup(Zap/1-1); exten => 3207,2,NoOp(done); i've: -- Executing SoftHangup("SIP/102-7e54", "Zap/1-1") in new stack -- Hungup 'Zap/1-1' -- Executing NoOp("SIP/102-7e54", "done") in new stack == Spawn extension (test_sip, 3206, 1) exited non-zero on 'SIP/101-25cf' show ch channel channels channeltypes *CLI> show channels Channel (Context Extension Pri ) State Appl. Data SIP/102-7e54 (test_sip 3207 3 ) Ring (None) (None) 1 active channel(s) *CLI> so i don't see any bug in here. edited on: 01-06-05 18:31 By: nick (nick) 2005-01-06 18:37:41.000-0600 This looks like a configuration issue (which it looks like the person who confirmed it for me made too)... Zap channels should be hungup like Softhangup(Zap/5-1), not just Zap/5. That's your problem, I think. Please confirm so we can close this out. Thanks to Junky for having sharper eyes the rest of us... By: Clod Patry (junky) 2005-01-06 18:38:07.000-0600 add the -1 after your Zap/5, and it should work. confirm me it works. thanks. By: cherso (cherso) 2005-01-07 04:29:41.000-0600 the softhangup should not include the session id on channel I've reported the problem for the capi channel voip*CLI> show channels Channel (Context Extension Pri ) State Appl. Data CAPI[contr1/0]/3 (default 0 1 ) Dialing AppDial (Outgoing Line) it's a dialplan problem. It's not a cli problem softhangup(CAPI/0) is not working softhangup(CAPI[contr1/0]) is not working I can't use softhangup(CAPI[contr1/0]/3) because the last /3 parameter is a call count parameter, always different so how do you hangup this channel for emergency? well voip*CLI> show channels Channel (Context Extension Pri ) State Appl. Data CAPI[contr1/0]/4 (default 0 1 ) Dialing AppDial (Outgoing Line) SIP/2-119b (macro-capiout s 1 ) Ring Dial in the dialplan you can't softhangup the SIP/2 you have to softhangup(SIP/2-119b) and this is a problem in the extensions.conf edited on: 01-07-05 04:30 By: Clod Patry (junky) 2005-01-07 06:57:03.000-0600 First thing, i never touched to CAPI. So, i'll talk about IAX2,SIP or Zap. Im not sure, tp get your point here. If it's an emergency, can't you just soft hangup chan in the cli? cause in the dialplan, if you have many channels created at the same place, there's is no way to know which one is the correct one. For example: debian*CLI> show channels Channel (Context Extension Pri ) State Appl. Data IAX2/66.250.68.194:4569/3 ( s 1 ) Up Bridged Call SIP/102-95be SIP/102-95be (test_sip 996 1 ) Up Dial IAX2/guest@66.250.68.194/996 IAX2/66.250.68.194:4569/1 ( s 1 ) Up Bridged Call SIP/101-6103 SIP/101-6103 (test_sip 996 1 ) Up Dial IAX2/guest@66.250.68.194/996 4 active channel(s) debian*CLI> SIP/102-95be is bridged to IAX2/66.250.68.194:4569/3 and SIP/101-6103 is to IAX2/66.250.68.194:4569/1. in the dialplan, before a call, how should we know which "session" it will be? It's changing all the time! For emergency (emergency isn't just in a rare case situation?) i would go in the cli and soft hangup the channel. At this moment, i can't do anything for you, so please, maybe, provide us, more details on that problem. Maybe you can get me on IRC from #asterisk-bugs. Thanks. edited on: 01-07-05 06:57 By: cherso (cherso) 2005-01-07 07:28:21.000-0600 junky-> If it's an emergency, can't you just soft hangup chan in the cli? for emergency I mean calling 911, 112 or 113 in italy hard to access the cli from the dialplan to hangup a channel junky-> in the dialplan, before a call, how should we know which "session" it will be? It's changing all the time! chanisvail command is correctly recognising the session of a channel (chanisvail(Zap/1) returns Zap/1-1), so why we can't use the same function to get the full channel name in use (zap/1-1) using the base channel name (Zap/1) to hangup the channel? This should be working for capi channels too edited on: 01-07-05 07:29 By: Clod Patry (junky) 2005-01-07 08:09:26.000-0600 chanisvail(Zap/1) returns Zap/1-1 only if this channel is available right? so if you get Zap/1-1, it's cause this channel isn't active atm, so why do you want to hangup it? I think we're not using ChanIsAvail is the same way. Think if you have many times the same channels, it would be just the "session" which will be different. Please contact me on IRC for more details. By: alric (alric) 2005-01-07 08:45:23.000-0600 Soft hangup is supposed to receive the full resource, as denoted below. Technology/resource is defined as, for example, Zap/1-1, or <Technology>/<Channel>-<Instance> -= Info about application 'SoftHangup' =- [Synopsis]: Soft Hangup Application [Description]: SoftHangup(Technology/resource) Hangs up the requested channel. Always returns 0 So I'm not sure I see a bug here. edited on: 01-07-05 08:48 By: Mark Spencer (markster) 2005-01-07 08:46:30.000-0600 Updating this to "feature request" since clearly the softhangup application is operating as it was intended to, and the user simply wants a way to make it behave differently. By: Clod Patry (junky) 2005-01-07 09:06:20.000-0600 maybe SoftHangup(Technology/chan) instead of (Technology/resource) could be done. But we keep in mind this could hangup many channels at this time. Are we wanting this? not sure. By: cherso (cherso) 2005-01-07 13:02:44.000-0600 so no emergency for capi users By: nick (nick) 2005-01-07 15:08:21.000-0600 Maybe what we're after is a new application... ClearChannel(Technology/Device) that would softhangup any possible calls on that device. By: Clod Patry (junky) 2005-01-07 19:17:29.000-0600 could be interesting. will check this later this week-end. By: nick (nick) 2005-01-07 23:31:56.000-0600 Give this patch a try... it tries to hangup all calls on the device (instead of resources) if you use the a option. For example SoftHangup(SIP/1234|a) or SoftHangup(CAPI[contr1/0]|a). I have no CAPI cards, and CAPI required a special case, so I couldn't really test the CAPI changes. So, if a few people with CAPI cards could test this, that'd be great. Nick (Disclaimer on File) By: cherso (cherso) 2005-01-08 03:51:14.000-0600 I have a capi and got your patch, still no hangup I did try the patch on capi and zap if you need more tests I will be glad to help you get it working thanks -- Executing Dial("SIP/1-2065", "CAPI/0:b040xxxxx|120|") in new stack -- creating pipe for PLCI=-1 -- Called 0:b040xxxxx -- CAPI[contr1/0]/0 is ringing -- Setting up echo canceller (PLCI=0x301, function=1, options=2, tail=64) -- Echo canceller successfully set up (PLCI=0x301) -- Executing SoftHangup("SIP/2-649e", "CAPI[contr1/0]|a") in new stack no hangup answer this -- Executing Dial("Zap/2-1", "Zap/5/335xxxxxxx|120") in new stack -- Called 5/335xxxxxxx -- Zap/5-1 answered Zap/2-1 -- Attempting native bridge of Zap/2-1 and Zap/5-1 -- Executing SoftHangup("SIP/1-7f54", "Zap/5|a") in new stack -- Executing Hangup("SIP/1-7f54", "") in new stack == Spawn extension (sip, 201, 2) exited non-zero on 'SIP/1-7f54' -- Executing SoftHangup("SIP/1-2821", "Zap/5|a") in new stack -- Executing Hangup("SIP/1-2821", "") in new stack edited on: 01-08-05 03:51 By: nick (nick) 2005-01-08 10:58:10.000-0600 You're right, you got the wrong version of my patch... here's the right one :-). I threw in a warning message when it tries to hang a channel up, I figure that makes more sense than being basically silent about it. If this doesn't work for you, find me as hermie on IRC. Nick edited on: 01-08-05 11:12 By: cherso (cherso) 2005-01-08 12:58:17.000-0600 working but it is killing asterisk -- Executing SoftHangup("SIP/1-5640", "Zap/5") in new stack Killed |a down not work -- Executing SoftHangup("SIP/1-7587", "Zap/5|a") in new stack -- Executing Hangup("SIP/1-7587", "") in new stack == Spawn extension (sip, 201, 2) exited non-zero on 'SIP/1-7587' -- Executing WaitExten("Zap/5-1", "5") in new stack By: nick (nick) 2005-01-08 13:18:30.000-0600 Sure enough... let me take a look again. cherso, can you come talk to me on IRC? I have a patch that works for me but I want to make sure it works for you... edited on: 01-08-05 13:21 edited on: 01-08-05 13:26 By: nick (nick) 2005-01-08 15:15:03.000-0600 OK... I was doing something REALLY stupid that made the patch work when I tested it but not for everybody else. I'm confident (from better testing) this new patch will, in fact, work. Nick By: cherso (cherso) 2005-01-08 17:28:36.000-0600 good job nick it's working on zap and capi too thanks. Are you adding this to CVS? -- Executing SoftHangup("SIP/9-72bb", "Zap/5|a") in new stack Jan 9 00:22:14 WARNING[30363]: app_softhangup.c:73 softhangup_exec: Soft hanging Zap/5-1 up. == Spawn extension (gsm_menu, s, 5) exited non-zero on 'Zap/5-1' -- Executing Hangup("Zap/5-1", "") in new stack == Spawn extension (gsm_menu, h, 1) exited non-zero on 'Zap/5-1' -- Executing Hangup("SIP/9-72bb", "") in new stack == Spawn extension (sip, 201, 2) exited non-zero on 'SIP/9-72bb' -- Hungup 'Zap/5-1' -- Executing Dial("Zap/5-1", "CAPI/0:b040xxxxxx|120|") in new stack -- Called 0:b040xxxxx -- CAPI[contr1/0]/0 is ringing -- Setting up echo canceller (PLCI=0x101, function=1, options=2, tail=64) -- Echo canceller successfully set up (PLCI=0x101) -- Executing SoftHangup("SIP/9-97e2", "CAPI[contr1/0]|a") in new stack Jan 9 00:27:01 WARNING[30375]: app_softhangup.c:73 softhangup_exec: Soft hanging CAPI[contr1/0]/0 up. -- CAPI Hangingup -- Executing Hangup("SIP/9-97e2", "") in new stack By: nick (nick) 2005-01-08 19:16:00.000-0600 Yup, I think this one is _finally_ ready if Mark wants it... Nick By: cherso (cherso) 2005-01-12 06:54:45.000-0600 mark? By: Mark Spencer (markster) 2005-01-12 09:51:49.000-0600 Added to CVS with modifications. Thanks! By: Digium Subversion (svnbot) 2008-01-15 15:21:20.000-0600 Repository: asterisk Revision: 4767 U trunk/apps/app_softhangup.c ------------------------------------------------------------------------ r4767 | markster | 2008-01-15 15:21:19 -0600 (Tue, 15 Jan 2008) | 2 lines Allow softhangup to work on partial matches if requested (bug ASTERISK-3198) ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=4767 |