[SR-Users] Received ipv6 problem

Ahmed Marsou amarsou1988 at gmail.com
Wed Jun 3 13:13:20 CEST 2020


Ok, thank you so much.

El mié., 3 jun. 2020 a las 12:54, Daniel-Constantin Mierla (<
miconda at gmail.com>) escribió:

> 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 at 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:
>>
>>
>> https://kamailio.org/docs/modules/5.3.x/modules/registrar.html#registrar.f.save
>>
>>
>> *"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 at 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 at 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 at lists.kamailio.org
>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>>
>> _______________________________________________
>> Kamailio (SER) - Users Mailing List
>> sr-users at lists.kamailio.org
>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>
>
> _______________________________________________
> Kamailio (SER) - Users Mailing Listsr-users at lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
> --
> Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- www.linkedin.com/in/miconda
> Funding: https://www.paypal.me/dcmierla
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20200603/d35653db/attachment.html>


More information about the sr-users mailing list