Where are voicemail options stored?

I;m working on extending the graphql API, and I’m hitting a bit of a wall.

Background:
the ADDUSER function is missing three things I would want:
(pjsip only) max_contacts
(all). voicemail to email on/off
(all) voicemail to email: delete after sending (on/off)

I want to add these.

it looks like I can likely get max_contacts in there easily enough…
but I can not for the life of me find where Freepbx stores the status of “email attachment” or “Delete voicemail”.

if anyone can point me in that direction, it would be greatly appreciated.

if I can successfully automate those above 3 items, I can get our tier-1 staff completely hands-off for creating new extensions that meet our needs.

They are stored in /etc/asterisk/voicemail.conf

1 Like

i had not thought of that.

thank you for the breadcrumb.
hopefully i can find the API equivalents for calling the update function… very exciting.

While the settings are stored in voicemail.conf, you don’t want to parse it, use the native methods

<?php
include '/etc/freepbx.conf';
$FreePBX = FreePBX::Create();

// get vm settings for all extensions
$allext_vm=$FreePBX->Voicemail->getVoicemail();
print_r($allext_vm);

// get vm settings for single extension
$ext_vm=$FreePBX->Voicemail->getMailbox("6008");
print_r($ext_vm);

exit;

script output:

[[email protected] tmp]# php voicemail.php
Array
(
    [vmcontext] => default
    [pwd] => 1234
    [name] => D80
    [email] =>
    [pager] =>
    [options] => Array
        (
            [attach] => no
            [saycid] => no
            [envelope] => no
            [delete] => no
        )

)
2 Likes

This is from this article on the Wiki:

Enable VoiceMail

To enable the voicemail service on an extension.

API: enableVoiceMail

API Parameter:

Name Field Type Default Description
extensionid Mandatory String Specify the extension to enable voicemail.
password Mandatory String Specify the password for the extension.
name Optional String Specify a name for voicemail.
email Optional String The email address for voicemail.
pager Optional String Voice mail pager number.
saycid Optional Boolean Whether play caller ID to the caller.
envelope Optional Boolean Whether to play envelope to the caller.
attach Optional Boolean Whether to attach voicemail from local storage.
delete Optional Boolean Whether to delete voicemail from local storage.

API Example:

Query Parameters

status
message

API Request

mutation {

     enableVoiceMail(input: {

     extensionId: "202021"

     password: "123456"

     email: "[email protected]"

     pager:  "1234"

     saycid: true

     envelope: true

     attach: true

     delete: true

   }) {

         status message

     }

}

API Response

{

   "data": {

     "enableVoiceMail": {

       "status" : true,

       "message": "Voicemail has been created successfully"

     }

   }

}

and thats why you’re my favorite, thank you @lgaetz

i guess I should likely ask you -
do you see value in extending the AddUser and UpdateUser API calls to include max_contacts and the 4 voicemail settings?

I should be able to do the needful, you’ve just been involved far longer, so Id like to ask :slight_smile:

1 Like

If you need it, someone else does too. I would not discourage anyone from submitting PR’s.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.