<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello,<br>
<br>
On 3/22/12 6:36 PM, Krishna Kurapati wrote:
<blockquote
cite="mid:CAOzCjAcXrCJm+2fDOxyCoOp-_5x=aD-rmS66BC=WmBBBSB7Z-A@mail.gmail.com"
type="cite">Thanks Daniel.
<div><br>
</div>
<div>I found your posting four years ago about saving one contact
per user</div>
<div><br>
</div>
<div><a moz-do-not-send="true"
href="http://lists.kamailio.org/pipermail/devel/2008-October/016273.html">http://lists.kamailio.org/pipermail/devel/2008-October/016273.html</a></div>
<div> </div>
<div><br>
</div>
<div>and used save("location", "0x04"). However, I noticed a
problem with this.</div>
<div>The contact is not storing in the memory. Whenever there is a
Reregistration </div>
<div>
happening, the contact is briefly not available for routing.</div>
<div><br>
</div>
<div>Then I looked at the resgistrar code, I am befuddled. </div>
<div><br>
</div>
<div>-- code snippet:</div>
<div><br>
</div>
<div>
<div>/*! \brief</div>
<div> * Wrapper to save(location)</div>
<div> */</div>
<div>static int w_save(struct sip_msg* _m, char* _d, char*
_cflags)</div>
<div>{</div>
<div> return save(_m, (udomain_t*)_d, ((int)(unsigned
long)_cflags));</div>
<div>
}</div>
</div>
<div><br>
</div>
<div>The string "0x04" looks like getting type-casted to long. <br>
</div>
</blockquote>
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.<br>
<br>
Look for save_fixup() function to understand better. Also, the devel
guide on the net should have a section about this mechanism.<br>
<br>
Cheers,<br>
Daniel<br>
<br>
<blockquote
cite="mid:CAOzCjAcXrCJm+2fDOxyCoOp-_5x=aD-rmS66BC=WmBBBSB7Z-A@mail.gmail.com"
type="cite">
<div><br>
</div>
<div>Krish Kura</div>
<div><br>
</div>
<div><br>
<div class="gmail_quote">On Thu, Mar 22, 2012 at 11:11 AM,
Daniel-Constantin Mierla <span dir="ltr"><<a
moz-do-not-send="true" href="mailto:miconda@gmail.com">miconda@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> Hello,<br>
<br>
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.<br>
<br>
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.<br>
<br>
The last coming in my mind right now would be to program
it in config via reg_fetch_contacts() and $ulc(...).<br>
<br>
Cheers,<br>
Daniel
<div>
<div class="h5"><br>
<br>
On 3/22/12 4:49 PM, Krishna Kurapati wrote: </div>
</div>
<blockquote type="cite">
<div>
<div class="h5">Hi,
<div><br>
</div>
<div>I am trying to relay the message to the
Registered user. However, I would like to relay
only to a recent contact.</div>
<div>In case, there are multiple contact, I do not
want to relay to older contacts.</div>
<div><br>
</div>
<div>I am using t_relay() which is currently forking
the request to all contacts.</div>
<div><br>
</div>
<div>Any other way to accomplish my need?</div>
<div><br>
</div>
<div>Thanks</div>
<div>Krish Kura</div>
<br>
<fieldset></fieldset>
<br>
</div>
</div>
<pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a moz-do-not-send="true" href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a>
<a moz-do-not-send="true" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><span class="HOEnZb"><font color="#888888">
</font></span></pre>
<span class="HOEnZb"><font color="#888888"> </font></span></blockquote>
<span class="HOEnZb"><font color="#888888"> <br>
<pre cols="72">--
Daniel-Constantin Mierla
Kamailio Advanced Training, April 23-26, 2012, Berlin, Germany
<a moz-do-not-send="true" href="http://www.asipto.com/index.php/kamailio-advanced-training/" target="_blank">http://www.asipto.com/index.php/kamailio-advanced-training/</a></pre>
</font></span></div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla
Kamailio Advanced Training, April 23-26, 2012, Berlin, Germany
<a class="moz-txt-link-freetext" href="http://www.asipto.com/index.php/kamailio-advanced-training/">http://www.asipto.com/index.php/kamailio-advanced-training/</a></pre>
</body>
</html>