GraphQL API Bug

I think there a bug in the GraphQL API. After creating an extension, adding voicemail to it, and applying changes the resulting dial plan still behaves as if there is no voicemail for that extension. You can “fix” this by simply going to the FreePBX GUI and clicking save on the extension without making any changes and then applying changes again and everything works. Here are the exact steps to replicate:

Use the GraphQL API to add an extension:

mutation {
    addExtension(
        input: {
            extensionId: 123
            name: "Temp Exten"
            email: "[email protected]"
            vmEnable: true
            outboundCid: null
            emergencyCid: null
            umEnable: false
            maxContacts: "5"
            clientMutationId: "accountCenter-637847711485044412-1501959637"
        }
    ) {
            status
            message
            clientMutationId
    }
}

This succeeds and returns a status of 200 (OK).

Next, add voicemail.

mutation {
    enableVoiceMail(
        input: {
            extensionId: "123"
            password: "123"
            name: "Temp Exten"
            email: "[email protected]"
            pager: null
            saycid: false
            envelope: false
            attach: true
            delete: false
            clientMutationId: "accountCenter-637847714937184442-1848740541"
        }
    ) {
            status
            message
            clientMutationId
    }
}

This also succeeds and returns as status of 200 (OK).

Finally, apply changes:

mutation {
    doreload(input: {}) {
        status
        message
        transaction_id
    }
}

After waiting for the reload to complete (I’m skipping over this part because I don’t think it’s related) if you check the created dialplan it is different from an extension created in the GUI with voicemail. Here is the relevant portion of extensions_additional.conf:

exten => 123,1,Set(__RINGTIMER=${IF($["${DB(AMPUSER/123/ringtimer)}" > "0"]?${DB(AMPUSER/123/ringtimer)}:${RINGTIMER_DEFAULT})})
exten => 123,n,ExecIf($["${REGEX("from-queue" ${CHANNEL})}"="1" && "${CONTEXT}"="from-internal-xfer"]?Set(__CWIGNORE=))
exten => 123,n,Macro(exten-vm,novm,123,0,0,0)

Take note of the parameter novm being passed to the exten-vm macro.

If the extension were setup correctly it should look more like this:

exten => 501,1,Set(__RINGTIMER=${IF($["${DB(AMPUSER/501/ringtimer)}" > "0"]?${DB(AMPUSER/501/ringtimer)}:${RINGTIMER_DEFAULT})})
exten => 501,n,ExecIf($["${REGEX("from-queue" ${CHANNEL})}"="1" && "${CONTEXT}"="from-internal-xfer"]?Set(__CWIGNORE=))
exten => 501,n,Macro(exten-vm,501,501,0,0,0)

Take note of the parameter 501 being passed to the exten-vm macro.

Am I doing something wrong or is this a bug?

@lgaetz Any chance you would be able to offer me some direction? (you’ve helped me with GraphQL issues in the past)

Not something I can assist with. If you’re able to provide steps to repro, then open a ticket at https://issues.freepbx.org/

The steps to replicate this are in my initial post. However, for the benefit of anyone else reading this thread I was able to work around this “bug”.

The key is was to change the addExtension mutation to include vmPassword. Even after doing that you STILL need to run the enableVoiceMail mutation or the voicemail won’t actually work.

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