Callpickup using EBR

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Callpickup using EBR

Srigo Kanapathipillai
Hi,

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
        send_reply("480","Gone");

        #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;
        }
        exit;
    }


    if (isbflagset(USRLOC_FOUND) && $avp(callee_pickup_grp) != ""){
        t_newtran();
        $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";
            $var(group)=$(avp(callee_pickup_grp){csv.value,$var(p)});
            $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";
        route(REASON);
    }
    exit;


Any idea, what I missed here?

Thanks in advance for your help
Srigo




_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Callpickup using EBR

Bogdan-Andrei Iancu-2
Hi Srigo,

So, the calls between FS and Bob/Charlie are 2 different SIP calls,
right ? and you do EBR on each of them (on the OpenSIPS with usrloc, rigth ?

As I understand from your description, the faulty step is the last one
when David takes a CANCEL too, right ? Do you have pcaps + debug logs
for this scenario ?

Regards,

Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
   http://www.opensips-solutions.com
OpenSIPS Bootcamp 2018
   http://opensips.org/training/OpenSIPS_Bootcamp_2018/

On 10/05/2018 12:40 PM, KSrigo wrote:

> Hi,
>
> 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
>          send_reply("480","Gone");
>
>          #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;
>          }
>          exit;
>      }
>
>
>      if (isbflagset(USRLOC_FOUND) && $avp(callee_pickup_grp) != ""){
>          t_newtran();
>          $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";
>              $var(group)=$(avp(callee_pickup_grp){csv.value,$var(p)});
>              $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";
>          route(REASON);
>      }
>      exit;
>
>
> Any idea, what I missed here?
>
> Thanks in advance for your help
> Srigo
>
>
>
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Callpickup using EBR

Srigo Kanapathipillai
Hi Bogdan,

- Yes calls to fs and Bob, fs and Charlie are 2 differents calls (different from-tag/call-id). 
- Yes EBR is done on each fs leg.

Yes for some reason when David takes the call, Opensips send an Invite to David and Cancel one of fs leg (which is the normal behavior) but then it send again an invite to David and Cancel it.
 
here is debug log: https://pastebin.com/48xqKi3Y



Thanks in advance 
Srigo

On Oct 5, 2018, at 6:08 PM, Bogdan-Andrei Iancu <[hidden email]> wrote:

Hi Srigo,

So, the calls between FS and Bob/Charlie are 2 different SIP calls, right ? and you do EBR on each of them (on the OpenSIPS with usrloc, rigth ?

As I understand from your description, the faulty step is the last one when David takes a CANCEL too, right ? Do you have pcaps + debug logs for this scenario ?

Regards,

Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
 http://www.opensips-solutions.com
OpenSIPS Bootcamp 2018
 http://opensips.org/training/OpenSIPS_Bootcamp_2018/

On 10/05/2018 12:40 PM, KSrigo wrote:
Hi,

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
        send_reply("480","Gone");

        #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;
        }
        exit;
    }


    if (isbflagset(USRLOC_FOUND) && $avp(callee_pickup_grp) != ""){
        t_newtran();
        $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";
            $var(group)=$(avp(callee_pickup_grp){csv.value,$var(p)});
            $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";
        route(REASON);
    }
    exit;


Any idea, what I missed here?

Thanks in advance for your help
Srigo




_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

call_pickup.pcap (78K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Callpickup using EBR

Srigo Kanapathipillai
Hi Bogdan,

Any updates regarding this issue?

Thanks
Srigo Kana
On 8 Oct 2018, at 16:58, KSrigo <[hidden email]> wrote:
Hi Bogdan,

- Yes calls to fs and Bob, fs and Charlie are 2 differents calls (different from-tag/call-id). 
- Yes EBR is done on each fs leg.

Yes for some reason when David takes the call, Opensips send an Invite to David and Cancel one of fs leg (which is the normal behavior) but then it send again an invite to David and Cancel it.
 
here is debug log:  https://pastebin.com/48xqKi3Y


Thanks in advance 
Srigo

On Oct 5, 2018, at 6:08 PM, Bogdan-Andrei Iancu < [hidden email]> wrote:

Hi Srigo,

So, the calls between FS and Bob/Charlie are 2 different SIP calls, right ? and you do EBR on each of them (on the OpenSIPS with usrloc, rigth ?

As I understand from your description, the faulty step is the last one when David takes a CANCEL too, right ? Do you have pcaps + debug logs for this scenario ?

Regards,

Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  http://www.opensips-solutions.com
OpenSIPS Bootcamp 2018
  http://opensips.org/training/OpenSIPS_Bootcamp_2018/

On 10/05/2018 12:40 PM, KSrigo wrote:
Hi,

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
        send_reply("480","Gone");

        #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;
        }
        exit;
    }


    if (isbflagset(USRLOC_FOUND) && $avp(callee_pickup_grp) != ""){
        t_newtran();
        $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";
            $var(group)=$(avp(callee_pickup_grp){csv.value,$var(p)});
            $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";
        route(REASON);
    }
    exit;


Any idea, what I missed here?

Thanks in advance for your help
Srigo




_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Callpickup using EBR

Bogdan-Andrei Iancu-2
Hi Srigo,

I checked the output, but I see no messages/logs from the event_routing module. Maybe I got it wrong :( ?

Regards,
Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  http://www.opensips-solutions.com
OpenSIPS Bootcamp 2018
  http://opensips.org/training/OpenSIPS_Bootcamp_2018/
On 10/22/2018 03:31 PM, Srigo Kanapathipillai wrote:
Hi Bogdan,

Any updates regarding this issue?

Thanks
Srigo Kana
On 8 Oct 2018, at 16:58, KSrigo <[hidden email]> wrote:
Hi Bogdan,

- Yes calls to fs and Bob, fs and Charlie are 2 differents calls (different from-tag/call-id). 
- Yes EBR is done on each fs leg.

Yes for some reason when David takes the call, Opensips send an Invite to David and Cancel one of fs leg (which is the normal behavior) but then it send again an invite to David and Cancel it.
 
here is debug log:  https://pastebin.com/48xqKi3Y


Thanks in advance 
Srigo

On Oct 5, 2018, at 6:08 PM, Bogdan-Andrei Iancu < [hidden email]> wrote:

Hi Srigo,

So, the calls between FS and Bob/Charlie are 2 different SIP calls, right ? and you do EBR on each of them (on the OpenSIPS with usrloc, rigth ?

As I understand from your description, the faulty step is the last one when David takes a CANCEL too, right ? Do you have pcaps + debug logs for this scenario ?

Regards,

Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  http://www.opensips-solutions.com
OpenSIPS Bootcamp 2018
  http://opensips.org/training/OpenSIPS_Bootcamp_2018/

On 10/05/2018 12:40 PM, KSrigo wrote:
Hi,

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
        send_reply("480","Gone");

        #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;
        }
        exit;
    }


    if (isbflagset(USRLOC_FOUND) && $avp(callee_pickup_grp) != ""){
        t_newtran();
        $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";
            $var(group)=$(avp(callee_pickup_grp){csv.value,$var(p)});
            $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";
        route(REASON);
    }
    exit;


Any idea, what I missed here?

Thanks in advance for your help
Srigo




_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users




_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users