Page tree
Skip to end of metadata
Go to start of metadata


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 -


NameRequiredTypeDefaultDescription

extensionId

MandatoryID
Unique string to specify the extension number.
nameMandatorystring
Display name
techOptionalStringpjsip

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

Accepted values:  "sip" or "pjsip".

channelName

OptionalString
Channel name in case if using DAHDI
callerIDOptionalString
The CallerID name for calls from this user will be set to this name. Recommended to use "name" not the number.
outboundCIDOptionalString
This overrides the caller id when dialling out a trunk. This setting will override the common outbound caller id set in the trunk.
emergencyCIDOptionalString
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.
emailMandatoryString
User Email address to use for services such as voicemail, user management and fax etc.
vmEnableOptionalBooleanTrueVoicemail enable / disable
vmPasswordOptionalString
Voicemail password. If not specify then user can access the voicemails without any password/pin.
umEnableOptionalBooleanTrueUser manager enable/disable. If enabled mandatory to set umPassword

umGroups

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

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

maxContactsOptionalInteger1Set max_contacts value for chan_pjsip extension.


Query Parameter 

Query Parameters
 status
 message


API Example -

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 -


NameRequiredTypeDefaultDescription

extensionId

MandatoryID
Unique string to specify the extension number.
nameMandatorystring
Display name
techOptionalString

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

Accepted values:  "sip" or "pjsip".

channelName

OptionalString
Channel name in case if using DAHDI
callerIDOptionalString
The Caller ID name for calls from this user will be set to this name. Recommended to use "name" not the number.
outboundCIDOptionalString
This overrides the caller id when dialing out a trunk. This setting will override the common outbound caller id set in the trunk.
emergencyCIDOptionalString
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.
emailOptionalString
User Email address to use for services such as voicemail, user management and fax etc.
vmEnableOptionalBooleanTrueVoicemail enable / disable. If enabled mandatory to set umPassword.
vmPasswordOptionalString
Voicemail password. If not specify then user can access the voicemails without any password/pin.
umEnableOptionalBooleanTrueUser manager enable/disable

umGroups

OptionalString
User manager group. if not specified will use all user(1) created at the time of installation
umPasswordOprionalString
Set passwords for user management. Its mandatory to set password if umEnable is set to true.
extPasswordOptionalString
Set a secret/password for extension.
maxContactsOptionalInteger1Set max_contacts value for chan_pjsip extension.


Query Parameter 

Query Parameters
 status
 message
 clientMutationId

API Example - 


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 -


NameRequiredTypeDefaultDescription

extensionId

MandatoryID
Extension number


Query Parameter 

Query Parameters
 status
 message


API Example - 

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 - 


NameRequiredTypeDefaultDescription

startExtension

MandatoryID
First Extension number to create/configure.
nameOptionalString

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

channelName

OptionalString
Channel name in case if using DAHDI
techOptionalStringPJSIPSIP Technology device driver. If we want to convert extension from one driver type to other for example chan_sip to pjsip conversion.
numberOfExtensionsMandatoryID
Number of extensions to create/configure.
outboundCidOptionalString
This overrides the caller id when dialling out a trunk. This setting will override the common outbound caller id set in the trunk.
emergencyCidOptionalString
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.
emailOptionalString
User Email address to use for services such as voicemail, user management and fax etc.
vmEnableOptionalBooleanTrueVoicemail enable / disable
vmPasswordOptionalString
Voicemail password. If not specify then user can access the voicemails without any password/pin.
umEnableOptionalBooleanTrueUser manager enable/disable

umGroups

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


Query Parameter 

Query Parameters
 status
 message


API Example - 

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: 

NameRequiredTypeDefaultDescription

id

MandatoryID
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 Example - 

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
     password
     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
			  password
              extPassword
            }
   			  coreDevice {
   			  deviceId
   			  dial
   			  devicetype
   			  description
   			  emergencyCid
   			}
        }
    }
}

API Example: 

API Response
{
  "data": {
    "fetchAllExtensions": {
      "status": true,
      "message": "Extension's found successfully",
      "totalCount": 4,
      "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 -


NameRequiredTypeDefaultDescription

extension

Mandatorystring

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

cidnum

Mandatorystring

Define the CallerID Number to be matched on incoming calls

description

OptionalString

Provide a meaningful description of what this incoming route is

privacyman

OptionalBoolean

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

OptionalString

ALERT_INFO can be used for distinctive ring with SIP devices.

ringing

OptionalBoolean

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

OptionalString

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

OptionalString

CID name prefix

delay_answer

OptionalInteger

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

OptionalBoolean
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
OptionalInteger
Number of attempts the caller has to enter a valid CallerID
pmminlength
OptionalInteger
Minimum amount of digits CallerID needs to contain in order to be considered valid
reversal
OptionalBoolean
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
OptionalInteger
Override the ringer volume. Note: This is only valid for Sangoma phones at this time
fanswer
OptionalBoolean
Set to Yes to force the call to be answered at this time
destination
MandatoryString
Destination for route


Query Parameter 

Query Parameters
 inboundRoute {
			    id
			  }


API Example -

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"
		}
	) {
		status
		message
	}
}



API Response
{
  "data": {
    "addExtension": {
      "status": true,
      "message": "Extension has been created Successfully"
    }
  }
}
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
  • No labels