Summary:ASTERISK-01950: [patch] New features for LineJack phone driver
Reporter:matti (matti)Labels:
Date Opened:2004-07-05 09:39:12Date Closed:2008-01-15 15:19:07.000-0600
Versions:Frequency of
Environment:Attachments:( 0) chan_phone.c
( 1) chan_phone.c
( 2) diff
( 3) diff
( 4) phone.conf
Description:Sometimes after a ring to my new PHONE driver, snom200 loses call origination capability and SIP channels remain in Ring state even after snom200's hangup. soft hangup <channel> does not remove the channels. Asterisk has to be ended to regain the ability of snom200 to originate calls. After pressing Ctrl-C, Asterisk sometimes gets a segmentation fault.


test19*CLI> show channels
       Channel  (Context    Extension    Pri )   State Appl.         Data

  SIP/254-2459  (sip-in     910*         1   )    Ring Dial          Phone/phon
  SIP/254-060d  (sip-in     910*         1   )    Ring Dial          Phone/phon
  SIP/254-e9cf  (sip-in     910*         1   )    Ring Dial          Phone/phon
3 active channel(s)

gdb after pressing Ctrl-C:
Executing last minute cleanups
 == Destroying any remaining musiconhold processes
Huh?  Child handler, but nobody there?

Program exited normally.

Output from Asterisk after pressing Ctrl-C:
Jul  5 17:21:37 WARNING[229390]: chan_sip.c:2034 sip_new: Unable to allocate cha
nnel structure
Jul  5 17:21:37 NOTICE[229390]: chan_sip.c:6864 handle_request: Unable to create
/find channel
Jul  5 17:21:40 WARNING[229390]: chan_sip.c:2034 sip_new: Unable to allocate cha
nnel structure
Jul  5 17:21:40 NOTICE[229390]: chan_sip.c:6864 handle_request: Unable to create
/find channel
Jul  5 17:21:44 WARNING[229390]: chan_sip.c:2034 sip_new: Unable to allocate cha
nnel structure
Jul  5 17:21:44 NOTICE[229390]: chan_sip.c:6864 handle_request: Unable to create
/find channel
Executing last minute cleanups
 == Destroying any remaining musiconhold processes
Segmentation fault
Comments:By: matti (matti) 2004-07-05 09:44:35

Operating system: SuSE Linux 2.4.21
Asterisk version: CVS-HEAD-06/29/04-14:58:41

By: Tilghman Lesher (tilghman) 2004-07-05 10:01:11

Not really related to your problem, but you should stop using BYEXTENSION in your dialplan; use ${EXTEN} instead.

By: Tilghman Lesher (tilghman) 2004-07-05 10:03:16

I'm wondering if this is a SIP problem or a Linejack problem.  Could you eliminate one or the other from your setup and try to replicate the problem?

By: matti (matti) 2004-07-06 07:37:24

The problem seems to be that chan_phone.c function restart_monitor kills the do_monitor thread holding the iflock mutex. The fix is that restart_monitor gets the iflock mutex before killing the do_monitor thread. I attach a fixed chan_phone.c file including new features.

By: Mark Spencer (markster) 2004-07-07 09:02:22

We need a "cvs diff -u" as an attachment, and we will need a disclaimer if the patch is non-trivial.

By: matti (matti) 2004-07-19 09:18:20

chan_phone.o became deadlocked when owner was set outside do_monitor.
As a fix, I replaced a while statement with a for statement, so that the continue statement would move to the next interface. I also removed the "Whoa... I'm owned but found" warning because it does not seem to hurt. However, sometimes call attempts from Phone to SIP failed to be noticed by chan_phone.o.

I also removed the decreasing of use count in function phone_check_exception because the use count would become negative after hangup.

By: twisted (twisted) 2004-08-09 12:15:23

Is there any interest still here?  Also, Matti, have you disclaimed with digium?

By: matti (matti) 2004-08-10 06:03:20

I still have interest. I have not yet disclaimed with Digium. Should I do it before my patch is accepted or after?

I attached a new chan_phone.c whose function phone_request is able to select a channel that supports the desired format.
It also queries the driver about codecs if mode is MODE_FXS.
I also reverted to the decreasing of use count in function phone_check_exception because the use count seemed to work now.
I added support for image and video formats.

By: matti (matti) 2004-08-10 07:21:23

When I called from a Phone and hang up, I still got the following warning:
Aug 10 14:49:28 WARNING[376847]: Usecnt < 0???

I guess the decreasing of Usecnt should be removed from phone_check_exception after all.

By: twisted (twisted) 2004-08-11 21:30:54

the disclaimer must be filed PRIOR to acceptance of non-trivial patches into cvs. (trivial = text adjustments, typo corrections, correction of calculations, and the like)

By: matti (matti) 2004-08-13 09:55:36

I attached new chan_phone.c file that does not decrease use count in phone_check_exception.

It also does not check the validity of an extension in the MODE_FXS mode until there are no digits left. I had a problem with the old code and variable-length telephone numbers: I could not think of any extensions.conf that would have handled all lengths correctly.

