[OpenSIPS-Users] lookup() questions

OCEANET - Cédric BASSAGET cedric at oceanet.com
Fri Oct 24 11:31:57 CEST 2014


Hello,

I'm actually trying to resolve NAT issues with opensips, and I have a 
problem using lookup() function.

UAC register to my opensips server. When UAC is behind nat (detected 
with nat_uac_test()), I do a "fix_nated_register()" and save("location").
My usrloc table looks correct, I have a line with (important fields):
- a username = 2015 (sip trunk identifier)
- a domain = the domain my UAC is registering to (= the domain my 
opensips is listening on)
- a contact = sip:2015@<the IP of my UAC>
- a received = sip:<the IP of my UAC>:<port> (in my tests, port=1024)
- and many other fields (...)

When trying to relay an incoming INVITE to this UAC, if I understood 
well, I have to do a "lookup()" before t_relay, to tell opensips to send 
the request to the "usrloc.received" <address:port>.

I've tried couple things, like :
- lookup("location") -> $ru is totally different from what we are 
looking for, so it does not work, that's normal
- lookup("location","","2015@<domain>") -> got an error : 
ERROR:core:parse_uri: bad uri,  state 0 parsed: <2015> (4) / 
<2015 at domain> (37)
- lookup("location","","sip:2015@<domain>") -> $retcode=1, and debug 
shows me this :

DBG:registrar:lookup: found a complete match
DBG:registrar:lookup: setting as ruri <sip:2015@<the IP of my UAC>>
but nothing goes out to ip address of my UAC... (tcpdump).

Can somebody tell me if I've correctly understood how lookup() function 
works ? Or if I'm doing totally aberrant things ?

Regards,
Cédric



More information about the Users mailing list