[SR-Docs] 回复: reg_fetch_contacts ipv6 received parameter empty

J.H LIU qq378806054 at hotmail.com
Thu Mar 18 16:10:40 CET 2021

How can I receive this letter ?

发送自 Windows 10 版邮件<https://go.microsoft.com/fwlink/?LinkId=550986>应用

发件人: sr-docs <sr-docs-bounces at lists.kamailio.org> 代表 Ahmed Marsou <amarsou1988 at gmail.com>
发送时间: Saturday, May 23, 2020 9:43:25 AM
收件人: sr-docs at lists.kamailio.org <sr-docs at lists.kamailio.org>
主题: [SR-Docs] reg_fetch_contacts ipv6 received parameter empty

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

if (af==INET6){
            reg_fetch_contacts("location", "$fu", "existingContact");
            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(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";
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/20210318/22626c2c/attachment.htm>

More information about the sr-docs mailing list