Hello,

On 3/22/12 6:36 PM, Krishna Kurapati wrote:
Thanks Daniel.

I  found your posting four years ago about saving one contact per user

http://lists.kamailio.org/pipermail/devel/2008-October/016273.html

and used save("location", "0x04"). However, I noticed a problem with this.
The contact is not storing in the memory. Whenever there is a Reregistration
happening, the contact is briefly not available for routing.

Then I looked at the resgistrar code, I am befuddled.

-- code snippet:

/*! \brief
 * Wrapper to save(location)
 */
static int w_save(struct sip_msg* _m, char* _d, char* _cflags)
{
        return save(_m, (udomain_t*)_d, ((int)(unsigned long)_cflags));
}

The string "0x04" looks like getting type-casted to long.
this is so called fixup mechanism in SER/Kamailio. At startup the parameters which come as char* from config are pre-compiled in various forms (in this case is an integer). At runtime, the config interpreter calls the function with the pre-compiled form of the parameter, thus the cast.

Look for save_fixup() function to understand better. Also, the devel guide on the net should have a section about this mechanism.

Cheers,
Daniel


Krish Kura


On Thu, Mar 22, 2012 at 11:11 AM, Daniel-Constantin Mierla <mico...@gmail.com <mailto:mico...@gmail.com>> wrote:

    Hello,

    if you don't use the other contacts, then might be simpler to just
    store one contact per AoR (which will be from last registration)
    -- see save(...) second parameter flags.

    Don't remember by hart, but registrar or usrloc has a parameter to
    control whether to add or not additional branches from a location
    lookup - check the readmeas, but I am not sure the first result is
    the most recent, you would have to test it or check the sources.

    The last coming in my mind right now would be to program it in
    config via reg_fetch_contacts() and $ulc(...).

    Cheers,
    Daniel


    On 3/22/12 4:49 PM, Krishna Kurapati wrote:
    Hi,

    I am trying to relay the message to the Registered user. However,
    I would like to relay only to a recent contact.
    In case, there are multiple contact, I do not want to relay to
    older contacts.

    I am using t_relay() which is currently forking the request to
    all contacts.

    Any other way to accomplish my need?

    Thanks
    Krish Kura


    _______________________________________________
    SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
    sr-users@lists.sip-router.org  <mailto:sr-users@lists.sip-router.org>
    http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- Daniel-Constantin Mierla
    Kamailio Advanced Training, April 23-26, 2012, Berlin, Germany
    http://www.asipto.com/index.php/kamailio-advanced-training/



--
Daniel-Constantin Mierla
Kamailio Advanced Training, April 23-26, 2012, Berlin, Germany
http://www.asipto.com/index.php/kamailio-advanced-training/

_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to