[OpenSIPS-Users] Call pickup using EBR

Srigo Kanapathipillai ksrigo at gmail.com
Fri Oct 5 11:21:29 EDT 2018


I'm currently trying to add call pickup feature using event_routing module. It seems to work fine when I have only ONE inbound call to a given call group but when I have two calls to the same call group at the same, It's not working properly

Here is my scenario:

--> Opensips1 (usr_loc) --> Bob
Alice --> Opensips1 --> Freeswitch (fork)
--> Opensips1 (usr_loc) --> Charlie

David tries to pickup the phone ringing on Bob and Call (which is the same call because it's a fork but different A leg call_id)
Bob, Charlie and David are in the same pickup group.

When Bob and Charlies ring, David dials *0 to pick the call:
* Opensips immediately send an Invite to David for one of the incoming call (randomly choosen). Let's say for Bob
* Opensips send a Cancel to Bob
* Opensips send again the previous Invite to David (for the same A leg)
* Opensips send a Cancel to David

Here is my opensips code:

dp_translate("DP_FEATURE", "$rU/$rU", "$var(attrs)");
#Is it a callpickup?
if($var(attrs) =~ "call_pickup" && $avp(caller_pickup_grp) != "") {
t_newtran(); # 100 Trying is fired here

#extension can belong to multiple group so let's raise an event for each group
$var(p) = 0;
$var(caller_pickup_grp_len) = 0;
$var(caller_pickup_grp_len) = $(avp(caller_pickup_grp){csv.count});
while ($var(p) < $var(caller_pickup_grp_len)) {
$avp(attr-name) = "group";
$avp(attr-val) = $(avp(caller_pickup_grp){csv.value,$var(p)});
xlog("L_NOTICE","$rm $ci hunting2: Caller pickup group [$avp(attr-val)] for [$fu]");
$avp(attr-name) = "picker";
$avp(attr-val) = $fu;
raise_event("E_CALL_PICKUP", $avp(attr-name), $avp(attr-val));
$var(p) = $var(p) + 1;

if (isbflagset(USRLOC_FOUND) && $avp(callee_pickup_grp) != ""){
$var(p) = 0;
$var(callee_pickup_grp_len) = 0;
$var(callee_pickup_grp_len) = $(avp(callee_pickup_grp){csv.count});
while ($var(p) < $var(callee_pickup_grp_len)) {
#$avp(filter) = "group=1";
$avp(filter) = "group="+$var(group);
xlog("L_NOTICE","$rm $ci relay: Callee pickup group [$var(group)]. Raise event");
notify_on_event("E_CALL_PICKUP","$avp(filter)","handle_pickup", "20");
$var(p) = $var(p) + 1;

if (!t_relay()) {
xlog("L_WARN","$rm $ci relay: 500 Internal Server Error (t_relay failure)");
t_reply("500","Internal Server Error");
$avp(reason) = "SIP;cause=500;text=INTERNAL SERVER ERROR";

Any idea, what I missed here?

Thanks in advance for your help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20181005/c273eef8/attachment.html>

More information about the Users mailing list