[SR-Docs] reg_fetch_contacts ipv6 received parameter empty

Ahmed Marsou amarsou1988 at gmail.com
Sat May 23 03:43:25 CEST 2020


Hi guys;
Im using "REGISTRAR MODULE" to control the users login by device.

if (af==INET6){
            reg_fetch_contacts("location", "$fu", "existingContact");

xlog("L_INFO","****************$si******************************");

xlog("L_INFO","****************$(hdr(Call-ID){s.substr,0,4})******************************");
            if ( $(ulc(existingContact=>user_agent)[0]) =~ "SPI/v") &&
($(hdr(Call-ID){s.substr,0,4}) != "TTCN") {
                    $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){s.substr,9,0});
                            $var(ruri) = $(var(address){s.substr,4,0});
                         #$var(ruri) = "[" + $var(address)+ "]" + ":" + $sp
+ ";" + "transport" + "=" + $proto;
                         #Send a SIP Request signalling the problem and its
reason on the body
                            xlog("L_INFO","******************
$var(address)***************************");
                            $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();
                        }
            }
So as you can see Im trynig to get the variable  $var(address) from
reg_fetch_contacts but is working for ipv4 unfortunatly not for ipv6. For
ipv6 it give me '0'.
Somthing is happening related to "[" "]".
How can I solve this problem?
Thank you.

OS: Centos 7
KAMILIO: version: kamailio 4.4.7 (x86_64/linux) 35d8ab
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-docs/attachments/20200523/0d3d1eb5/attachment.html>


More information about the sr-docs mailing list