Autodial outbound get phone extension

All installation and configuration problems and questions

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

Autodial outbound get phone extension

Postby fido » Sat Feb 10, 2018 9:09 pm

Hello,
I have 2 small call centers that work on the same server and the agents always work on the same campaign. For billing purposes i need to add a prefix to calls send by each call center. After, on my softswitch server i can se exactly the expenses of each call center, based on prefix.
1. Can i get the ip of each call and based on ip i can send a prefix before the called number ?
2. Can i get the phone extension that sends the call ?
3. Can i get the user group that sends the call ?

For the moment i tryed the second option, i created a perl script that get the phone extension, i can get the phone when i manually call from softphone and when i manually call from agent web panel, but i cant get the phone extension in autodial mode.
Call center 1 use phones 3000, 3001, 3002 etc and user group cc1
Call center 2 use phones 4000, 4001, 4002 etc and user group cc2
I use the script to get the first number of phone and use like prefix, calls with prefix 3 comes from call center 1 and with prefix 4 from call center 2

Perl script:
Code: Select all
if ($callerid != 'unknown') { #call comes from softphone
   $substring = substr($callerid, 0, 1); #get the first number from phone extension and use like prefix
   $fido_agentPhone = $substring;
} else { #call comes from vicidial
   $stmtA = "SELECT extension FROM vicidial_live_agents WHERE callerid = '$calleridname' LIMIT 1";
   $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
   $sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
   $sthArows=$sthA->rows;
   $s=0;
   while ($sthArows > $s) {
      @aryA = $sthA->fetchrow_array;
      my ( $substring ) =  $aryA[0]=~ /([^\/]+$)/;
      $substring = substr($substring, 0, 1); #get the first number from phone extension and use like prefix
      $fido_agentPhone = $substring;
      $s++;
   }
   $sthA->finish();
}   

$AGI->set_variable('fido_agentPhone', $fido_agentPhone);


From my softswitch server i expect the number to be in this format:
390C3C123456789 -> C3C -> call comes from first call center
390C4C123456789 -> C4C -> call comes from second call center

My dialplan:
Code: Select all
exten => _390.,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _390.,n,AGI(fido_getAGENTphone.agi)
exten => _390.,n,Set(CALLERID(num)=3902222222222)
exten => _390.,n,Dial(${TRUNK}/390C${fido_agentPhone}C${EXTEN:3},,tTo)
exten => _390.,n,Hangup


Everything works great for manual calls, the billing etc, but i don't know what to do for autodial outbound. Is there a way to get the phone extension or user group or ip?
Last, on the campaign settings, i enabled Extension Append CID: Y , but this works only for manual calls.

Thank you!

Config: Vicibox 8.0.1 from .iso | Vicidial 2.14-650a Build 180111-1544 | Asterisk 11.25.3 | Single Server | No Digium/Sangoma Hardware | No Extra Software After Installation
fido
 
Posts: 2
Joined: Fri Apr 26, 2013 4:31 pm

Return to Support

Who is online

Users browsing this forum: No registered users and 73 guests