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

2007-09-04 Thread Robert Lister
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 

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

2007-09-04 Thread Jonathan GF
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 [EMAIL PROTECTED] 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. 

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

2007-09-02 Thread Jonathan GF
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.

Under my knowledge configuring the mailbox directive to the mailbox I
want would be enought to leave an retreive messages in that voicemail
box. Of course it seems to be that i was wrong :/

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?

I'm a bit stuck and would appreciate so much your help.

The block that is causing me headache is that:

 SIP.CONF 

[3]
context = internal
type= friend
username= 3
secret  = pwd3
callerid= Studio 3
host= dynamic
nat = no
mailbox = 2
qualify = yes
canreinvite = no
callgroup   = 2
pickupgroup = 2,1
dtmfmode= rfc2833

-- EXTENSIONS.CONF -

[internal]
exten = _x,1,Macro(diallocal|${EXTEN}|SIP/${EXTEN}|15)

[macro-diallocal]
exten = s,1,Dial(${ARG2}|${ARG3}|Tr)
exten = s,2,Goto(s-${DIALSTATUS},1)
exten = s-NOANSWER,1,Voicemail(u${ARG1})
exten = s-NOANSWER,2,Hangup()
exten = s-BUSY,1,Voicemail(b${ARG1})
exten = s-BUSY,2,Hangup
exten = _s-.,1,Hangup

- VOICEMAIL.CONF --

[zonemessages]
europe=Europe/Madrid|'vm-received' Q 'digits/at' R

[default]
1 = 1,Main Phone,,,saycid=yes|delete=no|tz=europe
2 = 2,The Studio,,,saycid=yes|delete=no|tz=europe

All configuration (sip, extensions, voicemail, etc...) is available @
http://www.surestorm.com/asterisk/ for those that want to help.

Thanks in advance.
Best regards,

Jonathan GF

___
--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