PBX GUI - Core Module GraphQL APIs

PBX GUI - Core Module GraphQL APIs

This wiki is to capture the Core module provided GraphQL APIs.

 

Please find below list of APIs supported by Core module.

Core module APIs are useful to create , modify , delete extensions and fetch the values of existing configured extensions. 

 

 

 

 

Create Extension

Creating an extension into Freepbx/PBXact system.

 

API Name  addExtension API.

 

API Parameters -

 

Name

Required

Type

Default

Description

Name

Required

Type

Default

Description

extensionId

Mandatory

ID

 

Unique string to specify the extension number.

name

Mandatory

string

 

Display name

tech

Optional

String

pjsip

SIP Technology device driver. If not specify then will use PJSIP to create the extension.

Accepted values:  "sip" or "pjsip".

channelName

Optional

String

 

Channel name in case if using DAHDI

callerID

Optional

String

 

The CallerID name for calls from this user will be set to this name. Recommended to use "name" not the number.

outboundCID

Optional

String

 

This overrides the caller id when dialling out a trunk. This setting will override the common outbound caller id set in the trunk.

emergencyCID

Optional

String

 

This caller id will always be set when dialing out an outbound route flagged as emergency. The emergency CID overrides all other caller id settings.

email

Mandatory

String

 

User Email address to use for services such as voicemail, user management and fax etc.

vmEnable

Optional

Boolean

True

Voicemail enable / disable

vmPassword

Optional

String

 

Voicemail password. If not specify then user can access the voicemails without any password/pin.

umEnable

Optional

Boolean

True

User manager enable/disable. If enabled mandatory to set umPassword

umGroups

Optional

String

1

User manager group. if not specified will use all user(1) created at the time of installation. In case of multiple add comma separated values.

umPassword

Oprional

String

 

Set passwords for user management. Its mandatory to set password if umEnable is set to true.

maxContacts

Optional

Integer

1

Set max_contacts value for chan_pjsip extension.

 

 

Query Parameters 

status message

 

 

API Request 

1. Api to add Extension   GQLAPI:  /admin/api/api/gql   parameters:   mutation {     addExtension(         input: {             extensionId: 9090090115             name: "api test"             tech: "pjsip"             channelName: "APi Test2"             outboundCid: "12345678901"             email: "xyzabc@gmailcom"             umGroups: "1"             umEnable: true             umPassword: "password"             vmPassword: "asda"             vmEnable: true             callerID: "234234324"             emergencyCid: "1221333331"             clientMutationId: "test1231"             maxContacts: "3"         }     ) {         status         message     } }

 

API Response 

{   "data": {     "addExtension": {       "status": true,       "message": "Extension has been created Successfully"     }   } }

Update Extension

 

Update extension in FreePBX/PBXACT to do any modification of an existing extension parameters.

If optional parameters are not passed, It will use the configured extension value. 

 

API Name  updateExtension API.

 

API Parameters -

 

Name

Required

Type

Default

Description

Name

Required

Type

Default

Description

extensionId

Mandatory

ID

 

Unique string to specify the extension number.

name

Mandatory

string

 

Display name

tech

Optional

String

 

SIP Technology device driver. If not specify then will use PJSIP to create the extension.

Accepted values:  "sip" or "pjsip".

channelName

Optional

String

 

Channel name in case if using DAHDI

callerID

Optional

String

 

The Caller ID name for calls from this user will be set to this name. Recommended to use "name" not the number.

outboundCID

Optional

String

 

This overrides the caller id when dialing out a trunk. This setting will override the common outbound caller id set in the trunk.

emergencyCID

Optional

String

 

This caller id will always be set when dialing out an outbound route flagged as emergency. The emergency CID overrides all other caller id settings.

email

Optional

String

 

User Email address to use for services such as voicemail, user management and fax etc.

vmEnable

Optional

Boolean

True

Voicemail enable / disable. If enabled mandatory to set umPassword.

vmPassword

Optional

String

 

Voicemail password. If not specify then user can access the voicemails without any password/pin.

umEnable

Optional

Boolean

True

User manager enable/disable

umGroups

Optional

String

 

User manager group. if not specified will use all user(1) created at the time of installation

umPassword

Oprional

String

 

Set passwords for user management. Its mandatory to set password if umEnable is set to true.

extPassword

Optional

String

 

Set a secret/password for extension.

maxContacts

Optional

Integer

1

Set max_contacts value for chan_pjsip extension.

 

 

Query Parameters 

status message clientMutationId

 

 

API Request 

