[SR-Users] Registrar Module

Dan Quinney danq at dial9.co.uk
Sun Sep 30 18:38:34 CEST 2018


Hi,

So, route[REGISTRAR_1] will, when the max_contacts is reached, reply to the endpoint with a 503 error containing a "P-Registrar-Error: Too many registered contacts" header - this seems wrong to me so I've tried to work around it with route[REGISTRAR_2] which returns the right response, but, also writes "INFO: registrar [save.c:615]: test_max_contacts(): too many contacts for AOR" to the log file, which is messy.

Does anyone have any pointers for doing this better?

Thanks,
Dan

route[REGISTRAR_1] {
if ( is_method("REGISTER") ) {
  if(isflagset(FLT_NATS)) {
    setbflag(FLB_NATB);
    setbflag(FLB_NATSIPPING);
  }

  if ($avp(maximum_contacts) != $null) {
    $xavp(reg=>max_contacts) = $avp(maximum_contacts);
  }

  save("location");
}
return;
}

route[REGISTRAR_2] {
if ( is_method("REGISTER") ) {
  if(isflagset(FLT_NATS)) {
    setbflag(FLB_NATB);
    setbflag(FLB_NATSIPPING);
  }

  if ($avp(maximum_contacts) != $null) {
    $xavp(reg=>max_contacts) = $avp(maximum_contacts);
  }

  save("location", "0x02");
  switch ($retcode) {
  case -1:
    sl_send_reply("500", "Server Internal Error");
    exit;
  case -2:
    sl_send_reply("403", "Forbidden");
    exit;
  };

  sl_send_reply("200", "OK");
}
return;
}


More information about the sr-users mailing list