Actually, I misread the code and it should return 2, the log:
``` Jun 24 17:14:52 ip-172-31-3-158 /usr/local/sbin/kamailio[49325]: DEBUG: {1 53491654 INVITE 00a98cb1-6e84-123b-fca2-069c0e3bf50e} sqlops [sql_api.c:494]: sql_exec_xquery(): no result after query ```
It is from the file and line:
- https://github.com/kamailio/kamailio/blob/master/src/modules/sqlops/sql_api....
It could be the IF evaluation, try:
``` sql_xquery("con", "SELECT * FROM sbc_uacreg WHERE l_uuid = '$hdr(X-Gateway)'", "ra"); if($rc == 1) { ```