Page 1 of 1

Inbound Call Routing to "the" outbound agent - Solved

PostPosted: Tue Aug 06, 2013 6:34 pm
by Noah
Problem: Single Campaign outbound agent calls type of dialing is "Manual_inbound" Owner only dialing. All the settings are good to go for Outbound. Works great. The problem is on the inbound call with CIDLOOKUP as the In-Group Call Handle Method, the record is found no problem. But we want to route it back to the agent that made the outbound call.

The agents are using a shared AC-CID for outbound so a DID for each agent inbound is not really an option here.

With all the inbound routing options I'm having trouble sorting out how I can get this inbound call back to the agent that made the outbound call...??

Any Ideas?


Asterisk 1.4.44-vici built by abuild @ build09 on a i686 running Linux on 2012-12-17
VERSION: 2.6-395a
BUILD: 130221-1736
© 2013 ViciDial Group

The Preferred Solution:
1. Create an ingroup for each agent - make appropriate no agent no queueing
2. Create an ingroup for failover if the agent is not in the group
3. Write a simple php get variable page with matching mysql to do the lookup
4. Put the extension at the bottom of extensions.conf
5. DID Route calls to this extension and context
6. This will look up the record using the callerid of the party calling in and find the last user to have spoke with this caller

Example php and exten below:
[custom context name]
exten => 8889,1,answer()
exten => 8889,n,NoOp(Testing web integration)
exten => 8889,n,NoOp(Phone number is ${CALLERID(num)})
exten => 8889,n,Set(user=${CURL(http://x.x.x.x/agentlookup.php?phone=${CALLERID(num)})})
exten => 8889,n,GotoIf($["${user}" != ""]?route1)
exten => 8889,n,GotoIf($["${user}" = ""]?route2)
exten => 8889,n(route1),AGI(agi-VDAD_ALL_inbound.agi,CIDLOOKUP-----SO-----${user}-----77777777777-----${CALLERID(num)}-----park----------999----------)
exten => 8889,n(route2),AGI(agi-VDAD_ALL_inbound.agi,CIDLOOKUP-----SO-----InboundAll-----77777777777-----${CALLERID(num)}-----park----------999----------)
exten => 8889,n,Hangup()

***** Found a better way *****
Route to the Agent direct group. The last variable references the AgentDirect to route to.
agi-VDAD_ALL_inbound.agi,CIDLOOKUP-----SO-----AGENTDIRECT-----77777777777-----${CALLERID(num)}-----park----------999---------------${user})
End ***** Found a better way *****



/////agentlookup.php/////
<?php
// Grab Variables from the call
$phone=$_GET['phone'];

// echo "For testing the phone number is $phone";

// Look for Agent that should get the call
$link = $mysql = mysql_connect('x.x.x.x', 'username', 'pass', 'DBNAME') or die(mysql_error());
mysql_select_db('msgasterisk', $mysql);
$result = mysql_query("select last_local_call_time,user from vicidial_list where phone_number = $phone order by last_local_call_time desc limit 0,1;");

$row1 = mysql_fetch_array ( $result );
echo $row1['user'];
?>

Re: Inbound Call Routing to "the" outbound agent - Solved

PostPosted: Wed Aug 07, 2013 6:36 pm
by williamconley
so when you marked it as "solved", you're saying your example worked well? are you posting this to the issue tracker for inclusion? :)

it merely needs a bit of tweaking to grab the mysql credentials (and use mysqli instead of mysql because it's deprecated), but otherwise looks great if it works. :)

Re: Inbound Call Routing to "the" outbound agent - Solved

PostPosted: Thu Aug 08, 2013 1:56 pm
by Noah
Yes deprecated code will need to be updated.
This was not listed as an issue, but is a feature that is of significant importance in many client cases.
Inbound direct agent calls without having to manage hundreds of DID's for direct callback to the outbound agent.

Tested Works great...
And then on top all of the call control related functions with the "Ingroup" are now available for intelligent call routing.

Tracker Link.

http://www.vicidial.org/VICIDIALmantis/view.php?id=692

Re: Inbound Call Routing to "the" outbound agent - Solved

PostPosted: Thu Aug 08, 2013 4:20 pm
by williamconley
Not bad for 22 posts.

you should definitely add it to the issue tracker and link here. Matt may include this script in the core (especially if you release it to The Vicidial Group explicitly). Then the next time you upgrade or install ... it'll already be there.

Re: Inbound Call Routing to "the" outbound agent - Solved

PostPosted: Mon Feb 03, 2014 5:49 pm
by Noah
We've updated slightly....see exten notes below

If you choose AGENTDIRECT as the ingroup you can utilize all the ingroup settings associated, and simply pass the agent variable at the end of the string.

exten => 8889,1,answer()
exten => 8889,n,NoOp(Testing web integration)
exten => 8889,n,NoOp(Phone number is ${CALLERID(num)})
exten => 8889,n,Set(user=${CURL(http://webserverip/agentlookup.php?phone=${CALLERID(num)})})
exten => 8889,n,GotoIf($["${user}" != ""]?route1)
exten => 8889,n,GotoIf($["${user}" = ""]?route2)
exten => 8889,n(route1),AGI(agi-VDAD_ALL_inbound.agi,CIDLOOKUP-----SO-----AGENTDIRECT----------${CALLERID(num)}-----park----------999---------------${user})
exten => 8889,n(route2),AGI(agi-VDAD_ALL_inbound.agi,CIDLOOKUP-----SO-----InboundLocal----------${CALLERID(num)}-----park----------999----------)
exten => 8889,n,Hangup()

Re: Inbound Call Routing to "the" outbound agent - Solved

PostPosted: Mon May 16, 2016 9:17 am
by dreedy
This seems like a useful item to have in the inbound routing. I see that this is an old post was there any further progress on this? I am close to the current svn up and i don't really see anything about this.