solution

General and Support topics relating to ViciDialNow and GoAutoDial ISO installers

Moderators: enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, s0lid

solution

Postby DowNetworks » Fri Feb 29, 2008 12:39 pm

here is my solution to the problem with queuemetrics.

Does not matter if you have queuemetrics in a remote location or local in the same computer ( need to do one more step ) you will have the same problem of agent/0000000000 instead of the SIP/XXXX or IAX/XXXX.

As i'm not an expert on AGI programing i apologize if you found that what i did is doing to many rounds ( at least it works :D ), btw, i'm not using the addon of queuemetrics that is in the software because i don't even understand it so i did my way:

steps:

1.- Ones you have vicidialnow already installed in your computer and you test that it works with at least the regular example ( 7777 ) you can start working on queuemetrics:

a-) remote queuemetrics: nothing to do her at this moment just wait for the call.

b-) local queuemetrics: in this case you have to stop the iptables of the server or add the por 8080 to the rules so it allow you to pass that port to the local computer. I stop them doing /etc/init.d/iptable stop, and just to be sure that it will never came back up i did chkconfig iptables off ( this will take the iptables off from the startup configuration ).

Note: if you don't know where to found queuemetrics or how to install it you can access http://www.queuemetrics.com and follow instructions ( using yum is really fast )

2.- Ones you have queuemetrics install and vicidial working, you need to configure the dialplan on vicidial to dial into queuemetrics so you cna have records of that, so what i did is on the 91NXXNXXXXXX i change some lines so instead of dialing to the trunk directly it will dial local to the queuemetrics first and then the queuemetrics dialplan will dial the trunk, here are the lines:

exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _91NXXNXXXXXX,2,Dial(Local/100${EXTEN}@queuedial_d1/n)
exten => _91NXXNXXXXXX,3,Hangup

then in the same extensions.conf but at the end so it does not interrupt with the rest of vicidial information i put:

[queuedial_d1]
exten => _XXX.,1,SetVar(MY_QUE=${EXTEN:0:3})
exten => _XXX.,2,SetVar(MY_NUM=${EXTEN:3})
exten => _XXX.,3,SetVar(MY_AGENT=${CALLERIDNAME:4})
exten => _XXX.,4,NoOp,Ag: ${MY_AGENT} N: ${MY_NUM} Q: ${MY_QUE}
exten => _XXX.,5,MixMonitor(Q-${MY_QUE}-${MY_AGENT}-${UNIQUEID}.wav|b|)
exten => _XXX.,6,DeadAGI(queueDial.agi|${MY_NUM}|SIP/${MY_NUM}@Inter_queuemetrics|q-${MY_QUE}|Agent/${MY_AGENT})
exten => _XXX.,7,Congestion

as you can see it gets the call set some viariables and then place the call. Here i use queueDial.agi if you don't have that agi then queuemetrics people can provide it for you. ( i can't put it here because is not my develop ). Normally it comes with a regular installation.

Note: line 3 is part of the main solution so have that in front of you so you understand that part when i say something about it.

Note: the Inter_queuemetrics is a sip trunk that i created between the vicidialnow server and the queuemetrics server. If you have the queuemetrics install in the same computer then just change inter_queuemetrics for the name of your VoIp provider sip trunks or iax trunks.

3.- then you have to create a new queue in queuemetrics web section call q-100 ( i use 100 on the dial plan so have to call it q-100 but you can use another number in the dial plan just remember to set q-xxxx where xxxx is your new number ).

