VoiceMail – Allow * For Only Some Users

Home » Asterisk Users » VoiceMail – Allow * For Only Some Users
Asterisk Users 2 Comments

Hey,

I have free calling to between DDIs and cellphones on our group plan. I
figure it’d be nice to allow staff with those cellphones to be able to forward callers to their VoiceMail to their cellphones using the *
feature.

I have a standard extension macro that has VoiceMail support. So far I’ve done this by duplicating the standard extension macro, and adding this rule (where ARG1 is the extension):

  exten => a,1,Goto(vmfwd,${ARG1},1)

Then in the vmfwd context I have rules like this (I need to set the CALLERID(number) so our SIP provider accepts the call):

  ; Andrew Ruthven
  exten => 7231,1,Set(CALLERID(number)=yyy)
  exten => 7231,n,Goto(pstn,xxx,1)

Which is working nicely. But, I thought, can I simplify this and just have one macro?

So I’ve tried doing the following to fold it into my standard extension macro:

1) Tried using a/_7231 but that didn’t match (well, it was worth a try)
2) exten => a,1,Goto(vmfwd,${ARG1},1) works for calls to my extension, but if I disable the 7231 rules in vmfwd, I get:

  [2016-07-22 09:01:07.691] WARNING[11488][C-00000420]: pbx.c:6646
__ast_pbx_run: Channel ‘SIP/192.168.43.254-0000005a’ sent to invalid extension but no invalid handler: context,exten,priority=vmfwd,7231,1

  and the call hangs up, not a very nice user experience.

The second option could work, as long as the user lands back into VoiceMail if there is no valid extension. I thought about using GoSub, but how do I get the caller back into VoiceMail?

I’ve done a bunch of searching for this, but haven’t found any general solutions. Is it possible to do what I’m trying to achieve, or is there a better approach?

This is Asterisk 11.13.

Cheers, Andrew

Andrew Ruthven, Wellington, New Zealand MIITP, CITPNZ

At work: andrew.ruthven@catalyst.net.nz At home: andrew@etc.gen.nz Card : http://qr.catalyst.net.nz/907675e1
Cloud : NZs only real cloud – https://catalyst.net.nz/cloud GPG fpr: C603 FC4E 600F 1CEC D1C8 D97C 4B53 D931 E4D3 E863
LCA2016: LCA By the Bay, Geelong, AU – lca2016.linux.org

2 thoughts on - VoiceMail – Allow * For Only Some Users

  • I think you almost have it.

    In your vmfwd context have a wildcard match that sends the caller back to the originating voicemail and then define specific extensions that are allowed to forward.

    [vmfwd]
    exten => _XXXX,1,Voicemail(box@context,option)
    same => n,Hangup

    ; Andrew Ruthven exten => 7231,1,Set(CALLERID(number)=yyy)
    same => n,Goto(pstn,xxx,1)

  • Hi John,

    Ah ha!  Excellent. That works.

    Now for a further tweak, in my stdexten I set voicemail_option with with b or u, as appropriate and use ${voicemail_option) instead of option in the call to Voicemail below so the correct prompt is used.

    Thank you!

    Andrew Ruthven, Wellington, New Zealand MIITP, CITPNZ

    At work: andrew.ruthven@catalyst.net.nz At home: andrew@etc.gen.nz Card : http://qr.catalyst.net.nz/907675e1
    Cloud : NZs only real cloud – https://catalyst.net.nz/cloud GPG fpr: C603 FC4E 600F 1CEC D1C8 D97C 4B53 D931 E4D3 E863
    LCA2016: LCA By the Bay, Geelong, AU – lca2016.linux.org