Summary:ASTERISK-16890: [patch] Update for chan_unistim fuctionality
Reporter:Igor Goncharovsky (igorg)Labels:
Date Opened:2010-10-28 23:55:12Date Closed:2012-03-12 12:04:19
Versions:Frequency of
Environment:Attachments:( 0) 1120E_unistim.conf
( 1) 1140E_unistim.conf
( 2) backtrace-2012-01-07T15-48-15-0600.txt
( 3) backtraces.tar.gz
( 4) backtrace-threads.txt
( 5) chan_unistim.c.
( 6) chan_unistim.c.
( 7) chan_unistim.c.r1.diff
( 8) chan_unistim.c.r294638-2.diff
( 9) chan_unistim.c.r295998-3.diff
(10) chan_unistim.c.r299394-4.diff
(11) chan_unistim.c.r299906-6.diff
(12) chan_unistim.c.r307838-9.diff
(13) chan_unistim.c.r333428-10.diff
(14) chan_unistim.c.r349410-11.diff
(15) chan_unistim.c.r349410-12.diff
(16) chan_unistim.c.r349978-13.diff
(17) chan_unistim.c.r352088.diff
(18) chan_unistim.c.r352088-1.diff
(19) chan_unistim.c.r353549-14.diff
(20) chan_unistim.c.r353961-15.diff
(21) chan_unistim.c.r357214-16.diff
(22) chan_unistim.c.r358730-18.diff
(23) chan_unistim.c.SVN-branch-1.8-r340263M.diff
(24) core.localhost-2011-03-14.tar.gz
(25) coredumps_2011_03.tar.gz
(26) core-show-locks.txt
(27) i2002.conf
(28) i2004_unistim.conf
(29) i2004-crash-01092012.txt
(30) i2004-lockup-partial-dial.txt
(31) i2004-lockup-partial-dial2.txt
(32) ru.po
Description:During last three month I have worked on improving functionality of Nortel phones working with asterisk to replace existing Nortel station by asterisk. Many improvments done, listed below. I have only i2002 phone and unable to test if new version of channel correctly works with i2204 phone. If anyone can test it and report issues, it would be great

New unistim.conf options:
- Added "debug" global option in unistim.conf, that enable debug when module loaded
- Added "sharpdial" option, enable sending call whet # key pressed

New features:
- ability for changing display language (tested on Russian language). Use .po files in encoding, able to display
 ISO 8859-1, ISO 8859-2, ISO 8859-4, ISO 8859-5, ISO 2022-JP. For selecting language can be used option "language" in
 unistim.conf or screen menu.
- Support for multilines
- Support for holding multiple lines
- More fixes for display on i2002 phone
- Configurable keys for sending and received history
- Menu for selecting codec, contrast (not yet completed) or display language
- Show clock at first line of idle phone
- Add ability for pick up call
- Pick up call by using on-screen soft key
- Change displaying list of received or send calls (callerid, time and caller name on different screens, listed by lef-right keys)

- Changed entering on screen phone number, so any number of digits can be entered
- rtp_port now used start rtp port
- list of dial tone frequecies now loaded from indications.conf and not hardcoded
- Key with globe icon how calls menu and not directly codec selection

- ASTERISK-16155 Correct updating LED when switching between speekerphone and handset or hanging up
- ASTERISK-16087 Multiple crashes when using phone
- ASTERISK-15660 Fixed playing dialtone in some scenarious when conversation already started
- Fixed dispalying on-screen information when using Redial softkey (DN number and timer displayed).
- Not sending short ring in case of call forward enabled on phone
Comments:By: Leif Madsen (lmadsen) 2010-11-02 09:05:57

Very exciting! I'd suggest posting this on reviewboard and also getting the community involved in testing by posting this to the asterisk-users and asterisk-dev mailing list. The more testing we can get done on this the better.

By: Igor Goncharovsky (igorg) 2010-11-02 11:45:48

I think it is bit early to post it on review board. I'll post it on asterisk-users and asterisk-dev, and I'll have a list of fixes from my customer next week. Then i can make requested fixes and clean up code to place code on review board.

By: Russell Bryant (russell) 2010-11-03 08:22:23

Would you be interested in being the maintainer for chan_unistim?  Once you feel like this code is ready and get it reviewed, we can set you up with commit access.

By: Igor Goncharovsky (igorg) 2010-11-11 04:04:29.000-0600

