Mid-Registrar Absorb 2nd Register(w/ AuthHeader) Request - Only on Reg Renewal.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Mid-Registrar Absorb 2nd Register(w/ AuthHeader) Request - Only on Reg Renewal.

Ali Raza
Hello Guys,

I am new to OpenSIPS. I am currently test mid-registrar module with FreeSwitch and I am facing a issue not sure if its a bug or its me.

Let me explain whats happening:

I am running OpenSIPS  mid-registrar in contact-throttling mode(mode:1) with usrloc mode:0 - because mid-registrar was crashing again and again then I saw the post https://github.com/OpenSIPS/opensips/issues/1094 - so that issue is now gone with  usrloc mode:0.

When I run opensips my devices(soft phone: zopier and sip phone: fanvil) register perfectly but as soon the registration time for fanvilphone is reaching expiry(outging expiry) opensips passes my registrartion request to freeswitch - Freeswitch sends back 401unauthorised message which is delivered to the phone by opensips. This time phone sends register request with AuthHeader but this request gets absorbed by mid-registrar and reply from UAC with AuthHeader never reach UAS and freeswitch then remove the registrartion from its database assuming the UAC is dead. But when the softphone-Zopier outgoing register expiring somehow Softphone sends the register request with AuthHeader and as OpenSIPs forwards 1 register request to freeswtich - Freeswitch renew its registrartion. So softphone remain registered and works fine.

2nd/Renew Registration from FanvilPhone:

1. UAC==Reg==>OpenSIPS==>FreeSwitch

2. FreeSwitch==401==>OpenSIPs==401==>UAC

3. UAC==Reg w/Auth-Header==>OpenSIPs(Absorbe by mid-registrar: Returncode: 2)

4. OpenSIPs==Reply 200==>UAC (so actually phone thinks its registered)

2nd/Renew Registration from SoftPhone Zopier:

1. SoftPhone==Reg w/Auth-Header==>OpenSIPs==Reg w/Auth-Header==>FreeSwitch

2. FreeSwitch==Reply 200==>OpenSIPs==Reply 200==>SoftPhone-Zopier.


MY OPENSIPS CONFIG -- USED FOR MID-REGISTRAR:

#### USeR LOCation module
loadmodule "usrloc.so"
modparam("usrloc", "nat_bflag", "NAT")
modparam("usrloc", "db_mode", 0)
modparam("usrloc", "use_domain", 1)

#### MID-REGISTRAR module
loadmodule "mid_registrar.so"
modparam("mid_registrar", "mode", 1) /* 0 = mirror / 1 = ct / 2 = AoR */
modparam("mid_registrar", "outgoing_expires", 180) ##Set to low for testing purpose.
modparam("mid_registrar", "insertion_mode", 0) /* 0 = contact; 1 = path */

if ( !(is_method("REGISTER")) ) {
        if (check_source_address("10")) {
              xlog("looking up $ru!\n");
              if (!mid_registrar_lookup("location")) {
                   t_reply("404", "Not Found");
                   exit;
              }

              t_relay();
              exit;
       }
}

if (is_method("REGISTER"))
{
     #mid_registrar_save("location");
     xlog("BEFORE IT PASS TO MID-REG SAVE!");
     mid_registrar_save("","m");
     switch ($retcode) {
     case 1:
          xlog("forwarding REGISTER to main registrar ($$ci=$ci) - $fd\n");
          #Call script to set $ru - Testing! 
          #perl_exec("dest_host","$fd");
          $ru = "sip:dispatcher\@10.10.7.206:5070";
          xlog("NEW HOST VALUE: $ru");
          t_relay();
          break;
    case 2:
         xlog("absorbing REGISTER! ($$ci=$ci)\n");
         break;
    default:
         xlog("failed to save registration! ($$ci=$ci)\n");
    }
    exit;
}


LET ME KNOW IF YOU NEED ANYTHING ELSE. 

THANKS!

Regards
Ali Raza


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

