### Description
When using the Python3 extension for KEMI, `registrar.save` complains about an unknown
location: `registrar [api.c:44]: regapi_save(): usrloc domain [location] not found`.
Saving the user location works without problems in the core scripting language.
### Troubleshooting
#### Reproduction
Here is a fairly minimal Python3 script:
```python
import KSR as KSR
def mod_init():
KSR.info("===== from Python mod init\n")
return kamailio()
class kamailio:
def __init__(self):
KSR.info('===== kamailio.__init__\n')
def child_init(self, rank):
KSR.info('===== kamailio.child_init(%d)\n' % rank)
return 0
def ksr_request_route(self, msg):
KSR.hdr.remove('Route')
if KSR.is_method('INVITE'):
KSR.rr.record_route()
if not KSR.is_myself_ruri():
KSR.info(f'Relaying to foreign domain: to={msg.RURI}
method={msg.Method}\n')
return self.relay(msg)
if KSR.is_method("REGISTER"):
return self.registration(msg)
KSR.registrar.lookup("location")
KSR.sl.send_reply(100, "Trying")
return self.relay(msg)
def ksr_reply_route(self, msg):
KSR.info(f'Received response: from={msg.src_address}
status={msg.Status}\n')
return 1
def ksr_onsend_route(self, msg):
if msg.Type == 'SIP_REQUEST':
KSR.info(f'Sending request: to={msg.dst_address}
method={msg.Method}\n')
return 1
def registration(self, msg):
if not KSR.registrar.save("location", 0x01):
KSR.sl.sl_reply_error()
return 1
def relay(self, msg):
if not KSR.tm.t_relay():
KSR.sl.sl_reply_error()
return 1
```
If this script is used for request routing, the user locations cannot be saved and the
above mentioned error is logged.
#### Log Messages
`4(4360) ERROR: {1 15678 REGISTER 16c11b02-2458-4263-9350-c2f26fafee53} registrar
[api.c:44]: regapi_save(): usrloc domain [location] not found`
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
version: kamailio 5.2.3 (x86_64/linux) c36229
flags: STATS: Off, USE_TCP, USE_TLS, 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: c36229
compiled on 13:25:11 Jun 2 2019 with gcc 8.3.0
```
* **Operating System**:
```
Linux linux 5.1.5-gentoo #1 SMP PREEMPT Mon May 27 14:42:14 CEST 2019 x86_64 AMD A6-3670
APU with Radeon(tm) HD Graphics AuthenticAMD GNU/Linux
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1972