#91 DROUTING - function for checking that gateway group

trunk
closed
modules (91)
5
2012-09-01
2012-04-12
No

I offer to add to drouting in addition to functions is_from_gw, goes_to_gw function, which can check any uri is from certain group.
Like ds_is_in_list in DISPATCHER.
is_from_gw and goes to gw now allow only to check from and destination uri, but not any uri.

For example,
is_gw(uri, [type, [flag]])

Discussion

  • Bogdan-Andrei Iancu

    • assigned_to: nobody --> bogdan_iancu
     
  • Bogdan-Andrei Iancu

    Hi Nick,

    Willing to do the patch ? as it is a nice functionality and it will be definitely accepted.

    Regards,
    Bogdan

     
  • Nick Altmann

    Nick Altmann - 2012-08-29

    Okay, I will make patch.
    How do you think, should I make new functions, or add parameter to existing functions?
    Like is_from_gw( [type, [flag, [avp]]] ):
    is_from_gw(type)
    is_from_gw(type, flag)
    is_from_gw(type, flag, avp)

    ?

     
  • Bogdan-Andrei Iancu

    I would say a new function, like "dr_is_gw() ", as you suggested

     
  • Nick Altmann

    Nick Altmann - 2012-08-29

    1.4.7. dr_is_gw(src_pv, [type, [flag]])

    The function checks if the ip address in pvar src_pv is a gateway
    from a certain group.

    This function can be used from REQUEST_ROUTE, ON_REPLY and FAILURE_ROUTE.

    Meaning of the parameters is as follows:
    * src_pv (mandatory) - pvar containing ip address.
    May be a script var or avp.
    * type (optional) - GW/destination type to be checked
    * flags (optional) - what operations should be performed when
    a GW matches:
    + 's' (Strip) - apply to the username of RURI the strip
    defined by the GW
    + 'p' (Prefix) - apply to the username of RURI the
    prefix defined by the GW
    + 'a' (Attributes) - return the attributes string
    defined by the GW

    Example 1.31. dr_is_gw usage
    ...
    if (dr_is_gw("$avp(uac)","3") {
    }
    ...

     
  • Nick Altmann

    Nick Altmann - 2012-08-29

    Patch to the last trunk (rev. 9233) attached.

     
  • Nick Altmann

    Nick Altmann - 2012-08-30
     
    Attachments
  • Bogdan-Andrei Iancu

    Nick, do not want to be picky, but shouldn't be better to have a SIP URI for the first param, instead of a socket like definition? usually in script you play around with SIP URIs and it is simpler to just feed the URI into the function for checking.....

    my 2 cents here

     
  • Nick Altmann

    Nick Altmann - 2012-08-31

    Okay, I'll change it.

    I think also that it would be nice to add additional flag to this function and is_from_gw and goes to gw functions to ignore port number. What do you think?

     
  • Nick Altmann

    Nick Altmann - 2012-08-31

    Added dr_is_gw_v2.patch.
    In it:
    1. SIP URI instead of socket in pvar.
    2. Added 'n' flag to dr_is_gw and is_from_gw to ignore port number (I really need it, think it will be useful).
    3. Small fix for documentation (added 'i' flag to is_from_gw description).

     
  • Nick Altmann

    Nick Altmann - 2012-08-31
     
    Attachments
  • Bogdan-Andrei Iancu

    • status: open --> closed
     
  • Bogdan-Andrei Iancu

    Hi Nick,

    I uploaded the patch, with some modification in order to unify all the is_from / goes_to / is_gw functions.
    I would appreciate of you could do some testing, just to be sure.

    Thanks and Regards,
    Bogdan

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks