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 

{   "data": {     "fetchAllExtensions": {       "status": true,       "message": "Extension's found successfully",       "totalCount": 4,       "extension": [         {           "id": "ZXh0ZW5zaW9uOg==",           "extensionId": "100",           "user": {             "name": "100",             "outboundCid": "",             "ringtimer": 0,             "noanswer": "",             "sipname": "",             "password" : "password",             "extPassword": "ecc6de2001ceb217a04d5d9ac90f3e1123444c"           },           "coreDevice": {             "deviceId": "100",             "dial": "PJSIP/100",             "devicetype": "fixed",             "description": "100",             "emergencyCid": ""           }         },         {           "id": "ZXh0ZW5zaW9uOg==",           "extensionId": "101",           "user": {             "name": "101",             "password": "",             "outboundCid": "",             "ringtimer": 0,             "noanswer": "",             "sipname": "",             "password": "password",             "extPassword": "ecc6de2001ceb217a04d5d9ac90f3e1123444c"           },           "coreDevice": {             "deviceId": "101",             "dial": "PJSIP/101",             "devicetype": "fixed",             "description": "101",             "emergencyCid": ""           }         }]   } }

 

Fetch all valid extensions 

API Name :  fetchAllValidExtensions 

 

API Parameters: none

 

API Parameters to query

Query Parameters 

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

API Request 

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

 

API Response 

{   "data": {     "fetchAllValidExtensions": {       "status": true,       "message": "Valid core extensions",       "count": 2,       "extension": [         {           "id": "ZXh0ZW5zaW9uOg==",           "extensionId": "100",           "user": {             "name": "100",             "password": "",             "outboundCid": "",             "ringtimer": 0,             "noanswer": "",             "sipname": "",             "password" : "password",             "extPassword": "ecc6de2001ceb217a04d5d9ac90f3e1123444c"           },           "coreDevice": {             "deviceId": "100",             "dial": "PJSIP/100",             "devicetype": "fixed",             "description": "100",             "emergencyCid": ""           }         },         {           "id": "ZXh0ZW5zaW9uOg==",           "extensionId": "101",           "user": {             "name": "101",             "password": "",             "outboundCid": "",             "ringtimer": 0,             "noanswer": "",             "sipname": "",             "password": "password",             "extPassword": "ecc6de2001ceb217a04d5d9ac90f3e1123444c"           },           "coreDevice": {             "deviceId": "101",             "dial": "PJSIP/101",             "devicetype": "fixed",             "description": "101",             "emergencyCid": ""           }         }]   } }

Add Inbound Route

Creating inbound route into Freepbx/PBXact system.

 

API Name  addInboundRoute API.

 

API Parameters -

 

Name

Required

Type

Default

Description

Name

Required

Type

Default

Description

extension

Optional

string

 

Define the expected DID Number if your trunk passes DID on incoming calls. if did not pass this field then show default value as `Any` in the user interface

cidnum

Optional

string

 

Define the CallerID Number to be matched on incoming calls, if did not pass this field then show default value as `Any` in the user interface

description

Optional

String

 

Provide a meaningful description of what this incoming route is

privacyman

Optional

Boolean

 

If no CallerID has been received, Privacy Manager will ask the caller to enter their phone number. If an user/extension has Call Screening enabled, 

the incoming caller will be prompted to say their name when the call reaches the user/extension.

alertinfo

Optional

String

 

ALERT_INFO can be used for distinctive ring with SIP devices.

ringing

Optional

Boolean

 

Some devices or providers require RINGING to be sent before ANSWER. You'll notice this happening if you can send calls directly to a phone, 

but if you send it to an IVR, it won't connect the call.

mohclass

Optional

String

 

Set the MoH class that will be used for calls that come in on this route. For example, choose a type appropriate for routes coming in from a 

country which may have announcements in their language.

grppre

Optional

String

 

CID name prefix

delay_answer

Optional

Integer

 

An optional delay to wait before processing this route. Setting this value will delay the channel from answering the call. 

This may be handy if external fax equipment or security systems are installed in parallel and you would like them to be able to seize the line.

pricid

Optional

Boolean

 

This effects CID ONLY routes where no DID is specified. If checked, calls with this CID will be routed to this route, even if there is a route to the DID that was called. 
Normal behavior is for the DID route to take the calls. If there is a specific DID/CID route for this CID, that route will still take the call when that DID is called

pmmaxretries

Optional

String

 

Number of attempts the caller has to enter a valid CallerID. Default value is 3

pmminlength

Optional

String

 

Minimum amount of digits CallerID needs to contain in order to be considered valid. Default value is 10

reversal

Optional

Boolean

 

On PRI channels the carrier will send a signal if the caller indicates a billing reversal. 
When checked this route will reject calls that indicate a billing reversal if supported

rvolume

Optional

String

 

Override the ringer volume. Note: This is only valid for Sangoma phones at this time. Default value is 0

fanswer

Optional

Boolean

 

Set to Yes to force the call to be answered at this time

destination

Mandatory

String

 

Destination for route. for example value like this, extension (100) :`from-did-direct,100,1`

 

 

Query Parameters 

inboundRoute {                id              } status message

 

 

API Request 

1. Api to add inbound route   GQLAPI:  /admin/api/api/gql   parameters:   mutation {     addInboundRoute(input: {           extension:"71667"           cidnum:"1232"           description:"Lorem Ipsum"           privacyman:false           alertinfo:"Lorem Ipsum"           ringing:true           mohclass:"Lorem Ipsum"           grppre:"ABC"           delay_answer:12           pricid:false           pmmaxretries:"123"           pmminlength:"12"           reversal:true           rvolume:"12"           fanswer:true           destination:"1233"     }) {         inboundRoute {           id         }         status         message     } }

 

API Response 

{   "data": {     "addInboundRoute": {       "inboundRoute": {         "id": "71667/1232"       }       "status": true,       "message": "Inbound Route created successfully"     }   } }

Update Inbound Route

Updating inbound route into Freepbx/PBXact system.

 

API Name  updateInboundRoute API.

 

API Parameters -

 

Name

Required

Type

Default

Description

Name

Required

Type

Default

Description

oldExtension

Optional

string

 

Old Extension. Used to change the current extension

oldCidnum

Optional

string

 

Old CID Num. Used to change the current cid number 

extension

Mandatory

string

 

Define the expected DID Number if your trunk passes DID on incoming calls.

cidnum

Mandatory

string