Home  >   Articles   >  Configure Asterisk Telephony Gateway
Articles in this section

Configure Asterisk Telephony Gateway

Bindu Rekha Babu
22 Feb, 2022 - Updated 11 months ago
Table of Contents


Learn how to set up Asterisk in the Phone Calls module.
Note! Vtiger supports Asterisk Direct Gateway version 1.4 & 1.6 and Asterisk version 1.8 to 11.

Edition Required

This feature is available in Sales StarterSales ProfessionalHelp Desk StarterHelp Desk ProfessionalVtiger One Professional and Vtiger One Enterprise editions.

Setting up Phone Calls with Asterisk

Step 1: Install Phone Calls module in Vtiger

Phone Calls module is not readily available in Vtiger. It has to be installed manually to get started with the module. Follow these simple steps to install the module.

  1. Click the User Menu on the top right corner of the screen.
  2. Click Settings
  3. Scroll down to the Extensions
  4. Click Extension Store
  5. Locate Phone Calls
  6. Click Install
    image not found

Step 2: Configure your Asterisk credentials in Vtiger

After installing Vtiger Asterisk Connector, please follow few simple steps to configure your Asterisk Server information in Vtiger CRM.

  1. Click the User Menu on the top right corner of the screen.
  2. Click Settings
  3. Scroll down to the Extensions
  4. Click Phone Calls
  5. Click Edit on the top right
  6. Select Asterisk from the drop-down
  7. image not found

  8. Configure your Asterisk Server information

Vtiger Asterisk App URL - configure server name where Vtiger Asterisk Connector is installed as shown:

Syntax : Protocol://Asterisk_Server_IP:Port

Field Name Description
Protocol http/https
Asterisk_Server_IP Your Asterisk Server IP
Port Server Port configured in Vtiger Asterisk Connector config file.
Outbound Context Vtiger specific context configured in your Asterisk Server (as mentioned in Appendix)
Outbound Trunk Trunk configured in your Asterisk server.
Outbound Prefix SIP or Local (for Hosted Asterisk).
Ticket Title/Opportunity Name You can set the merge tags (fields) for the Ticket/Opportunity creation from Incoming Call Pop-up.
Callback URL Callback URL that has to be configured in Vtiger Asterisk Connector
Vtiger Secret Key Unique key generated for authentication, which has to be configured in Vtiger Asterisk Connector.

8. Click Save button.

Step 3: Configure the extension number for each user

For each user who is allowed to handle incoming and outgoing calls from the CRM, the extension number should be configured in the User preferences page.

  1. Open My Preferences.
  2. Configure user number in Asterisk Extension field under “Asterisk Configuration” block.

Number format:

Extension: [Extension_number]

e.g., 1002

Once the configuration is completed on both sides i.e., Vtiger and Asterisk, you are now ready to make and receive calls in the CRM.

Note! Current integration does not support PSTN based connections (only SIP Trunks)

Vtiger Asterisk Connector


Vtiger Asterisk application acts a gateway to connect to Vtiger CRM from the Asterisk Server. It makes it easy for Vtiger and Asterisk interaction over HTTP when incoming or outgoing calls need to be handled.


Vtiger Asterisk Connector provides following features:

  1. Connect to Vtiger and notify the incoming call.
  2. Accept commands from Vtiger and forward it to Asterisk (Click-to-Call).
  3. Call recording file management.

Click here to view all the features list.

Installation Prerequisites

  1. Asterisk 1.8 onwards

  2. Java 1.8 onwards

  3. Vtiger Details [Copy these details from Vtiger CRM PhoneCalls settings page]
    VtigerServerURL - https://yourondemand.od1.vtiger.com
    VtigerSecretKey - [Copy this detail from Vtiger CRM Settings > Extensions > Phone Calls page]

Installing Vtiger Asterisk Connector

  1. Click on the link to download Vtiger Asterisk Connector.
  2. Unzip the application package (VtigerAsteriskConnector.zip) to any path in Asterisk Server.
    unzip VtigerAsteriskConnector.zip

Update VtigerAsteriskConnector/VtigerAsteriskConnector.properties

