[Home]

Summary:ASTERISK-16400: [patch] chan_skinny crashes asterisk when parking a call
Reporter:Jonathan Hunter (jmhunter)Labels:
Date Opened:2010-07-21 17:48:21Date Closed:2010-09-20 16:30:13
Priority:CriticalRegression?No
Status:Closed/CompleteComponents:Channels/chan_skinny
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) backtrace.txt
( 1) chan_skinny-park-v1.txt
( 2) features-parking-fixup-v1.txt
( 3) features-parking-fixup-v2.txt
Description:I have recently upgraded to Asterisk 1.6, from 1.4, and also acquired a Cisco 7905 handset - so have now configured chan_skinny for the first time. This seems to work in the main, apart from when I use the 'Park' softbutton on the handset, which causes Asterisk to crash. Clearly, this shouldn't happen!

I can dial the park extension just fine from the handset - it only crashes if I press the softbutton.

I have checked out the latest SVN and the crash still occurs.

Happy to debug further if somebody can tell me how (I'm not an Asterisk developer)

****** STEPS TO REPRODUCE ******

- Initiate a call from a handset connected via chan_skinny
- Press the "Park" softbutton

****** ADDITIONAL INFORMATION ******

Currently, call parking isn't working for me via chan_dahdi, although it does work if I dial my parking extension directly via chan_skinny. This is something I will "get round to sorting out", and is not otherwise bothering me - I don't actually need to use call parking at the moment
Comments:By: Leif Madsen (lmadsen) 2010-07-21 21:01:29

Which branch of Asterisk 1.6 are you using?

There are 3:   1.6.0, 1.6.1, 1.6.2

By: Jonathan Hunter (jmhunter) 2010-07-22 02:31:36

That's a good question - how do I tell?

I downloaded the code with:
svn checkout http://svn.digium.com/svn/asterisk/trunk asterisk-trunk

hostname*CLI> core show version
Asterisk SVN-trunk-r278539 built by root @ hostname on a i686 running Linux on 2010-07-21 22:22:32 UTC

hostname# svn info
Path: .
URL: http://svn.digium.com/svn/asterisk/trunk
Repository Root: http://svn.digium.com/svn/asterisk
Repository UUID: f38db490-d61c-443f-a65b-d21fe96a405b
Revision: 278578
Node Kind: directory
Schedule: normal
Last Changed Author: dvossel
Last Changed Rev: 278539
Last Changed Date: 2010-07-21 20:16:12 +0100 (Wed, 21 Jul 2010)



By: dea (dea) 2010-07-26 20:08:17

(ignore v1, it is unrelated)

This is not a only chan_skinny issue.  It has been reported against
other channels that masquarade away early, thus crashing in an ugly
manner when the system tries to playback the parking lot.

In the dumps I have collected it also appears to be trying to play
the parking lot message to the parking lot itself.

Instead of trying to resolve either of those issues, which would be
valid, I instead added code to leverage the flag to not playback the
parking lot.  The flag existed already but did not seem to have the
desired effect.

By: Jonathan Hunter (jmhunter) 2010-07-27 02:12:42

Thanks Dan.

I've applied the v2 patch but still get a crash with the softkey...

Am now heading out but will try again this evening!

Using host libthread_db library "/lib/libthread_db.so.1".
Core was generated by `/usr/sbin/asterisk -vvvg -c'.
Program terminated with signal 11, Segmentation fault.
#0  0x080eac39 in masq_park_call (rchan=0x0, peer=0xca12568, timeout=0, extout=0xb77f9148,
   play_announcement=0, args=0xb77f9054) at features.c:1034
1034            if (!(chan = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, rchan->accountcode, rchan->exten, rc
han->context, rchan->linkedid, rchan->amaflags, "Parked/%s",rchan->name))) {
#0  0x080eac39 in masq_park_call (rchan=0x0, peer=0xca12568, timeout=0, extout=0xb77f9148,
   play_announcement=0, args=0xb77f9054) at features.c:1034
       chan = (struct ast_channel *) 0x74686d6a
       f = (struct ast_frame *) 0x31747365
       park_status = 6691584
       park_args = {timeout = 0, extout = 0xb77f9148, orig_chan_name = 0x0, return_con = 0x0,
 return_ext = 0x0, return_pri = 0, flags = 0, pu = 0xca20d08}
       __FUNCTION__ = "masq_park_call"
       __PRETTY_FUNCTION__ = "masq_park_call"
#1  0x080eaf43 in ast_masq_park_call (rchan=0x0, peer=0xca12568, timeout=0, extout=0xb77f9148)
   at features.c:1081
No locals.
#2  0x00674e13 in handle_soft_key_event_message (req=0xca202d8, s=0xc834cf8) at chan_skinny.c:6092
       extout = 135845100
       message = "8\221\177<B7>5<C3>\030\b\f\000\000\000\000<C0>\003\000\000<C0>\003\000\006\000\000\000\22
0\233a<B7><FF><FF>\017"
       d = (struct skinny_device *) 0xc7fe100
       l = (struct skinny_line *) 0xc7fb9c0
       sub = (struct skinny_subchannel *) 0xca157c8
       c = (struct ast_channel *) 0xca12568
       t = 3977552
       event = 14
       instance = 1
       callreference = 2
       __PRETTY_FUNCTION__ = "handle_soft_key_event_message"
       __FUNCTION__ = "handle_soft_key_event_message"
#3  0x00675bc8 in handle_message (req=0xca202d8, s=0xc834cf8) at chan_skinny.c:6278
       res = 0
       sd = (struct skinny_speeddial *) 0x67be2a
       l = (struct skinny_line *) 0xc834cfc
       d = (struct skinny_device *) 0xc7fe100
       __PRETTY_FUNCTION__ = "handle_message"
#4  0x00676813 in skinny_session (data=0xc834cf8) at chan_skinny.c:6450
       res = 20
       req = (struct skinny_req *) 0xca202d8
       s = (struct skinnysession *) 0xc834cf8
       __PRETTY_FUNCTION__ = "skinny_session"
ASTERISK-1  0x0818d56e in dummy_start (data=0xc835b18) at utils.c:971
       __cancel_buf = {__cancel_jmp_buf = {{__cancel_jmp_buf = {4358132, 0, -1216373872, -1216375864,
       115922671, -1181773647}, __mask_was_saved = 0}}, __pad = {0xb77f9480, 0x0, 0x0, 0x0}}
       __cancel_routine = (void (*)(void *)) 0x807ad46 <ast_unregister_thread>
       __cancel_arg = (void *) 0xb77f9b90
       not_first_call = 0
       ret = (void *) 0x0
       a = {start_routine = 0x676720 <skinny_session>, data = 0xc834cf8,
 name = 0xc835b28 "skinny_session       started at [ 6497] chan_skinny.c accept_thread()"}
ASTERISK-2  0x0041945b in start_thread () from /lib/libpthread.so.0
No symbol table info available.
ASTERISK-3  0x0035c23e in clone () from /lib/libc.so.6
No symbol table info available.

By: dea (dea) 2010-07-27 12:32:59

Your back traces shows that there is no remote peer, which is highly unlikely, otherwise you would not have anything to park.

What is the channel type of the remote peer?

By: Jonathan Hunter (jmhunter) 2010-07-27 16:36:47

Aha!

I think this is indeed the cause of the crash - an unexpected "user error" condition we don't currently check for.

I was testing this by picking up the skinny handset, dialling music-on-hold, and pressing Park (actually, this how I discovered the bug - by pressing random buttons on my new skinny handset, to work out what they did)

I have now tested call parking whilst dialling an actual other extension (my DAHDI test extension) and indeed no crash occurs in this instance.

I don't know enough about Asterisk's internals to work out whether it should be possible to park a music-on-hold call (dialplan extract below), or if this is something that can't be done without serious re-engineering. Either way, I guess we need an additional patch, to check for the presence of a remote peer before parking (rather than coredumping :-))?

This is my dialplan target that triggers the coredump:
exten => 6001,1,Answer
exten => 6001,n,NoCDR
exten => 6001,n,MusicOnHold()
exten => 6001,n,Wait(60)

Many thanks!!

By: dea (dea) 2010-07-27 17:51:23

chan_skinny-park-v1.txt tests to see if a call is 'parkable' before
trying to park it.

I had to strip the patch of unrelated changes (transfer and 7921 tweaks)
Please confirm if it applies and works.

By: Jonathan Hunter (jmhunter) 2010-07-27 18:33:13

Hurrah!

This patch works a treat - I no longer get a crash when parking the call, but receive the "Call Park not available" message.

Thank you!

By: dea (dea) 2010-07-27 21:53:58

Note that these fixes also required in and apply to version 1.6

By: Digium Subversion (svnbot) 2010-09-20 16:28:33

Repository: asterisk
Revision: 287642

U   branches/1.6.2/channels/chan_skinny.c

------------------------------------------------------------------------
r287642 | qwell | 2010-09-20 16:28:33 -0500 (Mon, 20 Sep 2010) | 8 lines

Don't crash when parking a non-bridged call.

(closes issue ASTERISK-16400)
Reported by: jmhunter
Patches:
     chan_skinny-park-v1.txt uploaded by DEA (license 3)
Tested by: jmhunter, DEA

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=287642

By: Digium Subversion (svnbot) 2010-09-20 16:29:46

Repository: asterisk
Revision: 287643

_U  branches/1.8/
U   branches/1.8/channels/chan_skinny.c

------------------------------------------------------------------------
r287643 | qwell | 2010-09-20 16:29:46 -0500 (Mon, 20 Sep 2010) | 15 lines

Merged revisions 287642 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2

........
 r287642 | qwell | 2010-09-20 16:28:32 -0500 (Mon, 20 Sep 2010) | 8 lines
 
 Don't crash when parking a non-bridged call.
 
 (closes issue ASTERISK-16400)
 Reported by: jmhunter
 Patches:
       chan_skinny-park-v1.txt uploaded by DEA (license 3)
 Tested by: jmhunter, DEA
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=287643

By: Digium Subversion (svnbot) 2010-09-20 16:30:12

Repository: asterisk
Revision: 287644

_U  trunk/
U   trunk/channels/chan_skinny.c

------------------------------------------------------------------------
r287644 | qwell | 2010-09-20 16:30:12 -0500 (Mon, 20 Sep 2010) | 22 lines

Merged revisions 287643 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
 r287643 | qwell | 2010-09-20 16:29:46 -0500 (Mon, 20 Sep 2010) | 15 lines
 
 Merged revisions 287642 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.6.2
 
 ........
   r287642 | qwell | 2010-09-20 16:28:32 -0500 (Mon, 20 Sep 2010) | 8 lines
   
   Don't crash when parking a non-bridged call.
   
   (closes issue ASTERISK-16400)
   Reported by: jmhunter
   Patches:
         chan_skinny-park-v1.txt uploaded by DEA (license 3)
   Tested by: jmhunter, DEA
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=287644