Page 1 of 1

Best way to implement integration for start and end of call

PostPosted: Tue Oct 14, 2014 9:35 pm
by mattisdada2
Hello everyone, I'm a long term Asterisk user, first time Vicidial user.

For a brief run down, we develop a product called Agyle Time, it is a WFM application, for some of the features we require call data from the PBX.

I've developed most of the application in PHP for the integration (very similar to our Asterisk implementation) and all we need at this point is to run `php async.php 12313123.12312` (shell command) (unique id as first param). This will query vicidial_log for the correct information and use our API.

What I'm unsure on is the best place to put the code to execute the shell command. On our Asterisk implementation I added it to extensions.conf on the starting points of calls and h exten on calls. (Note: Inbound and Outbound) But obviously vicidial generates it's own extensions.conf so that is not the best file to use.

Obviously I want this implementation to change has little as possible on Vicidial so if the client upgrades Vicidial it will be novel to setup the integration once more.

Any help or guidance on the matter would be greatly appreciated!


Also a side question due to my inexperience with Vicidial, does vicidial_log have pending calls (calls that have started but not ended)?

Re: Best way to implement integration for start and end of c

PostPosted: Wed Oct 15, 2014 5:17 am
by mflorell
There are many different logging tables in Vicidial, and they all log different things. vicidial_log is for outbound calls, and as soon as the call is placed there is no entry for it yet, that happens after the call is answered or terminated. There is also the vicidial_dial_log table that keeps track of every dial attempt, and thee vicidial_carrier_log which keeps track of carrier termination codes for calls placed.

vicidial_closer_log is for inbound calls, but only after they enter a queue. If the inbound call has not yet entered a queue it won't be in there, but there will be an entry in vicidial_did_log for the call the instant it comes in.

If you want to look for logging of most of these events in one place, you might want to enable QM integration, which will log everything to a queue_log table just like QueueMetrics likes to see(you don't actually have to have QM installed for this to work, you just need the queue_log table in your asterisk database).

Re: Best way to implement integration for start and end of c

PostPosted: Wed Oct 15, 2014 5:19 pm
by mattisdada2
Thanks for the quick reply Matt

So if I just create the table with:
Code: Select all
 
CREATE TABLE queue_log (
partition VARCHAR(20) NOT NULL,
time_id INT(11) UNSIGNED  NOT NULL default '0',
call_id VARCHAR(30) NOT NULL,
queue VARCHAR(30) NOT NULL,
agent VARCHAR(30) NOT NULL,
verb VARCHAR(30) NOT NULL,
data1 VARCHAR(30) NOT NULL,
data2 VARCHAR(30) NOT NULL,
data3 VARCHAR(30) NOT NULL,
data4 VARCHAR(30) NOT NULL,
serverid VARCHAR(10) NOT NULL default '0',
fileid INT(10) UNSIGNED,
recordid INT(10) UNSIGNED,
unique_row_count INT(10) UNSIGNED NOT NULL,
index(time_id),
index(call_id)
 );

CREATE INDEX time_id on queue_log(time_id);
CREATE INDEX call_id on queue_log(call_id);


Vicidial will start logging data to the table immediately without other modification?


Also, the best place to place the entry point for the script?

Re: Best way to implement integration for start and end of c

PostPosted: Thu Oct 16, 2014 5:15 am
by mflorell
You do have to enable and configure QM integration in the Admin -> System Settings portion of the web admin.

I'm not sure what your "entry point" question means.

Re: Best way to implement integration for start and end of c

PostPosted: Thu Oct 16, 2014 6:36 am
by mattisdada2
If you look at the original post it will go into more detail. But I need a script to run at the start and end of all calls with a single parameter being the unique id

Re: Best way to implement integration for start and end of c

PostPosted: Fri Oct 17, 2014 5:00 am
by mflorell
Does the script have to actually run right at the beginning and end of every call or can it run in batch mode every minute looking through the log for when every call is stopped and finished?

If it has to run immediately, then you will need to insert your code into several places in the source code manually since there is no universal external trigger for that event in Vicidial.

Re: Best way to implement integration for start and end of c

PostPosted: Fri Oct 17, 2014 5:18 am
by mattisdada2
Unfortunately yes :/ It integrates with a real time system that shows what each agent is doing at the time, 1 minute intervals are to long. 5-10 Seconds would be ok, but more than that might be problematic :/