#20 Add callID testing to registrar:registered()

trunk
closed-accepted
modules (179)
5
2009-09-17
2008-09-09
Kobi Eshun
No

Attached is a small patch to facilitate managing multiple registration instances using the same credentials. It introduces a new module AVP, reg_callid_avp. If reg_callid_avp is defined and populated when registered() is invoked, the result is TRUE only if an active registration with the specified callID is found.

We use the enhanced functionality to facilitate provisioning and management of our clients -- it allows us to reliably distinguish between new registrations and re-registration of an existing sessions.

This is an updated version of patch #1824748 submitted to OpenSER that did not get accepted until after The Fork. It includes corrections by Henning Westerholt, but omits his changes to the documentation. Would you consider applying it to OpenSIPS?

Cheers,
--
kobi

Discussion

  • Bogdan-Andrei Iancu

    Kobi, the value you pass in the AVP (the callid to check) - where do you get it from (I'm from scenario point of view) ?

     
  • Bogdan-Andrei Iancu

    • assigned_to: nobody --> bogdan_iancu
     
  • Kobi Eshun

    Kobi Eshun - 2009-09-17

    Bogdan,

    I pull the callID straight from the REGISTER request.

    Cheers,
    --
    kobi

    avp_aliases = "
    reg_aor_avp=i:988;
    reg_callid_avp=i:989;
    ...
    "
    ...
    modparam("registrar", "aor_avp", "$avp(i:988)")
    modparam("registrar", "reg_callid_avp", "$avp(i:989)")

    ...
    route
    {
    ...
    if (is_method("REGISTER")) {
    ...
    $avp(reg_aor_avp)=$tu;
    $avp(reg_callid_avp)=$ci;
    if (registered("location"))
    setsflag(SFLAG_IS_REGISTERED);
    else
    resetsflag(SFLAG_IS_REGISTERED);
    ...
    };
    }

     
  • Bogdan-Andrei Iancu

    I made a slightly modify version of this patch - instead of using an AVP to pass the callid, the "registered" function do take a third optional parameter :
    ....
    if (registered("location","$tu","$ci"))
    setsflag(SFLAG_IS_REGISTERED);
    else
    resetsflag(SFLAG_IS_REGISTERED);
    ...

    Regards,
    Bogdan

     
  • Bogdan-Andrei Iancu

    • status: open --> closed-accepted
     

Log in to post a comment.