Asterisk Server
ServerIP IP on which the Vtiger Asterisk Connector will be running. (Preferably use
ServerPort Port on which Vtiger Asterisk Connector has to run on your server.
StorageDir Path to store the Asterisk Call Recordings in your Asterisk server.
AsteriskAppDBPath Path to store the Vtiger Asterisk Connector database file in your server.
AsteriskServerPort Port on which Asterisk Server is running.
AsteriskUsername Username configured in manager.conf of your Asterisk Server.
AsteriskPassword Password configured in manager.conf of your Asterisk Server.
VtigerURL Copy and Paste the callback URL that is generated in your Vtiger Instance. You can find this under PhoneCalls settings page.
VtigerSecretKey Copy and Paste the Vtiger Secret Key that is generated in your Vtiger Instance. You can find this under PhoneCalls settings page.

Changes Required in Asterisk Server

  • Edit Asterisk Extensions configuration file: (extensions.conf)

    ; --- START ---- [vtiger_inbound] exten => DID,1,Agi(agi:// exten => _X.,1,Agi(agi:// ; --- END --- --- START ---- [vtiger_outbound] exten => _X.,1,Agi(agi:// ; --- END ---

    Add above two context in extensions.conf OR include below dial plan within existing context (both inbound and outbound context).
    exten => _X.,1,Agi(agi://


    1. _X = pattern to accept any number as extension
    2. = VtigerAskteriskConnector_ServerIP (or the one configured in VtigerAskteriskConnector/VtigerAskteriskConnector.properties)
    3. DID = DID provided by your service provider.
  • Edit Asterisk cdr configuration file: (cdr_manager.conf) and modify “enabled” field as shown below:

    ;--- START --- enabled = yes ;--- END ---

  • Edit Asterisk manager configuration file: (manager.conf)
    Add Vtiger IP in the ACL (Access Control List) under the username configured in VtigerAskteriskConnector/VtigerAskteriskConnector.properties as shown below:
    ;--- START --- permit = Vtiger_IP/ ;--- END ---

    Add Asterisk server IP under permit field as Vtiger Connector uses same IP to for AMI login.
    ;--- START --- permit = ASTERISK_IP/ ;--- END ---

Configuration Example

Trunks: Select any one of the outbound trunk, say “XYZ” from FreePBX.


a. Outbound Calls: [Should be part of trunk = XYZ]
Add new context for handling outbound calls.

; --- START ---- [vtiger_outbound] exten => _X.,1,Agi(agi:// ; --- END ---


Include below dial plan within existing context, say “Outgoing”

exten => _X.,1,Agi(agi://

b. Inbound Calls:
Add new context for handling inbound calls. And make this context as default in FreePBX Settings > Asterisk SIP Settings > Default Context = vtiger_inbound.

; --- START ---- [vtiger_inbound] exten => 123456789,1,Agi(agi:// exten => _X.,1,Agi(agi:// ; --- END ---

where 123456789 - Inbound DID


Include below dial plan within existing inbound context, say “from-internal” assuming all incoming calls are routed to this context.

[from-internal]        …        … exten => _X.,1,Agi(agi://

1. For incoming call Asterisk server will not send the start-time and end-time to CRM when it is still in ringing or on-going-progress. In order to create Phone call record in CRM, you need to fill in the start-time, as the current time on CRM is set as default. After the call is completed Asterisk server notifies CRM about the call details, which will include the actual start-time and end-time of the phone call. You can view the call details in the respective Phone call record.
2. On triggering a call via Asterisk provider, the record ID is sent to the provider.

Asterisk Manager Settings

AMI user added in connector config file should have following permissions.

;---------START----------     read = all,system,call,log,verbose,command,agent,user,config, originate     write = all,system,call,log,verbose,command,agent,user,config, originate ;---------STOP

xx.xx.xx.xxx is our Vtiger Server IP, added under permit field.

permit = xx.xx.xx.xxx/

yy.yy.yy.yyy is our Asterisk server IP, added under permit field.

permit = yy.yy.yy.yyy/

Vtiger Settings

Go to CRM Settings – > Extensions –> Phone Calls. Add following configuration:

a. Vtiger Asterisk App URL = (the port you picked)
Refer VtigerAsteriskConnector config file.

ServerIP = ServerPort = 56002 [pick a unused port] AsteriskServerIP = AsteriskServerPort = 5038 AsteriskUserName =admin AsteriskPassword = xxxxxxxxx

b. Outbound Context = Vtiger_outbound
It must match a context in extensions.conf, in that context you must have exten => _X.,1,agi(agi://

c. Outbound Trunk = XYZ
It must match the trunk name added in FreePBX.

To know more about features and benefits of this integration, please check Asterisk + Vtiger CRM

Was this article helpful?
3  out of  10  found this helpful.
Comments 0
Be the first to comment
© Copyright 2022 Vtiger. All rights reserved.