By the way, function works for variants below: 

$var(c_uri)="sip:customer1@10.10.10.10:5065";
reg_fetch_contacts("location","$var(c_uri)","caller");

or

$var(c_uri)="sip:customer1@3.3.3.3";
reg_fetch_contacts("location","$var(c_uri)","caller");




ср, 19 дек. 2018 г. в 17:32, Denys Pozniak <denys.pozniak@gmail.com>:
Hello!

I want to get some parameters from user location database via function reg_fetch_contacts().
But it returns -1 and $(ulc(caller=>aor)) is <null> respectively.

Please help me to understand where issue is.

Script:
...
reg_fetch_contacts("location","$var(c_uri)","caller");
$var(rc) = $rc;
xlog("L_WARNING","[LOCATION] caller=>aor:  rc=$var(rc) aor=$(ulc(caller=>aor)) \n");
...

[root@kamailio]# kamcmd ul.lookup location customer1
{
        AoR: customer1
        Contacts: {
                Contact: {
                        Address: sip:+1234567890@10.10.10.10:5065
                        Expires: 861
                        Q: -1.000000
                        Call-ID: 00DB5F27-0B02-E966-92C3-A231C378F993@10.10.10.10
                        CSeq: 1787
                        User-Agent: SIPPER for PhonerLite
                        Received: sip:2.2.2.2:15043
                        Path: [not set]
                        State: CS_SYNC
                        Flags: 0
                        CFlags: 64
                        Socket: udp:3.3.3.3:5060
                        Methods: 8095
                        Ruid: uloc-1-5c1a3512-66a6-1
                        Instance: <urn:uuid:00FB3C49-24E8-E811-ACAA-D72FCD766436>
                        Reg-Id: 0
                        Server-Id: 1
                        Tcpconn-Id: -1
                        Keepalive: 1
                        Last-Keepalive: 1545232794
                        Last-Modified: 1545232794
                }
        }
}


[root@kamailio]# kamailio -v
version: kamailio 5.1.6 (x86_64/linux)
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144 MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown
compiled on 13:53:57 Nov 12 2018 with gcc 4.8.5







--

BR,
Denys Pozniak




--

BR,
Denys Pozniak