/* * clirw.h * * Module for CLI/ANI manipulation. * * Copyright (c) 2005, Michal Zygmuntowicz * * This work is published under the GNU Public License (GPL) * see file COPYING for details. * We also explicitely grant the right to link this code * with the OpenH323 library. */ #ifndef CLIRW_H #define CLIRW_H "#(@) $Id: clirw.h,v 1.4 2005/05/30 15:23:22 zvision Exp $" #include #include #include "Toolkit.h" struct SetupAuthData; class SignalingMsg; template class H225SignalingMsg; class H225_Setup_UUIE; typedef H225SignalingMsg SetupMsg; /// Perform Calling-Party-Number-IE/Setup-UUIE.sourceAddress rewritting class CLIRewrite { public: /// a single CLI/ANI rewrite rule struct RewriteRule { RewriteRule(); PString AsString() const; /// match condition to apply the rule enum MatchType { MatchDialedNumber, /// dialed number before any rewrite MatchDestinationNumber, /// dailed number after global rewrite MatchCallerNumber /// CLI/ANI }; /// how to perform number matching and rewritting enum RewriteType { PrefixToNumber, /// match by a prefix, replace with a complete number PrefixToPrefix, /// match by a prefix, replace only the prefix part NumberToNumber /// match by a complete number, replace with a complete number }; /// how to hide caller's number enum ScreeningType { NoScreening, /// leave as it is HideFromTerminals, /// hide only if a callee is a terminal AlwaysHide /// always hide }; /// manual CLIR (presentatio indicator) control enum CLIRType { CLIRPassthrough, /// leave PI as received from a caller RestrictPresentation, /// set PI to restricted AllowPresentation /// set PI to allowed }; /// how to process received CLIR (PI) information enum CLIRRule { IgnoreCLIR, /// use the global settings to make the decission ForwardCLIR, /// do nothing, just forward as received ApplyCLIRForTerminals, /// hide caller's number, if the callee is a terminal and PI=restricted AlwaysApplyCLIR /// always hide caller's number, if PI=restricted }; int m_matchType; /// match condition int m_rewriteType; /// number matching/rewritting rule int m_screeningType; /// caller's number hiding int m_manualCLIR; /// CLIR settings override int m_CLIRPolicy; /// how to process CLIR std::string m_prefix; /// the prefix to match std::vector m_cli; /// list of new CLIs }; typedef std::vector RewriteRules; typedef std::pair SingleIpRule; typedef std::vector SingleIpRules; typedef std::pair DoubleIpRule; typedef std::vector DoubleIpRules; CLIRewrite(); /// Rewrite CLI before any Setup message processing, like auth & routing void InRewrite( SetupMsg &msg /// Q.931 Setup message to be rewritten ); /** Rewrite CLI before the Setup is sent to the terminating party and after auth/acct/routing is performed. */ void OutRewrite( SetupMsg &msg, /// Q.931 Setup message to be rewritten SetupAuthData &authData, /// additional data const PIPSocket::Address &destAddr /// destination address ); private: void Rewrite( SetupMsg &msg, /// Q.931 Setup message to be rewritten const SingleIpRule &ipRule, /// rule to use for rewrite bool inbound, /// rule type SetupAuthData *authData /// additional data for outbound rules ) const; CLIRewrite(const CLIRewrite &); CLIRewrite & operator=(const CLIRewrite &); private: SingleIpRules m_inboundRules; /// a set of inbound CLI/ANI rewrite rules DoubleIpRules m_outboundRules; /// a set of outbound CLI/ANI rewrite rules bool m_processSourceAddress; /// true to rewrite numbers in sourceAddress Setup-UUIE bool m_removeH323Id; /// true to put in the sourceAddress Setup-UUIE field only rewritten ANI/CLI int m_CLIRPolicy; /// how to process CLIR }; #endif