SQL Server Stored Procedure for Border Elements
This stored procedure is intended for use with Border Elements’ Carrier Rule Procedure
(Note: If the result code returned from the stored procedure is 1, the call will be rejected)
<source lang="sql">USE [BorderElements] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[RejectCalls] ( @DialedNumber AS nvarchar(50), @CallerId AS nvarchar(50), @AccountId As int, @ANI2 As int ) AS BEGIN SET NOCOUNT ON -- Declare the return variable here -- DECLARE @return_value int DECLARE @Result bit SET @Result = 0 -- Is the Dialed Number a Toll Free Number? IF ([dbo].IsTollFreeNumber(@DialedNumber) = 1) BEGIN IF ([dbo].IsBlockedNPA(@CallerId) = 1) BEGIN SET @Result = 1 -- Failed END ELSE BEGIN DECLARE @AllowPayPhone bit SET @AllowPayPhone = 0 SELECT TOP 1 @AllowPayPhone = AllowPayPhone FROM Account WHERE AccountId = @AccountId IF (@AllowPayPhone IS NULL OR @AllowPayPhone = 0) BEGIN IF (@ANI2 IN (7, 25, 27, 29, 70)) BEGIN SET @Result = 1 END END END END RETURN @Result END</source>
For more information, please see article Set Up Border Elements.