New version uploaded for testing, it still not ready for review. I am interested to be a maintainer of this channel driver, thank you for such proposal, Russell. Fixes:
- Fixed basic call transfer, initiated by softkeys
- Fixed encoding update, while reloading config file
- Icons update fixed
- Begin work on controlling on-screen call timer while switching between calls

By: Johann Steinwendtner (steinwej) 2010-11-24 03:24:44.000-0600

Very cool.
One issue so far. (well, was in the old version as well)
If you dial non digit chars (eg. '*') it will be copied into the history log, but when you redial it, the '*' is not used.
example: I have an accesscode '*6' for recording my call. So I dial *60123456 and the call to 0123456 is going to be recorded. This number is stored in the history log. But if I press the 'recal' button, the number '60123456' is dialed and the call fails. func. reformat_number only uses numeric chars. Please also consider '*' and '#'

By: Igor Goncharovsky (igorg) 2010-11-24 10:37:41.000-0600

Thank you for testing. I have corrected this function, also multiple crashes fixed. I have no ability for intesive testing patch, possibly can test multiline feature this weekend.

By: BradT (ronniemcd) 2010-12-06 17:24:44.000-0600

I've managed to get this patch applied to my 1.8 install, but I am having problems with transferring calls still.

Transferring where you just transfer and hang up without waiting for the other extension to pickup will crash segfault asterisk regularly. Once the other extension picks up, it seems to work fine however.

Should add, this is with Nortel i2004 Phase 1 phones.

Edit: Just did some more testing, this only appears when using the transfer button again after dialling the extension to transfer to. Pressing transfer->extension->hangup seems to work fine.

By: BradT (ronniemcd) 2010-12-12 23:52:04.000-0600

I've done some more testing, and it seems that while the handset that initiated the call can transfer, the receiving end cannot. Additionally, when the transfer is successful, the originally called handset appears to take ownership of the channel, as that handset can then transfer successfully.


Handset1 calls Handset2
Handset1 xfers call to Handset3 and hangs up.
Handset2 now has control and can xfer.
Handset2 xfers back to Handset1
Handset3 now has control.


Handset1 calls Handset2
Handset2 attempts xfer, asterisk segfaults.

By: Scott Bye (sbdj) 2010-12-16 21:35:30.000-0600

Thanks for this patch - wish I'd seen it sooner. I'd just tracked through and fixed my RTP fault (as per issue 0018203) as the lack of setting sout.sin_family in start_rtp.

I'll have a play with the other features on i2004 Phase 1 and Phase 2 phones once I can get some UNISTIM firmware back on my Phase 2.

By: Igor Goncharovsky (igorg) 2010-12-21 11:01:59.000-0600

This is a new one patch. In compare to previous one there is added configurable callwaiting tone, fixed typos and DTMF playback.

Sorry, but transfer still broken, I'll work on it after finish all things with the multilines icons and states handling.

By: Igor Goncharovsky (igorg) 2010-12-29 05:10:51.000-0600

Patch updated, done following work:
- Improved call transfer, so reported segfaults should no longer apear. Need to make more, but now transfers work much more better. Please test.
- Show callerid updates, received from asterisk
- More fixes, realy can not remember

BTW, Happy New Years!

By: Cedric (ircman) 2011-01-06 07:13:35.000-0600

Hi Igor,

To what version of Asterisk chan_unistim.c can this patch be applied ?
I tried latest 1.6 and 1.8, but no go applying the patch.

Small offtopic question:
Do you know a way how to apply a firmware update to the Nortel i2002 phones ?

By: Igor Goncharovsky (igorg) 2011-01-06 09:23:54.000-0600

This patch is for trunk, you can checkout it from svn. There is change in latest trunk for cleanup scheduler functions names, that made trink patch not aplicable for 1.8

Regarding firmware question - no, I have no such information. If you need asterisk to be able initiate firmware update, you need a tcpdump firmware upgrade process on original Nortel

By: Cedric (ircman) 2011-01-17 14:22:46.000-0600


Indeed, the patch is working for version out of trunk, but the trunk is asterisk 1.8 version. I would like to use this chan_unistimc f.or asterisk 1.6.
Is that possible ?


By: Igor Goncharovsky (igorg) 2011-01-17 23:11:23.000-0600

Diff for chan_unistim between 1.8 and 1.6.2 is about 26kilobytes, most of this changes need to be reverted in my patch to make it working with 1.6.2. Most noticeable change in 1.8 is the new RTP engine.

By: c0rnoTa (c0rnota) 2011-01-18 02:35:35.000-0600

Last patch successfully applied to asterisk 1.8.2 release.

