[asterisk-users] How can i send my sip channel 3 to mailbox 2? Please Help!

Jonathan GF jonathangf at gmail.com
Tue Sep 4 07:59:42 CDT 2007


Hey Robert,

you can't imagine how much i appreciate your post, which is most a
tutorial  than a post :)

Really, many thanks for your thoughts. Take for sure i will try to
implement the options you showed me here in asap.

Thank you again!
Best regards,

Jonathan GF



On 9/4/07, Robert Lister <robl at linx.net> wrote:
> On Sun, Sep 02, 2007 at 04:03:51PM +0200, Jonathan GF wrote:
> > Hi folks,
> >
> > i'm trying to configure my extensions.conf as small as posible and for
> > that reason i'm using macros. The problem is that maybe I have a
> > misunderstood the concept for the directive "mailbox" in sip.conf.
>
> What mailbox= seems to do in sip.conf is set the message waiting indicator
> (MWI) light on or off when there are messages waiting in a particular
> mailbox for that extension using a SIP message to the phone to update it.
>
> It does not control anything else such as who can access a particular
> mailbox etc. just which extensions get notifications of voicemail. It is not
> in voicemail.conf
>
> I suppose because asterisk can have different channel types other than SIP,
> it needs configuring for the different notification methods depending on
> devices. (i.e, voicemail app doesn't want to be getting involved in how to
> set and unset MWI for all sorts of different channel types.)
>
> > What i'm trying is to have ONLY 2 voicemail boxes and depending which
> > extensions i'm dialing send the caller to one or the other, but not
> > send based on the called id/name, but to that mailbox i want (mailbox
> > 1 or mailbox 2, just this).
> >
> > The error i'm getting is:
> >
> > WARNING[2102]: app_voicemail.c:2461 leave_voicemail: No entry in
> > voicemail config file for '3'
> >
> > The error is correct... i don't have a voicemail box named/numbered
> > "3" but this is the behavior i want to control. How can i send my sip
> > channel 3 to mailbox 2?
>
> Essentially, you need to pass the mailbox you want to access to the
> voicemail app, which is the thing in ARG1 in your macro.
>
> So, Voicemail(u2) would play the unavailable message for mailbox 2 instead
> of what you are currently passing it, which appears to be ${EXTEN}, the
> dialled extension.
>
> What you can do is check to see if a voicemail mailbox exists for a
> particular extension before you try it, and if no mailbox exists (i.e, you
> have not configured it in voicemail.conf) then you can do something else.)
>
> Something like this will check to see if a mailbox exists before trying it,
> if not then default to mailbox 2:
>
> exten => s,1,MailboxExists(${ARG1},j)
> exten => s,2,Voicemail(u2)
> exten => s,3,Hangup
> exten => s,102,Voicemail(u${ARG1})
> exten => s,103,Hangup
>
> Note, you can also check the variable ${VMBOXEXISTSSTATUS} for one of
> "SUCCESS" or "FAILED" if you don't like the old style priority jumping,
> which can get a bit awkward if you have to renumber things, this is the
> 'newer' way to do it, something like:-
>
> exten => s,1,MailboxExists(${ARG1},j)
> exten => s,2,Goto(s-${VMBOXEXISTSSTATUS},1}
> exten => s-FAILED,Voicemail(u2)
> exten => s-FAILED,Hangup
> exten => s-SUCCESS,Voicemail(u${ARG1})
> exten => s-SUCCESS,Hangup
>
> Of course, how you work out when somebody accesses your voicemail to listen
> to messages depends on how you are authenticating them into voicemail in the
> first place. You might just prompt for the mailbox number and/or PIN, or you
> can drop them straight into the right mailbox using a similar technique.
>
> If it gets more exotic than your two mailboxes, then you could use astdb
> entries to work out which mailbox is associated with a particular extension,
> which is more elaborate but might be worth doing for ease of configuration.
> (In that you are not hardcoding stuff into extensions.conf for every
> extension)
>
> astdb is asterisk's builtin database, which is really handy for this kind of
> thing (Unless you have millions of mailboxes which is an entirely different
> database proposition!)
>
> $ asterisk -r
> asterisk*CLI> database put 3 mailbox 2
> asterisk*CLI> database show 3
> /3/mailbox                                      : 2
>
> (That is to say, for the extension 3, we want mailbox 2)
>
> Then, to see that db variable in where you need it in the dialplan,
> would look like this:-
>
> ${DB(${EXTEN}/mailbox)} (where ${EXTEN} is 3, this would return "2")
>
> or ${DB(${ARG1}/mailbox)} in the case of your macro.
>
> This will look in the astdb for that mailbox variable you set up and
> use that instead of hardcoding it into the dialplan.
>
> Suppose your voicemail access extension is 444 and you want a passwordless
> login from the extension based on what you have set in the astdb for that
> extension, based on caller ID of the incoming extension:-
>
> ; passwordless login
> exten => 444,1,VoiceMailMain(${DB(${CALLERID(num)}/mailbox)}|s)
> exten => 444,n,Hangup
>
> (Yes, I know, it's a bit fugly bracket hell, but it's worth it!)
>
> You could combine this of course with MailboxExists to drop them into some
> default mailbox, or prompt for a mailbox number, or if there is a mailbox
> for that extension and no translation is required. (i.e, Do a MailboxExists
> and then decide if the ${DB lookup is needed.)
>
> This is just an example of DB lookups, you could do a similar thing for
> determining which mailbox to drop callers in to as well as for mailbox
> access.
>
> Then for all future requirements, you just add that to your astdb as you want
> them and it will take care of it for you. No tweaking of extensions.conf
> required.
>
> Just some food for thought on what is possible.
>
>
> Rob
>
>
> --
> Robert Lister     - London Internet Exchange - http://www.linx.net/
> sip:robl at linx.net - inoc-dba:5459*710        - tel: +44 (0)20 7645 3510
>
> _______________________________________________
> --Bandwidth and Colocation Provided by http://www.api-digital.com--
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>



More information about the asterisk-users mailing list