How to add secret in extension at the time creation via GraphQL

Tags: #<Tag:0x00007f4f4c0e19e0>


I don’t see any way of specifying the SIP password in that documentation. Also, is there any timeline/roadmap for adding the ability to set other parameters not listed in the documentation for SIP devices (like the accountcode especially in my case!)…

In addition, does not seem like any support yet for Inbound Routes, FollowMe or User Manager?

(Itzik) #4

Normally you would let the PBX generate a password, same with the API.

The API is constantly being worked on (you can start watching these Wiki pages to get notified when there is new changes)
The good new is, AFAIK, the API is open source, so if something is missing that you desperately need, you can write it and then contribute it!

(Jared Busch) #5

Not when you are programmatically creating one. Because whatever system that is creating the extension will have a password it wants to set the extension to that it will use for the OTHER things it is doing.

(Itzik) #6

Woo-hoo! The documentation has been updated:

With a new option of:

extPassword: "secret"

API Request

GQLAPI: /admin/api/api/gql
  mutation {
        input: {
            extensionId: 9090090111
            name: "api test"
            tech: "pjsip"
            channelName: "APi Test2"
            outboundCid: "12345678901"
            email: "xyzabc@gmailcom"
            umGroups: "1"
            umEnable: true
            umPassword: "password"
            vmPassword: "password"
            vmEnable: true
            callerID: "234234324"
            emergencyCid: "1221333331"
            clientMutationId: "test1231"
            extPassword: "secret"
      ) {

API Response

  "data": {
    "updateExtension": {
      "status": true,
      "message": "Extension has been updated",
      "clientMutationId": "test1231"

GraphQL API query sipsecret

The other reason one might want/need to specify the password is that the organization might have specific password complexity requirements so good to be able to manually specify it.

(United Kingdom) #8

I’ve been looking at how to programmatically set the extension “secret” for some time.
I was delighted when I saw the “extPassword” option. But I can’t get it to work. I get :
“Field “extPassword” is not defined by type updateExtensionInput; Did you mean vmPassword?”
I have updated the PBX API module to
Any ideas ?

(Itzik) #9

Make sure you run api and core in latest edge

(United Kingdom) #10

I’m not sure I follow. “Edge” as in the browser ??
I’m developing the GraphQL in Insomina before implementing in a c# desktop app.
I get the same error when using the FreePBX GraphQL explorer in both Chrome and Edge.

(Itzik) #11

Usually, when someone here is referring to edge, they are referring to the edge repository.

fwconsole ma upgrade <module> --edge

(Lorne Gaetz) #12

As @PitzKey says, this is a new feature and requires very new versions of the API and core modules. Update from edge repo.

It’s great to see people actively discussing and using the API we’ve been adding. As I’ve written before, this is one of the focuses for FreePBX 16, and where possible, new 16 features are being backported to previous version(s).

(United Kingdom) #13

Thanks @lgaetz and @PitzKey

I couldn’t get it to offer me the option of using edge repositories - despite setting “Module admin to edge mode”.
However - the problem seems to have disappeared. I can now create extensions with a secret of my choice.
Or so I thought - the secret displayed in the GUI doesn’t seem to have changed.
I would check - but the query I was using to extract the secret has now stopped working :

    tech {
      __typename... on pjsip{secret}

Now returns :

“Field “tech” of type “String!” must not have a sub selection.”

To perhaps clarify what I am trying to do :
The aim is to have an app or web page provision extensions with minimal details. Those details being what a user would enter when logging into a softphone.

(Ricoh) #14

Ran into this too, running
Asterisk 16.17.0


I get:

“message”: “Cannot query field “extPassword” on type “coreuser”. Did you mean “password”?”

But “fetchAllExtensions” works with all the other fields

(Itzik) #16


Does not work.
Also tried Greg’s sample code:

  fetchExtension(extensionId: "4033") {
    user {      extPassword    }


“errors”: [
“message”: “Cannot query field “extPassword” on type “coreuser”. Did you mean “password”?”,
“status”: false

(Itzik) #18

Modules on the latest edge version?


Yes. I do “fwconsole ma upgrade --edge framework api certman firewall sysadmin” before I start working every time

(Greg Blumenthal) #20

@yahdie But the modules you need on edge as mentioned in my linked post are core, userman, and api. Your command only had “api” from those 3. Please try it again with core and userman at edge. Just tried it with these versions, still working:

#fwconsole ma list |egrep "core|api|userman"
     | api                  |  | Enabled                           | AGPLv3+     
     | core                 | | Enabled                           | GPLv3+      |
     | userman              | 15.0.41    | Enabled                           | AGPLv3+     |


@gblumenthal Thank you for pointing this out.
Everything works now

(system) closed #22

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