Re: Mid-Registrar Absorb 2nd Register(w/ AuthHeader) Request - Only on Reg Renewal.

Liviu Chircu

Thanks for the nice report, Ali - I'm already testing a fix for this, and will keep you posted!

Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com
On 12.07.2017 16:26, Ali Raza wrote:
Hello Guys,

I am new to OpenSIPS. I am currently test mid-registrar module with FreeSwitch and I am facing a issue not sure if its a bug or its me.

Let me explain whats happening:

I am running OpenSIPS  mid-registrar in contact-throttling mode(mode:1) with usrloc mode:0 - because mid-registrar was crashing again and again then I saw the post https://github.com/OpenSIPS/opensips/issues/1094 - so that issue is now gone with  usrloc mode:0.

When I run opensips my devices(soft phone: zopier and sip phone: fanvil) register perfectly but as soon the registration time for fanvilphone is reaching expiry(outging expiry) opensips passes my registrartion request to freeswitch - Freeswitch sends back 401unauthorised message which is delivered to the phone by opensips. This time phone sends register request with AuthHeader but this request gets absorbed by mid-registrar and reply from UAC with AuthHeader never reach UAS and freeswitch then remove the registrartion from its database assuming the UAC is dead. But when the softphone-Zopier outgoing register expiring somehow Softphone sends the register request with AuthHeader and as OpenSIPs forwards 1 register request to freeswtich - Freeswitch renew its registrartion. So softphone remain registered and works fine.

2nd/Renew Registration from FanvilPhone:

1. UAC==Reg==>OpenSIPS==>FreeSwitch

2. FreeSwitch==401==>OpenSIPs==401==>UAC

3. UAC==Reg w/Auth-Header==>OpenSIPs(Absorbe by mid-registrar: Returncode: 2)

4. OpenSIPs==Reply 200==>UAC (so actually phone thinks its registered)

2nd/Renew Registration from SoftPhone Zopier:

1. SoftPhone==Reg w/Auth-Header==>OpenSIPs==Reg w/Auth-Header==>FreeSwitch

2. FreeSwitch==Reply 200==>OpenSIPs==Reply 200==>SoftPhone-Zopier.


MY OPENSIPS CONFIG -- USED FOR MID-REGISTRAR:

#### USeR LOCation module
loadmodule "usrloc.so"
modparam("usrloc", "nat_bflag", "NAT")
modparam("usrloc", "db_mode", 0)
modparam("usrloc", "use_domain", 1)

#### MID-REGISTRAR module
loadmodule "mid_registrar.so"
modparam("mid_registrar", "mode", 1) /* 0 = mirror / 1 = ct / 2 = AoR */
modparam("mid_registrar", "outgoing_expires", 180) ##Set to low for testing purpose.
modparam("mid_registrar", "insertion_mode", 0) /* 0 = contact; 1 = path */

if ( !(is_method("REGISTER")) ) {
        if (check_source_address("10")) {
              xlog("looking up $ru!\n");
              if (!mid_registrar_lookup("location")) {
                   t_reply("404", "Not Found");
                   exit;
              }

              t_relay();
              exit;
       }
}

if (is_method("REGISTER"))
{
     #mid_registrar_save("location");
     xlog("BEFORE IT PASS TO MID-REG SAVE!");
     mid_registrar_save("","m");
     switch ($retcode) {
     case 1:
          xlog("forwarding REGISTER to main registrar ($$ci=$ci) - $fd\n");
          #Call script to set $ru - Testing! 
          #perl_exec("dest_host","$fd");
          $ru = [hidden email];
          xlog("NEW HOST VALUE: $ru");
          t_relay();
          break;
    case 2:
         xlog("absorbing REGISTER! ($$ci=$ci)\n");
         break;
    default:
         xlog("failed to save registration! ($$ci=$ci)\n");
    }
    exit;
}


LET ME KNOW IF YOU NEED ANYTHING ELSE. 

THANKS!

Regards
Ali Raza



_______________________________________________
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
Loading...