<div dir="ltr"><div><div class="gmail_extra"><div><div class="gmail_signature"><div dir="ltr">Hello all!<br><br>After some time I was able to get this working here, and now I am coming back to share my configuration with you guys (in case someone needs to get this working).<br><br>Here is what we have done:<br><br>route[REGISTRAR] {<br>        if (is_method("REGISTER"))<br>        {<br>                if(isflagset(FLT_NATS))<br>                {<br>                        setbflag(FLB_NATB);<br>                        # uncomment next line to do SIP NAT pinging <br>                        ## setbflag(FLB_NATSIPPING);<br>                }<br><br>                xlog("L_INFO", "checking $tu registered with User-Agent:$hdr(User-Agent)\n");<br>                if(reg_fetch_contacts("location", "$tu", "caller"))<br>                {<br>                        xlog("L_INFO", "$(ulc(caller=>count)) records found for $tu\n");<br>                        $var(i) = 0;<br>                        while($var(i) < $(ulc(caller=>count)))<br>                        {<br><br>                                xlog("L_INFO", "record $var(i) with ruid:$(ulc(caller=>ruid)[$var(i)]) - User-Agent:$(ulc(caller=>user_agent)[$var(i)])");<br>                                if ($hdr(User-Agent)=~$(ulc(caller=>user_agent)[$var(i)]))<br>                                {<br>                                        $var(ruid) = $(ulc(caller=>ruid)[$var(i)]); <br>                                        xlog("L_INFO", "unregistering $tu ruid:$var(ruid)");<br>                                        unregister("location", "$tu", "$var(ruid)");            <br>                                }<br>                                $var(i) = $var(i) + 1;<br>                        }<br>                }<br>                if (!save("location", "0x00"))<br>                        sl_reply_error();<br>                      <br>                exit;<br>        }<br>}<br><br><br>There are some logs over there because we used it to see what was going on while testing the configurations.<br><br><br>With this we can get just one register per User-Agent.<br><br><br>And again, thanks Olle for your help in this problem</div><div dir="ltr"><br><div><span style="background-color:rgb(255,255,255)"><font size="2" color="#000000"><strong style="font-family:Arial"><u>Bruno Emer</u></strong></font></span></div><div><font color="#00a1e6" style="font-size:small;font-family:sans-serif"><br></font></div><div>Mobile: +55 11 96540-0044 </div><div>email: <a href="mailto:brunoemer@gmail.com" target="_blank">brunoemer@gmail.com</a></div><div><span style="color:rgb(0,0,0);font-family:Helvetica,Arial,sans-serif"></span><div style="color:rgb(0,0,0);font-family:Helvetica,Arial,sans-serif;margin-top:5px"><a href="https://www.facebook.com/bruno.emer.5" style="font-size:small;outline:none" target="_blank"><img src="http://images.wisestamp.com/facebook.png" width="16" style="border: none;"></a><span style="font-size:small"> </span><a href="https://www.linkedin.com/profile/view?id=86461237&trk=spm_pic" style="font-size:small;outline:none" target="_blank"><img src="http://images.wisestamp.com/linkedin.png" width="16" style="border: none;"></a><span style="font-size:small"> </span><a href="https://twitter.com/brunoemer_" style="font-size:small;outline:none" target="_blank"><img src="http://images.wisestamp.com/twitter.png" width="16" style="border: none;"></a><span style="font-size:small"> </span><a href="https://www.flickr.com/photos/122070309@N03/" style="font-size:small;outline:none" target="_blank"><img src="http://images.wisestamp.com/flickr.png" width="16" style="border: none;"></a><span style="font-size:small"> </span><a href="http://google.com/+BrunoEmer" style="font-size:small;outline:none" target="_blank"><img src="http://images.wisestamp.com/googleplus.png" width="16" style="border: none;"></a><span style="font-size:small"> </span><a href="http://instagram.com/brunoemer_" style="font-size:small;outline:none" target="_blank"><img src="http://images.wisestamp.com/instagram.png" width="16" style="border: none;"></a></div></div></div></div></div>
<br><div class="gmail_quote">2016-04-01 17:37 GMT-03:00 Bruno Emer <span dir="ltr"><<a href="mailto:brunoemer@gmail.com" target="_blank">brunoemer@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">Sure it is!<div><br></div><div>This is exactly what I was looking for! Actually I wasn't able to see that there was a way to perform this action!</div><div><br></div><div>Thanks for your help, Olle!</div><div><br></div><div>I will try to create this, and when I have it done, I will post my script here, so if someone else need the same problem I can help.</div><div><br></div><div>Now, I have just one more question about my scenario: when I register a user, is there a way to create something like a "custom field" on the location? To explain better: If possible, I can add something like a custom header that says if the user is registered from a phone device or the web interface, then I can perform the loop and replace only the oldest contact using that device...</div><div><div class="gmail_extra"><span class=""><br clear="all"><div><div><div dir="ltr"><div><span style="background-color:rgb(255,255,255)"><font size="2" color="#000000"><strong style="font-family:Arial"><u><br></u></strong></font></span></div><div><span style="background-color:rgb(255,255,255)"><font size="2" color="#000000"><strong style="font-family:Arial"><u><br></u></strong></font></span></div><div><span style="background-color:rgb(255,255,255)"><font size="2" color="#000000"><strong style="font-family:Arial"><u>Bruno Emer</u></strong></font></span></div><div><font color="#00a1e6" style="font-size:small;font-family:sans-serif"><br></font></div><div>Mobile: <a href="tel:%2B55%2011%2096540-0044" value="+5511965400044" target="_blank">+55 11 96540-0044</a> </div><div>email: <a href="mailto:brunoemer@gmail.com" target="_blank">brunoemer@gmail.com</a></div><div><span style="color:rgb(0,0,0);font-family:Helvetica,Arial,sans-serif"></span><div style="color:rgb(0,0,0);font-family:Helvetica,Arial,sans-serif;margin-top:5px"><br></div></div></div></div></div></span><div><div class="h5"><div class="gmail_quote">2016-04-01 17:18 GMT-03:00 Bruno Emer <span dir="ltr"><<a href="mailto:brunoemer@gmail.com" target="_blank">brunoemer@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">This is my problem... I want to have 2 contacts for AOR, and not only one. <div><br></div><div>When the 3rd arrives, it must remove the oldest and continue with 2...<br><div class="gmail_extra"><br clear="all"><div><div><div dir="ltr"><div><span style="background-color:rgb(255,255,255)"><font size="2" color="#000000"><strong style="font-family:Arial"><u>If I am using the 0x04 parameter, it will save just one contact, and the user will not be able to get the Invite both, in the mobile device and web interface.</u></strong></font></span></div><span><div><span style="background-color:rgb(255,255,255)"><font size="2" color="#000000"><strong style="font-family:Arial"><u><br></u></strong></font></span></div><div><span style="background-color:rgb(255,255,255)"><font size="2" color="#000000"><strong style="font-family:Arial"><u>Bruno Emer</u></strong></font></span></div><div><font color="#00a1e6" style="font-size:small;font-family:sans-serif"><br></font></div><div>Mobile: <a href="tel:%2B55%2011%2096540-0044" value="+5511965400044" target="_blank">+55 11 96540-0044</a> </div><div>email: <a href="mailto:brunoemer@gmail.com" target="_blank">brunoemer@gmail.com</a></div></span><div><span style="color:rgb(0,0,0);font-family:Helvetica,Arial,sans-serif"></span><div style="color:rgb(0,0,0);font-family:Helvetica,Arial,sans-serif;margin-top:5px"><a href="https://www.facebook.com/bruno.emer.5" style="font-size:small;outline:none" target="_blank"><img src="http://images.wisestamp.com/facebook.png" width="16" style="border: none;"></a><span style="font-size:small"> </span><a href="https://www.linkedin.com/profile/view?id=86461237&trk=spm_pic" style="font-size:small;outline:none" target="_blank"><img src="http://images.wisestamp.com/linkedin.png" width="16" style="border: none;"></a><span style="font-size:small"> </span><a href="https://twitter.com/brunoemer_" style="font-size:small;outline:none" target="_blank"><img src="http://images.wisestamp.com/twitter.png" width="16" style="border: none;"></a><span style="font-size:small"> </span><a href="https://www.flickr.com/photos/122070309@N03/" style="font-size:small;outline:none" target="_blank"><img src="http://images.wisestamp.com/flickr.png" width="16" style="border: none;"></a><span style="font-size:small"> </span><a href="http://google.com/+BrunoEmer" style="font-size:small;outline:none" target="_blank"><img src="http://images.wisestamp.com/googleplus.png" width="16" style="border: none;"></a><span style="font-size:small"> </span><a href="http://instagram.com/brunoemer_" style="font-size:small;outline:none" target="_blank"><img src="http://images.wisestamp.com/instagram.png" width="16" style="border: none;"></a></div></div></div></div></div><div><div>
<br><div class="gmail_quote">2016-04-01 17:07 GMT-03:00 Bruno Emer <span dir="ltr"><<a href="mailto:brunoemer@gmail.com" target="_blank">brunoemer@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello, <i style="color:rgb(0,0,0);font-family:Times;font-size:medium">Olle!</i><div><font color="#000000" face="Times" size="3"><i><br></i></font></div><div><font color="#000000" face="Times" size="3"><i>Thanks for your help in this case, and don't worry about the time (actually I wasn't even expecting to get an answer today).</i></font></div><div><font color="#000000" face="Times" size="3"><i><br></i></font></div><div><font color="#000000" face="Times" size="3"><i>I know the max_contacts parameter. But the problem is that if I set the max_contacts to 2, when the user tries to register again, he gets an error message 503. The point is that I want to get the user registered, and replace the oldest location entry for the newest one.<br></i></font><div class="gmail_extra"><span><br clear="all"><div><div><div dir="ltr"><div><span style="background-color:rgb(255,255,255)"><font size="2" color="#000000"><strong style="font-family:Arial"><u><br></u></strong></font></span></div><div><span style="background-color:rgb(255,255,255)"><font size="2" color="#000000"><strong style="font-family:Arial"><u><br></u></strong></font></span></div><div><span style="background-color:rgb(255,255,255)"><font size="2" color="#000000"><strong style="font-family:Arial"><u>Bruno Emer</u></strong></font></span></div><div><font color="#00a1e6" style="font-size:small;font-family:sans-serif"><br></font></div><div>Mobile: <a href="tel:%2B55%2011%2096540-0044" value="+5511965400044" target="_blank">+55 11 96540-0044</a> </div><div>email: <a href="mailto:brunoemer@gmail.com" target="_blank">brunoemer@gmail.com</a></div><div><span style="color:rgb(0,0,0);font-family:Helvetica,Arial,sans-serif"></span><div style="color:rgb(0,0,0);font-family:Helvetica,Arial,sans-serif;margin-top:5px"><br></div></div></div></div></div></span><div><div><div class="gmail_quote">2016-04-01 16:31 GMT-03:00 Bruno Emer <span dir="ltr"><<a href="mailto:brunoemer@gmail.com" target="_blank">brunoemer@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hello all.<div><br></div><div>I have problem here and I tried to find a solution and search over internet, but without success.</div><div><br></div><div>My scenario is the following: I have an application that must be registered in Kamailio when a user logs in the web interface, so he can get calls (something like a web softphone using webrtc). At this point, we are OK, and everything is working fine.</div><div><br></div><div>To get these register functions I am using the parameter "save("location", "0x04")" as described in the REGISTRAR module documentation, so if a user logs in another web browser or computer, only the last one will continue registered and all calls will be forwarded to him.</div><div><br></div><div>The point is that now we are creating a phone app that will do almost the same thing as the web interface, allowing users to receive calls using the mobile device, and here is my problem: I want to allow my users to be registered on two devices at the same time, but if a user logs into another device, I don't want to reply with a 503. I want to allow the user to register again, deregistering the oldest contact.</div><div><br></div><div>I saw that there is a module named "<span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:1.125em;line-height:1.2">ims_usrloc_scscf" and on its description it says "</span><span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;line-height:19.6px">implemented overwrite oldest contact behaviour", but I couldn't find any documentation about it.</span></div><div><span style="font-size:14px;line-height:19.6px;font-weight:normal"><br></span></div><div><span style="font-size:14px;line-height:19.6px;font-weight:normal">So, is there a way to get this working today?</span></div><div><div><div><div dir="ltr"><div><span style="background-color:rgb(255,255,255)"><font size="2" color="#000000"><strong style="font-family:Arial"><u><br></u></strong></font></span></div><div><span style="background-color:rgb(255,255,255)"><font size="2" color="#000000"><strong style="font-family:Arial"><u><br></u></strong></font></span></div><div><span style="background-color:rgb(255,255,255)"><font size="2" color="#000000"><strong style="font-family:Arial"><u>Bruno Emer</u></strong></font></span></div><div><font color="#00a1e6" style="font-size:small;font-family:sans-serif"><br></font></div><div>Mobile: <a href="tel:%2B55%2011%2096540-0044" value="+5511965400044" target="_blank">+55 11 96540-0044</a> </div><div>email: <a href="mailto:brunoemer@gmail.com" target="_blank">brunoemer@gmail.com</a></div></div></div></div>
</div></div>
</blockquote></div><br></div></div></div></div></div>
</blockquote></div><br></div></div></div></div></div>
</blockquote></div><br></div></div></div></div></div>
</blockquote></div><br></div></div></div>