GQLAPI: /admin/api/api/gql   Parameters:     mutation {     updateExtension(         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"             maxContacts: "4"         }       ) {             status             message             clientMutationId        } }

API Response 

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

Delete Extension

Delete an Extension from Freepbx/PBXACT

 

API Name  deleteExtension API.

API Parameters -

 

Name

Required

Type

Default

Description

Name

Required

Type

Default

Description

extensionId

Mandatory

ID

 

Extension number

 

 

Query Parameters 

status message

 

 

API Request 

GQLAPI: /admin/api/api/gql   Parameters:   mutation {     deleteExtension(         input: { extensionId: 9090090115 }     ) {         status         message     } }

 

API Response 

{   "data": {     "deleteExtension": {       "status": true,       "message": "Extension has been deleted"     }   } }

Create Range of Extensions

 

Create a Rage of extensions starting from given extension number.

API Name: createRangeofExtension API

API Parameters - 

 

Name

Required

Type

Default

Description

Name

Required

Type

Default

Description

startExtension

Mandatory

ID

 

First Extension number to create/configure.

name

Optional

String

 

The caller id name which we want to append along with the extension number.

channelName

Optional

String

 

Channel name in case if using DAHDI

tech

Optional

String

PJSIP

SIP Technology device driver. If we want to convert extension from one driver type to other for example chan_sip to pjsip conversion.

numberOfExtensions

Mandatory

ID

 

Number of extensions to create/configure.

outboundCid

Optional

String

 

This overrides the caller id when dialling out a trunk. This setting will override the common outbound caller id set in the trunk.

emergencyCid

Optional

String

 

This caller id will always be set when dialing out an outbound route flagged as emergency. The emergency CID overrides all other caller id settings.

email

Optional

String

 

User Email address to use for services such as voicemail, user management and fax etc.

vmEnable

Optional

Boolean

True

Voicemail enable / disable

vmPassword

Optional

String

 

Voicemail password. If not specify then user can access the voicemails without any password/pin.

umEnable

Optional

Boolean

True

User manager enable/disable

umGroups

Optional

String

 

User manager group. if not specified will use all user(1) created at the time of installation

 

 

Query Parameters 

status message

 

 

API Request 

GQLAPI: /admin/api/api/gql   Parameters:   mutation {     createRangeofExtension(         input: {             startExtension: 110             numberOfExtensions: 2             tech: "pjsip"             channelName: "pjsip"             name: "APi Test2"             outboundCid: "12345678901"             email: "xyzabc@gmailcom"             umEnable: true             umGroups: "1"             vmEnable: true             vmPassword: "123451"             emergencyCid: "1221333331"             clientMutationId: "test1231"         }     ) {     message         status     } }

API Response 

{   "data": {     "createRangeofExtension": {       "message": "Extension's has been created Successfully",       "status": "true"     }   } }

Fetch a particular extension detail

API Name :  fetchExtension 

 

API Parameters: 

Name

Required

Type

Default

Description

Name

Required

Type

Default

Description

id

Mandatory

ID

 

Extension Id to query

API Parameters to query

Query Parameters 

  status   message   id   extensionId   user {     name     outboundCid     voicemail     ringtimer     noanswer     noanswerDestination     noanswerCid     busyCid     sipname     password     extPassword   }   coreDevice {     deviceId     dial     devicetype     description     emergencyCid     tech     callerId     sipdriver     user {       name       outboundCid       voicemail       ringtimer       sipname   } }

 

 

API Request 

GQLAPI: /admin/api/api/gql   Parameters:   {   fetchExtension(extensionId: "9090090110") {     status     message     id     extensionId     user {       name       outboundCid       voicemail       ringtimer       noanswer       noanswerDestination       noanswerCid       busyCid       sipname       password       extPassword     }     coreDevice {       deviceId       dial       devicetype       description       emergencyCid             }     }   }

API Response 

{   "data": {     "fetchExtension": {       "status": true,       "message": "Extension found successfully",       "id": "ZXh0ZW5zaW9uOjkwOTAwOTAxMTA=",       "extensionId": "9090090110",       "user": {         "name": "APi Test2",         "outboundCid": "12345678901",         "voicemail": "default",         "ringtimer": 0,         "noanswer": "",         "noanswerDestination": "",         "noanswerCid": "",         "busyCid": "",         "sipname": "",         "password" : "password",         "extPassword": "ecc6de2001ceb217a04d5d9ac90f3e1123444c"       },       "coreDevice": {         "deviceId": "9090090110",         "dial": "PJSIP/9090090110",         "devicetype": "fixed",         "description": "APi Test2",         "emergencyCid": "",       }     }   } }

Fetch all Extensions Details 

API Name :  fetchAllExtensions 

 

API Parameters: none

 

API Parameters to query

Query Parameters 

status message totalCount extension {    id    extensionId    user {      name      outboundCid      ringtimer      noanswer      sipname      password      extPassword     }     coreDevice {         deviceId         dial         devicetype         description         emergencyCid         tech         callerId         sipdriver    } }

API Request 

GQLAPI: /admin/api/api/gql   Parameters:   {     fetchAllExtensions {         status         message         totalCount         extension {             id             extensionId             user {               name               password               outboundCid               ringtimer               noanswer               sipname               extPassword             }               coreDevice {               deviceId               dial               devicetype               description               emergencyCid             }         }     } }

 

API Response