diff --git a/server/src/main/java/com/pudonghot/yo/fsagent/service/dialplan/impl/DialplanService28AgentToTrunkPrefix.java b/server/src/main/java/com/pudonghot/yo/fsagent/service/dialplan/impl/DialplanService28AgentToTrunkPrefix.java index f2474c5f..f998cac8 100644 --- a/server/src/main/java/com/pudonghot/yo/fsagent/service/dialplan/impl/DialplanService28AgentToTrunkPrefix.java +++ b/server/src/main/java/com/pudonghot/yo/fsagent/service/dialplan/impl/DialplanService28AgentToTrunkPrefix.java @@ -8,6 +8,8 @@ import org.springframework.stereotype.Service; import com.pudonghot.yo.model.domain.PhoneAlias; import com.pudonghot.yo.mapper.PhoneAliasMapper; import org.springframework.core.annotation.Order; +import com.pudonghot.yo.model.domain.PhoneBlacklist; +import com.pudonghot.yo.mapper.PhoneBlacklistMapper; import com.pudonghot.yo.fsagent.service.dialplan.Call; import org.springframework.beans.factory.annotation.Autowired; import com.pudonghot.yo.fsagent.service.dialplan.DialplanConfig; @@ -23,6 +25,8 @@ public class DialplanService28AgentToTrunkPrefix extends BaseDialplanService { @Autowired private PhoneAliasMapper phoneAliasMapper; + @Autowired + private PhoneBlacklistMapper phoneBlacklistMapper; /** * {@inheritDoc} @@ -52,13 +56,22 @@ public class DialplanService28AgentToTrunkPrefix extends BaseDialplanService { val calledNumberObj = getCalledNumber(tenantId, trunkInfo.getRight()); if (!calledNumberObj.isAlias()) { if (!callerAgent.getTrunkDialAllowed()) { - log.debug("Caller [{}] is not allowed to dial trunk.", callerAgent); + log.info("Caller [{}] is not allowed to dial trunk.", callerAgent); return null; } } // number without trunk prefix val calledNumber = calledNumberObj.getNumber(); + + if (phoneBlacklistMapper.exists( + new Search(PhoneBlacklist.TENANT_ID, tenantId) + .eq(PhoneBlacklist.PHONE, calledNumber) + .eq(PhoneBlacklist.ACTIVE, true))) { + log.info("Called number [{}] is in blacklist", calledNumber); + return null; + } + model.put("calledNumber", calledNumber); model.put("targetNumber", trunkService.calledNumber(trunk, calledNumber)); recFile(model, connId, callerAgent.getAccount(), md5(calledNumber));