Summary:ASTERISK-09477: [patch] Add support for regcontext and regexten to Skinny
Reporter:Michiel van Baak (mvanbaak)Labels:
Date Opened:2007-05-20 06:37:55Date Closed:2007-06-29 16:22:17
Versions:Frequency of
Environment:Attachments:( 0) skinny_regcontextexten.patch
( 1) skinny_regcontextexten1.patch
( 2) skinny_regcontextexten2.patch
( 3) skinny_regcontextexten3.patch
( 4) skinny_regcontextexten4.patch
Description:This patch adds a regcontext and regexten config parameter to chan_skinny so it will create this context (if not already there) and adds a priority 1 NoOp on line registration.
I needed this for my dundi setup with skinny devices.
Comments:By: Michiel van Baak (mvanbaak) 2007-05-20 07:34:21

After talking to oej we decided it's best to do this the chan_sip way.
You can now specify multiple regcontexts seperated by &
If you have more then one regcontext the regexten config for a line should name the context like this: regexten = exten@context

Added new patch.

By: Michiel van Baak (mvanbaak) 2007-06-09 15:23:46

Can someone confirm this patch is working so we can get it into trunk please ?

By: pj (pj) 2007-06-09 17:25:04

I can test with several ci$co phones, but don't know, what is practical meaning of this, it would be nice to post some practical example, how/when it is usefull.

By: Michiel van Baak (mvanbaak) 2007-06-09 17:52:58

It works like the chan_sip does it. Here's how I did it at home (everything applies to skinny.conf):

in the general section, add a regcontext. This context should not exist in your extensions.conf/extensions.ael yet. You can add 1 or more.
I have a phone for private stuff and a phone for office stuff so I put 2 regcontexts here. these are context that will be created on the fly when chan_skinny loads and a phones regcontext need to be in one of those. You will see that further down in this comment:
regcontext = phoneregshome&phoneregsoffice

Now the phone that is in my office:

device = SEP...........
regexten = 6000@phoneregshome

and the home phone:

device = SEP...

If you only specify 1 regcontext in the [general] section it will be enough to put each device/line in there with:

Once the line registers with asterisk you will see a notice on the cli (if verbose is high enough):
   -- Added extension '6001' priority 1 to phoneregsoffice
   -- Added extension '6000' priority 1 to phoneregshome

and a 'dialplan show phoneregshome' would show:
asterisk*CLI> dialplan show phoneregshome
[ Context 'phoneregshome' created by 'Skinny' ]
 '6000' =>         1. Noop(6000)                                 [Skinny]

-= 1 extension (1 priority) in 1 context. =-

This way I can point the dundi.conf stuff to this context to determine wether a skinny phone is registered to this box or not.

I hope this is enough information so you can test this patch.
If not, let me know so we can work on this.

By: Michiel van Baak (mvanbaak) 2007-06-12 12:07:11

Added new patch against trunk that also uses the new ast_debug macro.
Can someone please test this?

By: pj (pj) 2007-06-12 14:21:06

I tried your patch skinny_regcontextexten2.patch on SVN-trunk-r68575M
seems, it works with my 7920, though I still don't know, how to practically use this, what is difference according to "classic" style, ie. specifying context=phoneregshome under device definition?

   -- Starting Skinny session from
   -- Added extension '324' priority 1 to phoneregshome
   -- Device 'SEP000D288E664B' successfully registered

dialplan show phoneregshome
[ Context 'phoneregshome' created by 'Skinny' ]
 '324' =>          1. Noop(324)                                  [Skinny]

By: pj (pj) 2007-06-12 14:31:10

with 7961 it also works, BUT:
when I simply pickup and hangup handset, it crash asterisk (without dumping core, asterisk simply stops)
for 7961 new support, I'm using also with latest three patches from:
but with this patches alone, it doesn't crash in simple pickup/hangup, only when doing magic with "redial", as I reported in 9887
I must say, that I successfully apply your patch, after applying patches from 9887.

pickup handset:
[Jun 12 21:40:50] WARNING[8952]: chan_skinny.c:1310 find_subchannel_by_instance_reference: Could not find subchannel with reference '0' on 'PJ2'
Setting ringer mode to '1'.
skinny_new: tmp->nativeformats=8 fmt=8
Attempting to Clear display on Skinny 324@PJ2
Clearing Display
Found device: PJ2
   -- Starting simple switch on '324@PJ2'

Disconnected from Asterisk server
Attempting to reconnect for 30 seconds

By: Michiel van Baak (mvanbaak) 2007-06-12 17:52:05

Uploaded new patch against trunk.
This one is the same as skinny_regcontextexten1.patch
skinny_regcontextexten2.patch also has the ast_debug stuff in it that needs chan_skinny patches from issue 9957. Please dont use the skinny_regcontextexten2.patch.

If you still have the crash I will have to look into it tomorrow.

By: pj (pj) 2007-06-13 07:02:22

I can confirm, that with skinny_regcontextexten3.patch on SVN-trunk-r69018M and with ci$co 7961/skinny asterisk does NOT crash:-)

By: Michiel van Baak (mvanbaak) 2007-06-13 12:41:43

Thanks for testing.

I vote for inclusion in -trunk

Qwell: can you review this patch ?

By: dea (dea) 2007-06-13 13:23:57

I see you included a fix for a bug I added, testing to see if the
device has the messages button configured.  I'll scratch that one
off my ToDo list of things to fix....

By: dea (dea) 2007-06-13 13:23:58

I see you included a fix for a bug I added, testing to see if the
device has the messages button configured.  I'll scratch that one
off my ToDo list of things to fix....

By: Jason Parker (jparker) 2007-06-13 13:43:10

Instead of having register_exten with an onoff param, why not have an unregister_exten function?

By: Michiel van Baak (mvanbaak) 2007-06-13 17:07:55

Qwell: because I took the idea from chan_sip.c
As discussed at #asterisk-dev I'll split the function in 2 parts tomorrow.
I'm now off to continue my celebration of 4 years of marriage.

PJ: thanks again for testing and I hope you will test the 4th version of the patch.

DEA: Can you confirm that this patch is working for you as well ?

By: dea (dea) 2007-06-13 17:33:22

I'll give it a spin shortly.  I've been working on the transfer patch,
and with minor cleanup I have the ability to handle multiple calls,
moving back and forth between them hold/unhold, transfer...

*** edit ***
Patches fine against my tree with way too many pending skinny patches,
compiles without error and when asked to do so, does create the regcontext
and put phones in it as they register.

*** edit 2  ***
And how rude of me, Happy Anniversary!

By: Michiel van Baak (mvanbaak) 2007-06-14 01:47:03

Thanks, it was a nice party.
Attached a patch that has register_exten and unregister_exten.

All done now I think.

By: pj (pj) 2007-06-14 04:59:32

it simply works, though not tested thoroughly,
phone line registers/unregisters in regcontext,
line appears in "dialplan show phoneregshome"

skinny phones: 7920, 7961

By: Jason Parker (jparker) 2007-06-29 16:22:15

Added to svn trunk in revision 72741. :)