Working with 3CX Phone System Database

Status
Not open for further replies.

igor.snezhko

Joined
Jan 7, 2008
Messages
646
Reaction score
2
Hi!
I'm still novice with VAD. I have a request from a customer to build a 'call stickness' script. This script shouild check the incoming internal Caller ID and route this call to internal employee (Extension) that has dialed this external number.
So, if a customer calling back to the common company's number, it will be routed to employee that called him before.

05.31.2014-21.44.png


The queue3cxdatabase looks like this

05.31.2014-21.53.png


05.31.2014-22.02.png


This is a queue

Code:
SELECT
  callhistory3.from_no
FROM
  public.callhistory3
WHERE
  callhistory3.dialednumber LIKE '%{0}' AND
  callhistory3.is_fromoutside = 'FALSE'
ORDER BY
  callhistory3.idcallhistory3 DESC
 LIMIT 1

And the queue is working well

05.31.2014-21.48.png


But at the debugging stage I'm not getting any results.

05.31.2014-21.56.png
 
Hi Igor,

How are you getting the query result in the conditional component below?

In this case where the query returns just a single value, you can use "Scalar" type, and then you get the value using ScalarResult. Query is most often used when the query returns a table of values.

Kind regards.
 
Yes, thank you!
I just changed to ScalarResult and receive the right Extension number. But I still cannot understand which exactly Scalar value VAD takes. How does it works?

That's strange, but today a got same result by using this method

Code:
GET_TABLE_CELL_VALUE(queue3cxdatabase.QueryResult,'0','0')

This code simpy takes value of the first cell, isnt it?

Another issue I noticed is a delay between the actual call and the 3CX database refresh. So, if two extensions call to the same external number, and then this number quickly calling back,it is possible that call will be routed to the "first" extension, and not to the "last" extension.
 
I just got idea, why my first experiment failed. This is because Extensions are calling national and local numbers in different way. National is 10 digits long, and local is 6 or 7 digits long.

But the external number CallerID I always received in national format. So, some local number I tried first simply not produced right database queues.

Example: I receive (query) CallerID 0567265546, but 3CX database contains only 7265545.

Now I check (query) last 6 digits only and this seems ok.

06.04.2014-04.54.png
 
Hi Igor,

The ScalarResult is the value at the first row and the first column. So you can get the same using Query type and getting the value with the GET_TABLE_CELL_VALUE function.

Let me know if you need additional assistance with this.

Kind regards.
 
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
112,322
Messages
591,886
Members
165,469
Latest member
footandankle.my3fcx.us