[Freeswitch-users] Limit number of voicemails

Michael Collins msc at freeswitch.org
Tue Aug 2 23:07:08 MSD 2011


This is actually better than limiting the number of messages since you can
control actual disk space. (One REALLY long message will take more disk
space than five really short ones.)

However, in the interests of actually answering the question, and
demonstrating that with FreeSWITCH anything is possible, here is a simple
dialplan trick that will allow you to limit the number messages:

<extension name="check vm box limit" continue="true">
  <condition field="destination_number" expression="^(10[01][0-9])$"
break="never">
    <action application="set" data="dialed_extension=$1"/>
    <action application="set" data="dest_user=$1@${domain}" inline="true"/>
    <action application="set" data="box_count=${vm_boxcount ${dest_user}}"
inline="true">
    <action application="log" data="INFO User ${dest_user} has ${box_count}
message(s)"/>
  </condition>

  <condition field="${expr below(${boxcount},{$max_count})"
expression="^1$">
    <action application="voicemail" data="${domain} ${dialed_extension}"/>
    <anti-action application="playback"
data="voicemail/vm-mailbox_full.wav"/>
  </condition>
</extension>

The key is to use the vm_boxcount API to get the current message count for
that user, then use the expr API and the "below" function to make sure that
the box_count is less than whatever the max number of messages (max_count in
this example). The action and anti-action tags then handle the rest.

I just threw this together off the top of my head so please actually test it
out and make sure it works. Once you confirm that, please add it to the
voicemail wiki page.

-MC

On Tue, Aug 2, 2011 at 6:45 AM, Robert Huddleston <rhuddleston at gmail.com>wrote:

> Actually http://wiki.freeswitch.org/wiki/Mod_voicemail#vm-disk-quota
>
> In the manual...
>
> -----Original Message-----
> From: freeswitch-users-bounces at lists.freeswitch.org
> [mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of Sascha
> Daniels
> Sent: Tuesday, August 02, 2011 6:00 AM
> To: FreeSWITCH Users Help
> Subject: [Freeswitch-users] Limit number of voicemails
>
> Hi together.
>
> For a small appliance I need to limit the number of voicemails for each
> user.
>
> I know that I can limit the length. That is the first step.
>
> Is there a way to disable the message recording, when the maximum number
> of voicemails is reached?
>
> Unfortunately I didn't find anything in the documentation.
>
> Kind regards
>
>                        Sascha
>
> --
> AMOOMA GmbH - Bachstr. 124 - 56566 Neuwied  -->  http://www.amooma.de
> Geschäftsführer: Stefan Wintermeyer, Handelsregister Montabaur B14998
>
> Bücher: http://das-asterisk-buch.de - http://ruby-auf-schienen.de
>
>
> _______________________________________________
> Join us at ClueCon 2011, Aug 9-11, Chicago
> http://www.cluecon.com 877-7-4ACLUE
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
> _______________________________________________
> Join us at ClueCon 2011, Aug 9-11, Chicago
> http://www.cluecon.com 877-7-4ACLUE
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20110802/1a2739f3/attachment.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list