By: Leif Madsen (lmadsen) 2011-01-19 10:13:18.000-0600

How close are we to getting this reviewed and patched back into Asterisk? Looks like a lot of good work has been done here, and since there is little (read: none) support for chan_unistim it'd be nice to get some fixes in.

Thanks for the hard work here!

By: Igor Goncharovsky (igorg) 2011-01-19 23:46:12.000-0600

There is no critical proble for now, but I have not tested yet whole functionality of unistim driver. I able to test in in a week or so. I thnk that next patch uploaded should be ready for review

By: c0rnoTa (c0rnota) 2011-01-20 07:33:05.000-0600

It's a second day of using asterisk 1.8.2 with unistim patch.
Yesterday I'v got 4 asterisk segfault
asterisk[...]: segfault at ... rip ... rsp ... error 4
At this time asterisk wrote line into /var/log/asterisk/messages:

[Jan 19 ...] WARNING[...] chan_unistim.c: start_rtp with a null session !

I'v enabled verbose and debug messages logging for more information.

By: Igor Goncharovsky (igorg) 2011-01-20 08:19:57.000-0600

Thank you for reporting, please also enable core dumb and post output of gdb

By: Leif Madsen (lmadsen) 2011-01-20 08:55:57.000-0600

IgorG: ok that's great news. I'll try to continue monitoring here. Find me on IRC if you have any questions.

c0rnoTa: https://wiki.asterisk.org/wiki/display/AST/Getting+a+Backtrace

By: c0rnoTa (c0rnota) 2011-01-20 09:09:58.000-0600

Imadsen, thanks for link. I have found that option "DONT_OPTIMIZE" was not set in my compilation. So, I should rebuild asterisk with this option ON and than I can give you backtraces.
I'm already have core dumps but as I think dumps have no useful information because compilation was optimized. Am I wrong?

By: Igor Goncharovsky (igorg) 2011-01-20 09:15:24.000-0600

You may be wrong, only one way to check - try to open core dump by gdb
Note: you need to have asterisk without DONOT_OPTIMIZE installed to see useful information for dumps you already have

By: c0rnoTa (c0rnota) 2011-01-20 09:50:13.000-0600

IgorG, seems that I wrong.
I uploaded archive with backtraces. As I already said, asterisk segfault 4 times. In archive you can found 4 txt files (backtrace#.txt) made by command
'gdb -se "asterisk" -ex "bt full" -ex "thread apply all bt" --batch -c core# > /tmp/backtrace#.txt"
And 3 files for 1st,2nd and 4th core files made from gdb shell. They called backtrace_#.txt

By: Igor Goncharovsky (igorg) 2011-01-20 10:25:33.000-0600

Yes, need new backtrace. This one not useful

By: Igor Goncharovsky (igorg) 2011-02-16 04:16:59.000-0600

New patch uploaded. It include fix for ASTERISK-17314, several new features, code guideline cleanup and fixes for autoprovisioning. I think now it is ready for review.

By: c0rnoTa (c0rnota) 2011-03-10 02:42:46.000-0600

Sorry for late response. I'v attached new backtraces. I hope it will be useful.

By: c0rnoTa (c0rnota) 2011-03-15 06:18:50

And hot new core dumps uploaded. I couldn't understand, is it useful or not, and is there any difference in cause of segfault. Another bad thing that I couldn't reproduce it, I'm just getting dumps in my temp directory periodically.

By: Igor Goncharovsky (igorg) 2011-03-15 10:09:30

Hi, thank you for reporting. From this two dumps only one related to unistim operation. Do you use latest version of patch? This dump caused by sending DTMF while Unistim dialed, but not answered yet. I think it is fixed i latest version and I not able to reproduce it in my version.

By: teknojuce (teknojuce) 2011-03-21 19:17:10

Hi IgorG is this now in trunk or do we still need to apply this patch?

By: Igor Goncharovsky (igorg) 2011-03-21 20:50:28

Hi, no this patch is not in trunk for now.

By: teknojuce (teknojuce) 2011-03-22 01:09:40

any way to get an updated patch to be able to apply to current trunk?

What revision does this sucessfully apply to? tried 306010/299091?

By: teknojuce (teknojuce) 2011-03-22 07:26:05

Hi IgorG, Just wanted to say that I took about 5-6 hours and manually copied the patch over to the chan_unistim.c file of the current trunk and so far google voice is working amazing with it really clear! 100x better than the x-lite client I was using on my computer, great work with the patch even though that was painful to copy over, haha! havn't tried inward calls yet but outbound works great.

Before this patch I was getting NO audio, the phone would only ring just to note.

Thanks for your time and effort in this patch! hopefully it will be in trunk someday.

By: Igor Goncharovsky (igorg) 2011-03-22 07:37:31

Thank you for response. Trunk revision is included in patch filename, I'll later provide updated patch for current trunk, but for now nave no made any additional fixes

By: Ian Darwin (idarwin) 2011-04-09 11:25:59

Thanks for all your work on this area, and for taking over maintenance.

I applied patch chan_unistim.c.r299906-6.diff to since that's what my
distro uses. Definitely fixes previous problems, like the crash when sending.

Works nicely on i2004, btw (model NTDU82AA70).

One issue I have is that DTMF does not work. I hear tones but the other end doesn't get them correctly (the other end is * too so it says "I'm sorry, that is not a valid option"). Works from my SIP phones so it's not *'s fault. I have country = us in the unistim.conf and have [us] section in my indications.conf.

By: Igor Goncharovsky (igorg) 2011-04-09 11:40:57

idarwin, do I understand correctly, that uou have connected i2004 to first asterisk server, that connected by SIP to other one running IVR. And in that case you have no DTMF recognized by IVR? If I am wrong, please describe your installation little more, I'll try to reproduce it

By: Ian Darwin (idarwin) 2011-04-09 13:43:07

Not quite, IgorG. In more detail;
(SIP Phone, i2004) both connected to local Asterisk
Local asterisk connected to PSTN line (via an ATA for historical reasons)
PSTN line (Bell Canada) connected to:
  a) Rented DID connected to remote Asterisk via IAX2 from VOISP, and
  b) Voice mail provided by Bell Canada