I guess new patches should be tested well before they are accepted into CVS. Therefore, I think there is no hurry to file a disclaimer now.

By: Tilghman Lesher (tilghman) 2004-08-13 11:24:14

You have a potential chicken-and-egg problem, there, Matti.  People aren't going to test your patch until you have a disclaimer on file.  Just get it in and get it over with.

By: twisted (twisted) 2004-08-25 18:18:20

Reminder sent to Matti

Matti, we need a disclaimer to continue with this bug.

By: matti (matti) 2004-08-30 06:18:13

I attach a new version of chan_phone.c that does not warn about PHONE_RING_START failing. I found out that such warnings are disturbing if some channels cannot be used and are skipped.

The disclaimer should be sent today.

By: twisted (twisted) 2004-10-01 12:00:57

It's been a month.  Has the disclaimer been filed?  Can we clean up the files here?  What's the status?

By: matti (matti) 2004-10-04 01:23:12

I filed the disclaimer on behalf of Tumsan Oy on the 31st of August.

By: twisted (twisted) 2004-10-27 16:32:15

Okay.  I'm going to ask for updates again here, as the last file was on 8-30-04.  Update required to continue...


By: twisted (twisted) 2004-11-14 21:30:38.000-0600

No update, no continue.  Closing for lack of interest.


By: matti (matti) 2004-11-15 00:27:57.000-0600

I posted files.

By: twisted (twisted) 2004-11-15 00:32:29.000-0600

posting files the day after I ask for an update does not constitute as activity.  I will, however give another week for some real activity on this one, since you have responded.

I *DO* however, need to clean up the files.. may I remove all but the ones for 10-28-04?

By: matti (matti) 2004-11-15 01:01:53.000-0600

You may remove all files but the ones for 10-28-04.

What kind of activity do you expect?

By: twisted (twisted) 2004-12-01 00:49:37.000-0600

Removed all but files from 10-28-04 (my birthday!).

The kind of activity expected is either expressed interest, testing notes, or advancements.


By: matti (matti) 2004-12-01 01:23:44.000-0600

I have tested my patch and it works and eliminates the two bugs I mentioned: hanging and usecount warning.

By: twisted (twisted) 2004-12-15 20:41:31.000-0600

YAUR - Yet another update request.


By: matti (matti) 2004-12-16 02:52:51.000-0600

I changed ast->blocking to flag, added Linux 2.6 includes and removed one of my previous unnecessary mode dependencies.
Calls still go fine to both directions.

By: twisted (twisted) 2004-12-28 11:01:46.000-0600

Reminder sent to markster

markster, is this futile?  Apparently not many people to test on quicknet linejacks, and poster is trying to keep this going.  Any chance this can get added to cvs head?

By: khb (khb) 2004-12-28 15:18:15.000-0600

I never had a problem with SNOM200's calling Phone channel (but then I am using a modified phone driver as well) or vice versa.
Is this the issue?
The patch adds a mode "FXS" it seems.  What are the features of the mode?
It's confusing to name it FXS at least, since both the "immediate" and the "dialtone" mode are FXS modes.  So there should be some meaningful distinction in the name as to what this new mode does differently.   If this is just a fix to the FXS behavior, then the existing modes should be fixed instead.
Please provided an updated phone.conf file to document what the differences are, if this does go any further.

edited on: 12-28-04 15:22

By: khb (khb) 2004-12-28 15:46:01.000-0600

After re-reading this thread,
I am wondering just what the purpose of the patch was.
It advertises new features, but never mentions really what those are,
other than support for image and video?
How does that work for an analog phone (-line)?
The gist of this seems to be SIP problems with SNOM 200 phones,
and I don't see the connection with chan_phone. It seems the SIP
channel locks up and therefore SIP phones can't operate. I would think
this is not specific to SNOM200's.
It's been months since the initial report. Does the currentstock phone driver work for you with the current stock SIP driver?

By: matti (matti) 2004-12-29 02:30:25.000-0600

One issue was that the Phone channel became deadlocked when called from SNOM, but that deadlock is probably not specific to SNOM or SIP but to the Phone channel library in Asterisk.

The patch adds a mode "FXS". The main feature of the mode is sending dialled digits to the device. Other feature is that digits dialled from the Phone side are not matched in the dialplan as long as there are unhandled digits left.

Another new feature is support for data such as image and video.
That requires a special device and driver to work with an analog phone (-line).

edited on: 12-29-04 02:33

By: Mark Spencer (markster) 2004-12-30 19:21:34.000-0600

Merged in CVS, thanks!

By: Russell Bryant (russell) 2005-01-02 20:59:29.000-0600

This patch does not apply to the stable branch ...

If you would like these changes in the 1.0 branch, please re-open and provide a patch.


By: Digium Subversion (svnbot) 2008-01-15 15:19:07.000-0600

Repository: asterisk
Revision: 4615

U   trunk/channels/chan_phone.c

r4615 | markster | 2008-01-15 15:19:06 -0600 (Tue, 15 Jan 2008) | 2 lines

Phone driver updates (bug ASTERISK-1950)