The analysis of capital injection strategy in the literature of insurance risk models (e.g. Pafumi, 1998; Dickson and Waters, 2004) typically assumes that whenever the surplus becomes negative, the amount of shortfall is injected so that the company can continue its business forever. Recently, Nie et al. (2011) has proposed an alternative model in which capital is immediately injected to restore the surplus level to a positive level b when the surplus falls between zero and b, and the insurer is still subject to a positive ruin probability. Inspired by the idea of randomized observations in Albrecher et al. (2011b), in this paper, we further generalize Nie et al. (2011)'s model by assuming that capital injections are only allowed at a sequence of time points with inter-capital-injection times being Erlang distributed (so that deterministic time intervals can be approximated using the Erlangization technique in Asmussen et al. (2002)). When the claim amount is distributed as a combination of exponentials, explicit formulas for the Gerber–Shiu expected discounted penalty function (Gerber and Shiu, 1998) and the expected total discounted cost of capital injections before ruin are obtained. The derivations rely on a resolvent density associated with an Erlang random variable, which is shown to admit an explicit expression that is of independent interest as well. We shall provide numerical examples, including an application in pricing a perpetual reinsurance contract that makes the capital injections and demonstration of how to minimize the ruin probability via reinsurance. Minimization of the expected discounted capital injections plus a penalty applied at ruin with respect to the frequency of injections and the critical level b will also be illustrated numerically.