Author Topic: Displaying Caller's name with CallerID using MySQL Storage  (Read 5075 times)

shermster

  • Newbie
  • *
  • Posts: 1
  • Karma: 1
    • View Profile
A customer of ours wanted to display the names of their customers along with their incoming caller IDs in the Qeuemetrics reports.  So we've developed a small patch for the qloader.pl file that enables this. 

Please note that this patch was tested with Queuemetrics 1.3.2 and qloader version 1.2 on Centos 4.3.

The first thing that is needed is the LWP library for Perl.  At the Linux command prompt type the following

perl -MCPAN -e 'install Bundle::LWP'

Accept all the default values as they should be fine.

Open up qloader.pl in your favorite editor

Add the following lines marked in bold towards the top of the file

use DBI;
use LWP;
my $browser = LWP::UserAgent->new;

my $mysql_host = "127.0.0.1";

Then in the subroutine that inserts new lines add the following

       # salta le linee che non hanno verbo
        if ( length($verb) == 0 ) {
                return;
        }

     
        if ( $verb eq "ENTERQUEUE" ) {
        my $url = 'http://192.160.60.190:8080/index.asp';
        $url = $url . "?callerid=" . $d2;
        $browser->timeout(2);
        my $response = $browser->get( $url );
        if ($response->is_success){
                my $callerid = $response->content;
                $d2 = substr($d2,0,-1) . " " . $callerid;
                $d2 = substr($d2,0,30);  #make sure the length is only 30 characters (database limit)
                }
        }


        ($tst, $cid, $que, $age, $verb, $d1, $d2, $d3)  = map { myQuote($_) } ($tst, $cid, $que, $age, $verb, $d1, $d2, $d3);

        my $sql = " INSERT INTO `queue_log`
                ( `partition` , `time_id` , `call_id` , `queue` , `agent` , `verb` , `data1` , `data2` , `data3` , `data4` )
                 VALUES
                ( '$partition', $tst, $cid, $que, $age, $verb, $d1, $d2, $d3, '' );";

The script will pass the callerid to a webpage as a GET parameter
e.g. http://192.160.60.190:8080/index.asp?callerid=123456789

When the webpage runs it returns the customer's name if known or 'Unknown' if its not.  The webpage programming is left as an exercise for the reader   :)

The cool thing about this patch is that if you're using outbound queue then it works too.

Have fun using it

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: Displaying Caller's name with CallerID using MySQL Storage
« Reply #1 on: May 30, 2007, 09:37:08 »
Man , you rock! +1 karma from me  8)