Summary:ASTERISK-16870: [patch] Support "mailbox" setting in users.conf
Reporter:Paul Dugas (pdugas)Labels:patch
Date Opened:2011-04-05 23:14:32Date Closed:
Versions:Frequency of
Environment:Attachments:( 0) mailbox_with_context_1.patch
( 1) mailbox_with_context.patch
( 2) mailbox.patch
Description:I would like to see support for the "mailbox" option be added to users.conf
processing by in pbx_config and chan_sip.  I am trying to find a way to follow
the "best practice" of avoiding use of extensions as peer names for stations
while still keeping all of my station configuration data in users.conf.

My approach is to use the "alternateexts" setting to store the extension I
want to use for a station.  I added support for the "mailbox" setting in
users.conf to make this work.


 * pbx/pbx_config.c:
     - Add hint for alternateexts dialplan extensions.
     - Use new "mailbox" setting from users.conf (if set) instead of name as
       mailbox parameter for stdexten dialplan macro.
 * apps/app_voicemail.c
     - Use new "mailbox" setting from users.conf (if set) instead of name.

Example users.conf entry:

 [tahitCorbOg3]       ; randomly generated
   secret=lognoabUl2  ; randomly generated
   fullname=Test User

Resulting dialplan extensions:

 '1001' =>         hint: SIP/tahitCorbOg3                        [pbx_config]
                   1. Goto(tahitCorbOg3,1)                       [pbx_config]
 'tahitCorbOg3' => hint: SIP/tahitCorbOg3                        [pbx_config]
                   1. Macro(stdexten,1001,${HINT})               [pbx_config]

SIP peer:

 * Name       : tahitCorbOg3
 Secret       : <Set>
 Mailbox      : tahitCorbOg3,1001
 Callerid     : "Test User" <1001>

Voicemail user:

 default    1001  Test User                                0
Comments:By: Leif Madsen (lmadsen) 2011-04-06 07:55:36

Does this patch support the format:  mailbox@some_other_context ?

By: Paul Dugas (pdugas) 2011-04-06 08:24:51

Not at the moment.  Looking at the code (I've not tinkered to test to be sure), the "userscontext" setting in [general] of voicemail.conf is used for the voicemail context.  I could look into adding that if it's of interest.

By: Paul Dugas (pdugas) 2011-04-06 09:41:29

New patch that allows "mailbox=1001@others" so both the mailbox name/number and context can be explicitly set in users.conf.

*** Warning ***
 I believe this will leak the copy of the mailbox string.  
 I'm looking for guidance on the "proper" place/way to free it.

By: Paul Dugas (pdugas) 2011-04-06 10:06:50

pls ignore mailbox_with_context.patch as it wasn't tested properly.  

mailbox_with_context_1.patch has been minimally tested.