Hello,
like Joel said, the reveiced filed in location record is set only for NATed contacts and in ipv6 likely it is not the case.
What you should do is like:
$uac_req(ruri) = $(ulc (existingContact=>addr)[0]);
if($(ulc(existingContact=>received)[0]) != $null) {
$uac_req(duri) = $(ulc(existingContact=>received)[0]);
}
Cheers,
Daniel
On 03.06.20 12:27, Ahmed Marsou wrote:
Hi, thanks for your response. I appreciate the help, I really appreciate it.My problem is that I have to send a MESSAGE to an application to show the user a message.Like that:
$ var (address) = $ (ulc (existingContact => received) [0]);
$ var (ruri) = $ (var (address) {s.substr, 4,0});
# Submit a SIP request stating the problem and its reason in the body
$ uac_req (method) = "MESSAGE";
$ uac_req (ruri) = "sip:" + $ au + "@" + $ var (ruri);
$ uac_req (furi) = "sip: kamailio @ sip_domain";
$ uac_req (turi) = $ fu;
$ uac_req (hdrs) = "Max-Forwards: 70 \ r \ nEvent: reg \ r \ nContent-Type: text / plain \ r \ nAccept-Contact: *; + g.ext.app.registration \ r \ n" ;
$ uac_req (body) = "Already registered with another device ID";
uac_req_send ();
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.
Thank you so much.Kind regards.
El mié., 3 jun. 2020 5:43, Joel Serrano <joel@textplus.com> escribió:
Not exactly an answer to your specific question, but it might help solve your problem in a different way...
If you using the registrar module with save()... you might be able to take advantage in some way of the flags 0x04:
"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)."
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.
Sorry if this isn't very helpful, I'm guessing a little based on the info you provided :)
Cheers,Joel.
_______________________________________________
On Tue, Jun 2, 2020 at 4:46 PM Ahmed Marsou <amarsou1988@gmail.com> wrote:
Hi;_______________________________________________I'm using the received parameter to send a MESSAGE to unregsiter the first user that is registered to register the second one.Using:modparam("usrloc", "received_column"modparam("registrar|nathelper", "received_avp",
and when I do a:select received from location;
as you can see is null.+----------+
| received |
+----------+
| NULL |
+----------+
In IPV4 is working fine, but in IPV6 is not. Can you tell me how can I get this value?Im going crazy with that.
reg_fetch_contacts("location", "$fu", "existingContact");
if( $(ulc(existingContact=>user_agent)[0]) =~ "SPI/v"){
$var(oldDeviceId) = $(ulc(existingContact=>callid)[0]{s.substr,9,0});
$var(newDeviceId) = $(hdr(Call-ID){s.substr,9,0});
if($var(oldDeviceId) != $var(newDeviceId) ){
xlog("L_INFO","New device id is different:warn previous user another user overide him");
$var(address) = $(ulc(existingContact=>received)[0]);
$var(ruri) = $(var(address){s.substr,4,0});
#Send a SIP Request signalling the problem and its reason on the body
$uac_req(method)="MESSAGE";
$uac_req(ruri) = "sip:"+ $au + "@" + $var(ruri);
$uac_req(furi) = "sip:kamailio@sip_domain";
$uac_req(turi) = $fu;
$uac_req(hdrs)="Max-Forwards: 70\r\nEvent: reg\r\nContent-Type: text/plain\r\nAccept-Contact:*;+g.ext.app.registration\r\n";
$uac_req(body)="Already registered with another device id";
uac_req_send();
drop;
}
}
Thank you.
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users-- Daniel-Constantin Mierla -- www.asipto.com www.twitter.com/miconda -- www.linkedin.com/in/miconda Funding: https://www.paypal.me/dcmierla