log.debug("rcv_ctx=%s AND rcv_act=%s AND rcv_msgtype=%s AND active=1 %s AND ikap_src!=%s AND ((DMDOMAIN(rcv_dst, '%s')=1 AND exact_dst=0) OR (rcv_dst='%s' AND exact_dst > 0))"%(str(ctx),str(act),str(msgtype),str(localonly),str(src),str(dst),str(dst)))
sq="rcv_ctx='%s' AND rcv_act='%s' AND rcv_msgtype='%s' AND active=1 "%(str(ctx),str(act),str(msgtype))
returnActions.find(
sq+=localonly
where=['rcv_ctx=? AND rcv_act=? AND rcv_msgtype=? AND active=1 '+localonly+' AND ikap_src!=? AND ((DMDOMAIN(rcv_dst, ?)=1 AND exact_dst=0) OR (rcv_dst=? AND exact_dst > 0))',ctx,act,msgtype,src,dst,dst])
sq+=" AND ikap_src!='%s'"%(str(src))
sq+=" AND ((DMDOMAIN(rcv_dst, '%s')=1 AND exact_dst=0) OR (rcv_dst='%s' AND exact_dst > 0))"%(str(dst),str(dst))
sq+=" AND (DMDOMAIN('%s',rcv_src)=1 OR rcv_src='')"""%(str(src))