<div dir="ltr">I tried it but it is sending the unregister message to the second register user.I want to send the message to previous.<div>First user register: ok<br>Second user register: register, and kamailio will send a message unregister to the first.</div><div>First user: get
unregister Message<br>Sorry, maybe I'm not understanding something. Now is sending the message to contact.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El mié., 3 jun. 2020 a las 13:13, Ahmed Marsou (<<a href="mailto:amarsou1988@gmail.com">amarsou1988@gmail.com</a>>) escribió:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Ok, thank you so much.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El mié., 3 jun. 2020 a las 12:54, Daniel-Constantin Mierla (<<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>>) escribió:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<p>Hello,</p>
<p>like Joel said, the reveiced filed in location record is set only
for NATed contacts and in ipv6 likely it is not the case.</p>
<p>What you should do is like:</p>
<p>$uac_req(ruri) = $(ulc (existingContact=>addr)[0]);</p>
<p>if($(ulc(existingContact=>received)[0]) != $null) {</p>
<p> $uac_req(duri) = $(ulc(existingContact=>received)[0]);</p>
<p>}</p>
<p>Cheers,<br>
Daniel<br>
</p>
<div>On 03.06.20 12:27, Ahmed Marsou wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Hi, thanks for your response. I appreciate the
help, I really appreciate it.
<div>My problem is that I have to send a MESSAGE to an
application to show the user a message. </div>
<div>Like that:<br>
<b>$ var (address) = $ (ulc (existingContact => received)
[0]);<br>
$ var (ruri) = $ (var (address) {s.substr, 4,0});<br>
# Submit a SIP request stating the problem and its reason in
the body<br>
$ uac_req (method) = "MESSAGE";<br>
$ uac_req (ruri) = "sip:" + $ au + "@" + $ var (ruri);<br>
$ uac_req (furi) = "sip: kamailio @ sip_domain";<br>
$ uac_req (turi) = $ fu;<br>
$ uac_req (hdrs) = "Max-Forwards: 70 \ r \ nEvent: reg \ r \
nContent-Type: text / plain \ r \ nAccept-Contact: *; +
g.ext.app.registration \ r \ n" ;<br>
$ uac_req (body) = "Already registered with another device
ID";<br>
uac_req_send ();</b><br>
<br>
For the previous user, I mean. The first record, not the
second. How can I get the first source IP address to replace $
var (address) = $ (ulc (existingContact => received) [0]);
and send him the message? If I use save (); module, I will
have the same problem, because I will not be able to find the
previous IP source.<br>
</div>
<div>Thank you so much.</div>
<div>Kind regards.</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">El mié., 3 jun. 2020 5:43,
Joel Serrano <<a href="mailto:joel@textplus.com" target="_blank">joel@textplus.com</a>>
escribió:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div>
<div dir="auto">Not exactly an answer to your specific
question, but it might help solve your problem in a
different way... </div>
<div dir="auto"><br>
</div>
<div dir="auto">If you using the registrar module with
save()... you might be able to take advantage in some
way of the flags 0x04:</div>
</div>
<div><br>
</div>
<div><a href="https://kamailio.org/docs/modules/5.3.x/modules/registrar.html#registrar.f.save" rel="noreferrer" target="_blank">https://kamailio.org/docs/modules/5.3.x/modules/registrar.html#registrar.f.save</a><br>
</div>
<div><br>
</div>
<div><i>"0x04 - store and maintain one contact per AoR. If
there are other contact addresses for AoR not matching
current registration, remove them. This mode ensures one
contact per AoR (user)."<br>
</i><br>
</div>
<div><br>
</div>
<div>Regarding "received", I would think that you have it on
IPV4 because the UA is probably behind NAT, and you are
adding it in config script, with IPv6, there is no NAT,
and --most likely-- you are not adding it, thus it's not
saved to the database. Check if you are
using fix_nated_register() somewhere in your config file..
For IPv6 it might be easier if you just pull the IP from
the Contact info.</div>
<div><br>
</div>
<div><br>
</div>
<div>Sorry if this isn't very helpful, I'm guessing a little
based on the info you provided :)</div>
<div><br>
</div>
<div>Cheers, </div>
<div>Joel.</div>
<div><br>
</div>
<div><br>
</div>
</div>
<div><br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Tue, Jun 2, 2020 at
4:46 PM Ahmed Marsou <<a href="mailto:amarsou1988@gmail.com" rel="noreferrer" target="_blank">amarsou1988@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">Hi;
<div>I'm using the received parameter to send a
MESSAGE to unregsiter the first user that is
registered to register the second one.</div>
<div>Using: </div>
<div><b>modparam("usrloc", "received_column"</b></div>
<div><b>modparam("registrar|nathelper",
"received_avp",<br>
</b></div>
<div><b><br>
</b></div>
<div>and when I do a:</div>
<div>select received from location;<br>
</div>
<div>as you can see is null.</div>
<div>+----------+<br>
| received |<br>
+----------+<br>
| NULL |<br>
+----------+<br>
</div>
<div><br>
</div>
<div>In IPV4 is working fine, but in IPV6 is not. Can
you tell me how can I get this value?</div>
<div>Im going crazy with that.</div>
<div><br>
</div>
<div> reg_fetch_contacts("location",
"$fu", "existingContact");<br>
if(
$(ulc(existingContact=>user_agent)[0]) =~
"SPI/v"){<br>
$var(oldDeviceId) =
$(ulc(existingContact=>callid)[0]{s.substr,9,0});<br>
$var(newDeviceId) =
$(hdr(Call-ID){s.substr,9,0});<br>
if($var(oldDeviceId) !=
$var(newDeviceId) ){<br>
xlog("L_INFO","New
device id is different:warn previous user another
user overide him");<br>
$var(address) =
$(ulc(existingContact=><b>received</b>)[0]);<br>
$var(ruri) =
$(var(address){s.substr,4,0});<br>
#Send a SIP Request
signalling the problem and its reason on the body<br>
$uac_req(method)="MESSAGE";<br>
$uac_req(ruri) =
"sip:"+ $au + "@" + $var(ruri);<br>
$uac_req(furi) =
<a>"sip:kamailio@sip_domain"</a>;<br>
$uac_req(turi) =
$fu;<br>
$uac_req(hdrs)="Max-Forwards: 70\r\nEvent:
reg\r\nContent-Type:
text/plain\r\nAccept-Contact:*;+g.ext.app.registration\r\n";<br>
$uac_req(body)="Already registered with another
device id";<br>
uac_req_send();<br>
drop;<br>
}<br>
}<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>Thank you.</div>
<div><br>
</div>
<div><br>
</div>
</div>
_______________________________________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" rel="noreferrer" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote>
</div>
</div>
_______________________________________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" rel="noreferrer" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote>
</div>
<br>
<fieldset></fieldset>
<pre>_______________________________________________
Kamailio (SER) - Users Mailing List
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
</blockquote>
<pre cols="72">--
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" target="_blank">www.asipto.com</a>
<a href="http://www.twitter.com/miconda" target="_blank">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" target="_blank">www.linkedin.com/in/miconda</a>
Funding: <a href="https://www.paypal.me/dcmierla" target="_blank">https://www.paypal.me/dcmierla</a></pre>
</div>
</blockquote></div>
</blockquote></div>