4.- when you have that done, if you dial with the test extension without using the dialer just regular dial you will found that the call apears in queuemetrics in live monitoring section and on the reports. ( if you don't have a sip VoIp provider then you can't dialout but at least it will apears in the reports of queuemetrics, check www.downetworks.com for VoIp provider in case you don't have or you want to have one ), you will found that it will say agent/xxxx where xxxx is the extension from where you are dialing ( in this case agent/7777 )

5.- If you load a list you will get to may main problem, instead to say agent/7777 it says agent/0000000000 for any call that the dialer does and don't matter what agent call it will be always agent/00000000. So here is where my investigation starts until i found this way to fix it:

5.1- I found that vicidial puts a different Callerid(name) for each call that it mades and is different for each agent too so this means that each call with have his own unique name in the Callerid(name) and that is where i got the idea to do agi scripts.

5.2- I create a temporal table in the asterisk database where i'm going to store the user that is on the conference room and the CallerId(name) of that room at the moment ( i mean the call that the room is doing using the dialer ). So you have to do get into mysql ( normally with mysql mysql you will be in if not then do mysql -u root -p , then hit enter and put the root password that most of the time works ).

Ones you are inside of mysql then do "use asterisk" to use the database and then run "create table vicidial_userroom (extensi varchar(8),room varchar(20));" and create it.

Then give access from the environment on the database asterisk to the user that you want to use and the password that you deside to set in this way: "grant all privileges on asterisk.* to put-your-username-here@127.0.0.1 identified by 'Put-your-password-here';" and grant it.

5.3- Ones all the new table is created get out of mysql and get into this folder "cd /var/lib/asterisk/agi-bin/" here is where all the scripts normally are located.

Now create this 3 scripts:

script1.agi:

#!/usr/bin/perl

use DBI;
use Asterisk::AGI;

$AGI = new Asterisk::AGI;

$|=1;

while(<STDIN>) {
chomp;
last unless length($_);
if (/^agi_(\w+)\:\s+(.*)$/) {
$AGI{$1} = $2;
}
}

$dsn = "DBI:mysql:asterisk;127.0.0.1;3306";
$dbh = DBI->connect($dsn,your-grant-user,your-grant-password);
$drh = DBI->install_driver("mysql");

my $query = "select extension from vicidial_conferences where conf_exten = $ARGV[0]";

$sth = $dbh->prepare($query);
$sth->execute;

$AGENTLOGIN = $sth->fetchrow;
$CLIDNAME = $AGI{calleridname};

$sth->finish;

my $query2 = "insert into vicidial_userroom (extensi,room) values ('$AGENTLOGIN','$CLIDNAME')";

$sth = $dbh->prepare($query2);
$sth->execute;

$sth->finish;


$dbh->disconnect();

Note: this first script what it does is take the roomid and select the conference table of vicidial to get the userid that is waiting there for a call and write it on the userroom table that we create before and it will write the callerid(name) from the environment variable that asterisk pass to the agi in a global way every time that the agi is called.

With this info we got the unique id of the call and the agent that will get that call if it works so you can use it.

setid.agi:

#!/usr/bin/perl

use DBI;
use Asterisk::AGI;

$AGI = new Asterisk::AGI;

$|=1;

while(<STDIN>) {
chomp;
last unless length($_);
if (/^agi_(\w+)\:\s+(.*)$/) {
$AGI{$1} = $2;
}
}

$dsn = "DBI:mysql:asterisk;127.0.0.1;3306";
$dbh = DBI->connect($dsn,your-grant-user,your-grant-password);
$drh = DBI->install_driver("mysql");

$CLIDNAME = $AGI{calleridname};

my $query3 = "select extensi from vicidial_userroom where room = '$CLIDNAME'";

$sth = $dbh->prepare($query3);
$sth->execute;

$AGENTLOGIN = $sth->fetchrow;

$AGI->set_callerid($AGENTLOGIN);

$sth->finish;

$dbh->disconnect();

Note: this script will be the one that change the callerid from 0000000 to the one for the agent, this means SIP/7777. ( need to see dialplan coming next on this install ).

erasetemptable.agi:

#!/usr/bin/perl

use DBI;
use Asterisk::AGI;

$AGI = new Asterisk::AGI;

$|=1;

while(<STDIN>) {
chomp;
last unless length($_);
if (/^agi_(\w+)\:\s+(.*)$/) {
$AGI{$1} = $2;
}
}

$dsn = "DBI:mysql:asterisk;127.0.0.1;3306";
$dbh = DBI->connect($dsn,root,vici);
$drh = DBI->install_driver("mysql");

$TEST = $AGI{calleridname};

$AGI->exec('NoOp',$AGI{calleridname});

my $query = "delete from vicidial_userroom where room = '$TEST'";

$sth = $dbh->prepare($query);
$sth->execute;

$sth->finish;

$dbh->disconnect();

Note: this will simply erase the CallerId(name) of the temp table when the call finish. ( option h of the call )

5.4- Now is time to change the dial way fo the dialer so it use the scripts that we just create:

5.4.1- open extensions.conf and look for the conference room of vicidial, if you don't change nothing it will be 8600051, so ones you are there do this:

exten => 8600051,1,DeadAgi(script1.agi|${EXTEN})
exten => 8600051,2,meetme,8600051

as you can see i move the line number "1" to number "2" and i put the on the line "1" the call of the first script ( the one that writes into the temp table the info ) and the param that i'm passing is the roomid so i can do the first select in the agi.

5.4.2- find the dialplan that you want to change ( im going to use for the example the _91NXXNXXXXXX ( same as the top one so you can see the diference ):

exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _91NXXNXXXXXX,2,DeadAGI(setid.agi)
exten => _91NXXNXXXXXX,3,Dial(Local/100${EXTEN}@queuedial_d1/n)
exten => _91NXXNXXXXXX,4,Hangup

i insert the line number "2" that calls the setid.agi script that set the callerid to the real agent inside the room.

Note: set_callerid() function in the agi will set the callerid(name) and not the callerid(num) in this case because i have SIP/7777 and not just 7777 into the temp table in the database.

as i mension in the solution i say that the line number "3" in the quedialplan of queuemetrics that we set at the en of extensions.conf will be need it for the scripts, so where is the line if you don't remember:

exten => _XXX.,3,SetVar(MY_AGENT=${CALLERIDNAME:4})

what this line does is set one variable call MY_AGENT with just the 7777 by trunking the first 4 digits of the callerid(name) set id by the setid.agi script.

Until this section everything will work perfect on a local installation but on remote queuemetrics location you have to add one more line to the dialplan like this:

exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _91NXXNXXXXXX,2,DeadAGI(setid.agi|${AGENTLOGIN})
exten => _91NXXNXXXXXX,3,Set(CALLERID(num)=${CALLERID(name):4})
exten => _91NXXNXXXXXX,4,Dial(SIP/${EXTEN:1}@Inter_queuemetrics,,r)
exten => _91NXXNXXXXXX,5,Hangup

you can see that is one new line ( line number "3" ) that change the callerid(num) with the content of callerid(name) trunking the first 4 digits, this means SIP/7777 will be 7777 when the trunk is call.

5.4.3- All what you has been done already will allow you do star using queuemetrics with no problems and it will set the callerid when you dial over the vicidialnow with no problems but there is one more think that you have to have in mind, if you don't erase the records in your table it will get huge fast and it will be just a nightmare so we are going to use the script number 3.

find the h,1 section so you can be at the hangup section of the calls and change it this way

exten => h,1,DeadAGI(agi://127.0.0.1:4577/call_log)
exten => h,2,DeadAGI(erasetemptable.agi)
exten => h,3,DeadAGI(agi://127.0.0.1:4577/VD_hangup--HVcause ... EBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME}))

what we change is that we insert the our script in the line number "2" right before the hangup call of the vicidialnow, this will found the callid name in our temp table and erase it before the call is hangup by the vicidialnow ( the call is already hangup for the agent or customer ).

and this is my solution to the problem of agent/0000000 caller id, i hope this help you getting queuemetrics working

Downetworks
DowNetworks
 
Posts: 22
Joined: Thu Feb 21, 2008 10:01 am

Postby Op3r » Fri Feb 29, 2008 12:49 pm

Hello

Nice work!

Can you put that on the tracker?
Get paid for US outbound Toll Free calls. PM me.
Op3r
 
Posts: 1432
Joined: Wed Jun 07, 2006 7:53 pm
Location: Manila

Postby DowNetworks » Fri Feb 29, 2008 2:32 pm

sorry i don't know what the tracker is but if you tell me i will sure
DowNetworks
 
Posts: 22
Joined: Thu Feb 21, 2008 10:01 am

Postby Op3r » Fri Feb 29, 2008 2:53 pm

Click on the top menu of this site it says VICIDIAL Issue Tracker

or go here http://www.eflo.net/VICIDIALmantis

:)

thanks
Get paid for US outbound Toll Free calls. PM me.
Op3r
 
Posts: 1432
Joined: Wed Jun 07, 2006 7:53 pm
Location: Manila

Postby mflorell » Fri Feb 29, 2008 5:27 pm

Thank you very much for posting this. I had assumed that you were using the QueueMetrics features that are built in to vicidial(in the System Settings Admin page) but it looks like from this that you are trying to get it to work independently of all of the integration work Ihave already done in VICIDIAL. Have you tried configuring QueueMetrics in the System Settings for VICIDIAL outbound calling?
mflorell
Site Admin
 
Posts: 18384
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida

Postby DowNetworks » Tue Mar 04, 2008 9:25 am

no i don't try because i don't know how it works ( your work of queuemetrics ). I put info there even i have in my test lab 1 server with vicidial and queuemetrics all in one but i don't know how that section works. If you tell me i will try to use it.
DowNetworks
 
Posts: 22
Joined: Thu Feb 21, 2008 10:01 am

Postby mflorell » Tue Mar 04, 2008 1:36 pm

in admin.php go to Admin -> System Settings

Then set the QueueMetrics database connection settings and set Enable Queuemetrics Logging to "1" and VICIDIAL outbound dialing logs will begin writing directly to the queue_log table on your QueueMetrics database.
mflorell
Site Admin
 
Posts: 18384
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida


Return to ViciDialNow - GoAutoDial

Who is online

Users browsing this forum: No registered users and 122 guests