In both cases, A & B, SIP phone works with IVR, Unistim phone does not work with IVR. In case B, PSTN-provided Voice Mail IVR echoes back some random subset of the digits entered. So, I set up the obvious test with Read() and SayNumber(), on both Asterixes...

Oops! On local, I was surprised to see that *both phones pass*, but I'm not sure that is a 'real' test - does it really rely on DTMF decoding on a local call? If so, the problem is at my end, not in chan_unistim! On remote, I'd been lucky, the SIP phone gets occasional mistakes too when running this test.

I know - let's blame the ATA. I'll go investigate there - looks like the problem is outside your module.  Sorry for the noise.

By: Ian Darwin (idarwin) 2011-04-09 15:48:09

P.S. I was also able to test chan_unistim.c.r299906-6.diff on using a Nortel 1140E (Model NTYS05) unistim phone (I know there's a SIP load for this handset, but that would take us too far afield), and it works fine there too.

It would be good to see this moved along to Review for inclusion in trunk (and even releases!).


P.S. For anyone that hasn't seen it, I have an "Asterisk User's Guide" for the Unistim phones, a free download from
It's meant to be the kind of thing you give non-super-technical types when you convert them from BCM to Asterisk :-)  It's a bit behind this version of the software, I'll try to update it, comments welcome.

By: John Bamford (scsiborg) 2011-04-12 04:33:41

Hi, i have tried the latest build 307838 and thus far everything is working perfectly, brilliant work. Quick question, is it possible to set call groups and pickup groups to integrate with the standard SIP call groups and pickup groups. This is currently the only thing that i personaly need. Working with I2002, big fan of this project!

By: Igor Goncharovsky (igorg) 2011-04-12 04:45:04

Call groups and pickup groups options is channel-agnostic and stored in ast_channel structure, so SIP channel should be able pickup unistim channel and vise versa. I have not remember if I have tested it latest versions of patch, but is should work, just test

By: John Bamford (scsiborg) 2011-04-12 05:22:11

If in freepbx you add a sip extension you get the call group and pickup group options, with custom extensions you do not get these options. Also unistim.conf does not allow the addition of pickup groups or call groups. Unless i am being extremely dense and missing something (which is not unheard of).

By: Igor Goncharovsky (igorg) 2011-04-12 05:42:08

In unistim.conf you can specify callgroup and pickupgroup for devices created

By: John Bamford (scsiborg) 2011-04-12 05:46:07

Ok fantastic, thank you very much

By: John Bamford (scsiborg) 2011-04-12 06:04:03

Ok that was painless and worked first time

By: 4ess (4ess) 2011-04-20 15:26:02

Are new parameters available in the unistim.conf file? If so, is there a new sample .conf file or other documentation of these? I'm specifically interested in multiline functionality.

By: Igor Goncharovsky (igorg) 2011-04-21 00:17:51

Yes, there is some new parameters in config, all included in patch file, so after sources patched you'll have unistim.conf.example with new parameters. For adding new lines, just add several line=> to your device

By: ibercom (ibercom) 2011-05-16 14:53:21

I applied patch chan_unistim.c.r299906-6.diff to 1.8.4, it fixes a lot of problems and works well with i2002. But still, I have some crash.

Is it possible applied chan_unistim.c.r307838-9.diff to 1.8 ? Anybody has it ? How I can do it ?

I'm very interested in chan_unistim, but i can't work with trunk version, i need 1.8.

By: Igor Goncharovsky (igorg) 2011-05-17 02:27:30

Here is patch, I have used last time for patching 1.8 version. It must also work for 1.8.4, but I have not tried

By: Leif Madsen (lmadsen) 2011-05-31 16:45:03

If this is ready for review, please get this posted on reviewboard. Thanks!

By: Igor Goncharovsky (igorg) 2011-06-01 07:10:35

I have submited review request here: https://reviewboard.asterisk.org/r/1243/

By: Stanley Reynolds (stanjohn) 2011-08-17 19:15:59.777-0500

Patched asterisk with chan_unistim.c. , it fails with first hunk not applied. I then edit with vi the patched source to add "*peerd = Null" to the same place where "*peerc = Null;" so "*peerc = NULL, *peerd = Null;" Now have a working 2004i on asterisk . I don't know if this is the correct thing todo but it worked for me.

My theory is peerd was in the hunk not applied but I don't know how to fix correctly, my fix probably breaks the transfer function, I just don't know. The default chan_unistim in would crash as soon as the 2004i went off hook. At least I can use the phone again.

Wonder what needs to be done to move this forward  ?

By: Igor Goncharovsky (igorg) 2011-08-17 22:42:38.926-0500

This change should not breake transfer capability in way it work now. Currently I work on fix for all transfer problems in unistim, it'll take some additional time. Also in my current version I have fixed all problems pointed by Russell, I think next patch version 'll be posted on reviewboard next month.

By: Stanley Reynolds (stanjohn) 2011-09-06 12:59:23.059-0500

Not a new issue had a problem with message waiting light before ~ 1.6 asterisk. Light will not go off if I retrieve the message hands free / speaker phone / handset on hook, but as soon as I lift receiver after the message has been retrieved, light goes off and stays off.

By: Igor Goncharovsky (igorg) 2011-09-06 19:56:13.826-0500

Stanley, this issue opened to improve functionality in trunk version and not for fixing it it 1.6 an other present versions. Issue pointed by you already fixed in my version of patch, I'll upload it after finish testing on high load and making some code in general way (BLF support)

By: Igor Goncharovsky (igorg) 2011-09-12 04:19:42.387-0500

Here this the latest patch, it fixes all existing and known to me problems with call transfers. After removing custom code for support DND in FreePBX, this patch 'll be provided for review

By: ibercom (ibercom) 2011-09-30 17:21:44.066-0500

I have tried this patch (chan_unistim.c. with asterisk and it works quite well. I have about a hundred phone i2002 running. And although I've had a couple of crash, in general the channel works pretty well.
Now I have two questions:
- Can you select a codec from the configuration file (disallow / allow) ?
- How can you know the status of a phone (registered or unregistered, exists or not) ?

By: Igor Goncharovsky (igorg) 2011-09-30 22:09:25.131-0500

I also have installation of about 150 phones and know about crash still exists. Currently configuration have no disallow/allow options. You can find status of existing phones by using new 'unistim show devices' command

By: Jonn Taylor (jonnt) 2011-10-05 14:26:13.616-0500

Found a problem with the patch. I have 2 lines on the phone, start to dial number, paused, asterisk tried to complete call on partial number, hit release key and phone locks up. Wait about a minute and phone resets like it can not connect to the server. This is an i2004 phone.

By: Igor Goncharovsky (igorg) 2011-10-06 01:01:50.978-0500

I have only i2002 phones, and unable to reproduce this issue on 1 and 2 lines configuration. But it is possible issue, I'll look if it'll be possible reproduce it. It happens only when dial automatically partial number? Can it be reproduced if phone have enabled only one line?

By: Jonn Taylor (jonnt) 2011-10-06 07:00:35.191-0500

I can reproduce the problem with only 1 line.

By: Jonn Taylor (jonnt) 2011-10-06 07:02:08.900-0500

It only happens with automatic partial dial.

By: ibercom (ibercom) 2011-10-07 04:41:46.172-0500

I have made a small modification to the code to work properly the selection of headsets or handsfree when we receive a call. In function key_ringing:

       case KEY_FUNC1:
       case KEY_LOUDSPK:
               pte->device->output = OUTPUT_SPEAKER;
       case KEY_HEADPHN:
               pte->device->output = OUTPUT_HEADPHONE;

I've tried it and it works ok.

By: Igor Goncharovsky (igorg) 2011-10-07 04:58:33.885-0500

ibercom, thank you for comment. I'll include that fix in my next patch.

By: Jonn Taylor (jonnt) 2011-10-07 11:16:10.977-0500

unistim debug for partial dial lockup.

By: Igor Goncharovsky (igorg) 2011-10-08 01:56:49.796-0500

Can you build asterisk with DETECT_DEADLOCKS and repeat testing? Then attach log of console and bt full output of gdb utility?

By: Jonn Taylor (jonnt) 2011-10-10 08:57:44.924-0500

There is no option in menuselect for DETECT_DEADLOCKS.

By: Igor Goncharovsky (igorg) 2011-10-10 09:05:40.892-0500

Try to configure asterisk build, using ./configure --enable-dev-mode

By: Jonn Taylor (jonnt) 2011-10-11 12:06:29.162-0500

Patches for 1.8 branch 340263. Includes key_ring addition from ibercom. 1.8 branch with this patch also resolved the partial dial problem that I reported.

By: Igor Goncharovsky (igorg) 2012-01-03 10:07:00.699-0600

Updated latest development patch, improvement stability, fixes few issues

By: Igor Goncharovsky (igorg) 2012-01-03 10:15:25.884-0600

Please test it and verify that it finaly works for you, so patch 'll be commited to trunk

By: Jonn Taylor (jonnt) 2012-01-03 11:50:38.391-0600

Need to add changes to the patch for file configs/unistim.conf.sample.

By: Jonn Taylor (jonnt) 2012-01-03 14:22:03.510-0600

So far no crashes. Working very well. Need to back port to 1.8. Did find one bug, if you are on the phone and a call comes into the phone on the other line and you let it go to VM the hangup keys do not work you have to hangup the receiver.

By: Igor Goncharovsky (igorg) 2012-01-03 22:47:17.625-0600

Patch with unistim.conf.sample with new options added

By: Igor Goncharovsky (igorg) 2012-01-03 22:51:09.302-0600

You can use patch for 1.8, that already uploaded. It is imposible to add all this stuff to 1.8 branch, so my first target - make changes for trunk. When patch 'll be commited - I'll make backport for 1.8.

By: Igor Goncharovsky (igorg) 2012-01-08 10:45:13.604-0600

Uploaded patch with coding guidelines fixed, no functional changes made

By: Jonn Taylor (jonnt) 2012-01-08 16:47:34.144-0600

Segfault with i2004 and status=1.

By: Igor Goncharovsky (igorg) 2012-01-09 00:17:19.768-0600

Is it segfault apear after applying new patches or apeared after long run of previously existing code? (put approx. uptime and name of patch applied)

By: Jonn Taylor (jonnt) 2012-01-09 07:10:09.849-0600

This is with patch installed on latest trunk. If I set status=1 I can recreate the crash as soon as a call to an i2004 hangs up. If I set it to 0 I have not been able to reproduce the crash. I also have 1120e phones that I have been testing and this has not happened with them. The 1120e seems to very stable with this patch. Will be testing 1140e and 2050 soon.

By: Igor Goncharovsky (igorg) 2012-01-09 09:47:15.065-0600

According to comments in code status_method=1 is only intended for i2050 phones or phones with newew firmware. I can think that it is cause unexpected reply from i2004 phones, but I have no it for make more debug, backtrace in this situation is not helpfull

By: Jonn Taylor (jonnt) 2012-01-09 17:57:07.507-0600

Asterisk is not crashing with status=0 but the phone drops it connection to the server when they hangup. Here is what is in the logs.

By: Jonn Taylor (jonnt) 2012-01-09 18:21:43.698-0600

Can not patch current trunk. 350273
[root@gateway asterisk-trunk]# patch -p0 < chan_unistim.c.r349978-13.diff
patching file channels/chan_unistim.c
Hunk #54 succeeded at 2328 with fuzz 2.
Hunk #63 FAILED at 2716.
Hunk #99 FAILED at 4649.
Hunk #101 FAILED at 4892.
Hunk #106 FAILED at 5159.
Hunk #123 succeeded at 5621 with fuzz 2.
4 out of 154 hunks FAILED -- saving rejects to file channels/chan_unistim.c.rej
patching file configs/unistim.conf.sample
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.
2 out of 2 hunks ignored -- saving rejects to file configs/unistim.conf.sample.rej
patching file contrib/unistimLang/en.po
patching file contrib/unistimLang/ru.po
patching file contrib/unistimLang/ru.po.utf8

By: Igor Goncharovsky (igorg) 2012-01-09 23:29:11.178-0600

I'll check new trunk patching when next patch 'll be required for review. Patch broken by changes in revision 350222.
For i2004 bug i need understand, bug apear only with patch chan_unistim.c.r349978-13.diff and does not exists before?

By: Jonn Taylor (jonnt) 2012-01-10 08:19:45.576-0600

There was a problem before but what would happen is that the phone would stop working like it could not communicate with the server. When I turned on debug I could see that the phone was transmitting to the server but it was not responding to the requests. Sometime this would cause asterisk to crash. What looks like is happening is the input buffer is getting full or not getting flushed. The i2002 and the i2004 have the exact same firmware in them other than they have 2 extra keys. The 1120e that I have been testing is working as expected and it has not caused any crashes. The chan_unistim.c.r333428-10.diff patch was causing asterisk to segfault. The chan_unistim.c.r349978-13.diff seems to have reduced that greatly.

By: Jonn Taylor (jonnt) 2012-01-17 12:06:41.571-0600

Had time to do testing with 1120E and 1140E phones. Both are working very well and I have had NO crashes. I just put an 1140E on our production server with no problems. I think we need to get this pushed into trunk. The i2004 that I was having problem with stopped crashing asterisk. I will post configs for both phones.

By: Jonn Taylor (jonnt) 2012-01-17 13:28:39.111-0600

Working config files for the i2004, 1120E and 1140E.

By: Jonn Taylor (jonnt) 2012-01-21 10:58:03.521-0600

Patch for trunk 352088. Please test.

By: Jonn Taylor (jonnt) 2012-01-21 11:04:55.602-0600

Forgot to include patches for config sample and language files.

By: Igor Goncharovsky (igorg) 2012-02-01 06:04:29.120-0600

Uploaded new patch, fixed compiling with current trunk. Example configuration updated, some debug output removed

By: Jonn Taylor (jonnt) 2012-02-03 08:53:15.851-0600

Rework patch for current trunk. Added missing options to unistim.conf.sample.

By: Igor Olhovskiy (samael28) 2012-02-15 06:21:50.373-0600

Using Asterisk SVN-trunk-r353961 with patch chan_unistim.c.r353961-15.diff
Phone - Nortel i2002. (i2002.conf in attachement)
When dial in got message in console:

-- Executing [NPhone@LocalIn:2] Dial("SIP/MainAsterisk-00000001", "USTM/604@i2002Test") in new stack
[Feb 15 14:18:24] ERROR[1345]: astobj2.c:110 INTERNAL_OBJ: user_data is NULL
   -- Called USTM/604@i2002Test
   -- USTM/604@i2002Test-0x931f958 is ringing

Also, when I put on Hold via HardButton, I can put it back only via line button.

Also, when connencted to any local UNISTIM/SIP party with dial-in, phone shows Unknown party.

All of this confirmed with i2004

By: Igor Olhovskiy (samael28) 2012-02-15 06:22:46.386-0600

Config file for my test i2002

By: Jonn Taylor (jonnt) 2012-02-15 10:47:10.549-0600

Change these 2 options to the following. I had a similar problem.

By: Igor Olhovskiy (samael28) 2012-02-16 02:28:14.235-0600

Strange, but nothing changed. i2002 and i2004

By: Igor Olhovskiy (samael28) 2012-02-17 07:17:26.120-0600

And is there a way doing one-way mute? When I press Mute button. I cannot hear other side.

By: Igor Goncharovsky (igorg) 2012-02-17 07:22:10.943-0600

Igor, no there is no way currently, it is one of most important features to implement after base patch commit.

By: ibercom (ibercom) 2012-02-18 16:55:37.251-0600

When a new backport to 1.8 ? Suddenly a lot of errors:
chan_unistim.c: Error : send queue overflow
The above patch (1.8) is causing problems. Apparently, everything is ok, but the phones display "server unreachable".
Before, it has been running ok for a week, now one or two days only. I don't know why it.
I need restart asterisk.

Asterisk 1.8.9

By: Jonn Taylor (jonnt) 2012-02-18 17:05:27.786-0600

Current patch is for trunk only. Will back port it for 1.8 later.

By: Igor Goncharovsky (igorg) 2012-02-18 22:45:32.104-0600

I'll port patch to 1.8 only after it inclusion to trunk, currently there is too much difference with 1.8 and it is enough hard to make patch for 1.8

By: Igor Goncharovsky (igorg) 2012-02-28 11:03:38.201-0600

Latest svn trunk patch with a corrections noted at reviewboard

By: Jonn Taylor (jonnt) 2012-02-28 15:34:57.025-0600

2 compiler warnings on patch _16.
  [CC] chan_unistim.c -> chan_unistim.o
chan_unistim.c: In function ‘rcv_mac_addr’:
chan_unistim.c:1983: warning: ‘newl’ is used uninitialized in this function

By: Igor Goncharovsky (igorg) 2012-02-28 20:15:02.625-0600

I'll fix it on evening, my compiler give no warning here...

By: Jonn Taylor (jonnt) 2012-02-28 21:01:23.136-0600

Thanks, This is on CentOS 5.4 i686 machine. Even with the compile warning it looks like everything is working correctly.

By: Daniel Bohling (dbohling) 2012-03-01 15:44:34.594-0600

Was able to build r349410 with asterisk 10.1.2 release.

Are there plans to add/fix threeway calling for these sets?

By: Igor Goncharovsky (igorg) 2012-03-01 20:37:16.922-0600

If someone can provide traces from original Nortel pbx and describe how 3-way call done on headsets - can do this. Also it can be done using confbridge, need to look at implementation and have enought time or funds to implement.

By: Stefano Villani (playlife82) 2012-03-16 09:13:24.319-0500

Hi Igor,

with latest svn trunk (Checked out revision 995.Checked out revision 359856.) is not possible to apply latest patch. I need to apply because after patch number 15 suddenly a lot of errors appear "chan_unistim.c: Error : send queue overflow",
phones (i2002 phase0 and i2004 phase0) display "server unreachable" before, it has been running ok for a week, now one or two days only. after an asterisk restart everything goes ok, so I hope that the latest pacth solve this problem.


By: Igor Goncharovsky (igorg) 2012-03-16 09:46:43.412-0500

Patch already commited to trunk, issue closed. You do not need to apply patch

By: Stefano Villani (playlife82) 2012-03-16 10:19:56.749-0500

Ok, I apply the current SVN, but in asterisk console I receve a lot of "chan_unistim.c:4601 parsing: Warning : we lost a packet : received #0x0004 (we are at #0x0003)"

chan_unistim.c: Error : send queue overflow",

[2012-03-16 16:10:21] WARNING[1484]: chan_unistim.c:1431 send_retransmit: Asked to retransmit an ACKed slot ! last_buf_available=50, seq_server = #0x02a1 last_seq_ack = #0x00a5
[2012-03-16 16:10:21] WARNING[1484]: chan_unistim.c:1431 send_retransmit: Asked to retransmit an ACKed slot ! last_buf_available=50, seq_server = #0x02a1 last_seq_ack = #0x00a5
[2012-03-16 16:10:21] WARNING[1484]: chan_unistim.c:1431 send_retransmit: Asked to retransmit an ACKed slot ! last_buf_available=50, seq_server = #0x02a1 last_seq_ack = #0x00a5
[2012-03-16 16:10:21] WARNING[1484]: chan_unistim.c:1431 send_retransmit: Asked to retransmit an ACKed slot ! last_buf_available=50, seq_server = #0x02a1 last_seq_ack = #0x00a5
[2012-03-16 16:10:21] NOTICE[1484]: chan_unistim.c:4553 parsing: Warning : ACK received for an already ACKed packet : #0x0087 we are at #0x00a5
[2012-03-16 16:10:21] NOTICE[1484]: chan_unistim.c:4553 parsing: Warning : ACK received for an already ACKed packet : #0x0088 we are at #0x00a5
[2012-03-16 16:10:21] NOTICE[1484]: chan_unistim.c:4553 parsing: Warning : ACK received for an already ACKed packet : #0x0089 we are at #0x00a5
[2012-03-16 16:10:21] NOTICE[1484]: chan_unistim.c:4553 parsing: Warning : ACK received for an already ACKed packet : #0x008a we are at #0x00a5

and after this phone crash.


By: Igor Goncharovsky (igorg) 2012-03-16 10:23:26.047-0500

Please open new issue in Jira for this, attach configuration, hardware and software spec.