Automatic call transfer to responsible manager

Contact us instead of reading the instructions

If you don’t feel like wasting time on instructions or they didn’t help, contact our support. We will quickly help you set everything up and answer all questions!\

Contact us in any convenient way:

Working hours: 08:00 - 17:00 Moscow Time (UTC+3). Weekends: Saturday, Sunday.

To automatically direct an incoming call to the Manager responsible for the entity (contact, company, or lead) in CRM, you need:

  1. CURL command must be enabled in Asterisk. Check it out:

$ asterisk -rx 'core show function CURL'

As a result, you should get a description of the curl function. If CURL is not available, it must be installed on the Asterisk server.

  1. In the PBX dialplan, you need to create a context which the call will come to BEFORE the voice greeting.

Asterisk setup

Set the context in file /etc/asterisk/extensions_custom.conf. Context below is as example, pay attention to the code, it needs to be changed:

exten => 1,1,Set(CURLOPT(hashcompat)=yes)
exten => 1,n,Set(CURLOPT(httptimeout)=5)
exten => 1,n,Set(CURLOPT(conntimeout)=5)
exten => 1,n,Set(HASH(forwardHash)=${CURL(http://localhost:8077/forward?phone=${CALLERID(num)})})
exten => 1,n,Set(CALLERID(name)=${HASH(forwardHash,name)})
exten => 1,n,GotoIf($[${HASH(forwardHash,number)}]?from-internal,${HASH(forwardHash,number)},1:ivr-1,s,1)

In this example: localhost:8077 - address and port of the server the module is installed on; ivr-1,s,1 - IVR context where the call goes to if a number was not found in CRM; CURLOPT(conntimeout)=5 - request timeout (5 seconds); if no data is received, the call will go further.

Context logic:

  1. The caller's number is passed to the variable.

  2. The existence of the value of this variable is checked (the variable must contain an internal number of the responsible person for the lead / contact / company). If the number is received, the call is transferred to the responsible person (from-internal,${TOEXT},1 - in the "from-internal" context a call to the TOEXT number is created). If there is no answer (or empty), the call goes to a voice greeting (in this example, ivr-1, s, 1).

It is possible to show the entity name on the phone.

To do this, configure the context as follows:

[bx24transfer] exten => 1,1,Set(CURLOPT(hashcompat)=yes) exten => 1,n,Set(CURLOPT(httptimeout)=5) exten => 1,n,Set(CURLOPT(conntimeout)=5) exten => 1,n,Set(HASH(forwardHash)=${CURL(http://localhost:8077/extendedForward?phone=${CALLERID(num)})}) exten => 1,n,Set(CALLERID(name)=${HASH(forwardHash,name)}) exten => 1,n,GotoIf($[${HASH(forwardHash,number)}]?from-internal,${HASH(forwardHash,number)},1:ivr-1,s,1)

FreePBX setup

It is necessary to include our custom context in the FreePBX dialplan. To do this, use the Custom Destinations module.

  1. Go to Admin → Custom Destinations and click Add Destination:

In the Target field, specify bx24transfer,1,1. Click Submit and Apply Config. Context added.

  1. Go to Connectivity → Inbound Routes, select the incoming route which auto-distribution is configured for, and in the Set Destination block, specify Custom Destinations, select bx24asterisk (context name)

  1. If you need to change the direction of the call (ivr-1, s, 1 does not fit), you need to find out the context which you want to direct the call to and specify it in file /etc/asterisk/extensions_custom.conf.

  2. For groups we get ext-group, N, 1, where N - is the group number. The group number can be found in Applications → Ring Groups.

  3. The route for custom destinations can be found in Admin → Custom Destinations, in the Target field.

  4. For all other cases:

  • Go to Inbound Routes,

  • Choose a route,

  • Right-click on the field with the name of the route and select Explore Element.

  • In the source code window find the value of the selected element.

In this case it is ext-group, 3, 1. Specify this route in the bx24transfer context instead of ivr-1, s, 1.

Last updated