00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef OPAL_IAX2_REGPROCESSOR_H
00034 #define OPAL_IAX2_REGPROCESSOR_H
00035
00036 #ifndef _PTLIB_H
00037 #include <ptlib.h>
00038 #endif
00039
00040 #include <opal/buildopts.h>
00041
00042 #if OPAL_IAX2
00043
00044 #include <ptclib/random.h>
00045 #include <opal/connection.h>
00046
00047 #include <iax2/frame.h>
00048 #include <iax2/processor.h>
00049 #include <iax2/iedata.h>
00050 #include <iax2/remote.h>
00051 #include <iax2/safestrings.h>
00052 #include <iax2/sound.h>
00053
00054 class IAX2EndPoint;
00055 class IAX2Connection;
00056
00057 class IAX2RegProcessor : public IAX2Processor
00058 {
00059 PCLASSINFO(IAX2RegProcessor, IAX2Processor);
00060
00061 public:
00063 IAX2RegProcessor( IAX2EndPoint & ep,
00064 const PString & host,
00065 const PString & username,
00066 const PString & password,
00067 PINDEX inRegistrationRefreshTime
00068 );
00069
00071 virtual ~IAX2RegProcessor();
00072
00076 void Unregister();
00077
00078 PString GetHost() const { return host; };
00079 PString GetUserName() const { return userName; };
00080 PString GetPassword() const { return password; };
00081
00082 protected:
00083 PString host;
00084 PString userName;
00085 PString password;
00086
00087 INT registrationRefreshTime;
00088
00090 enum RegistrationState {
00091 registrationStart = 1,
00092 registrationHappening,
00093 registrationUnregisterStart,
00094 registrationUnregistering,
00095 registrationUnregistered,
00097 registrationWait
00098 };
00099
00101 RegistrationState registrationState;
00102
00105 PMutex stateMutex;
00106
00107 #ifdef DOC_PLUS_PLUS
00108
00109 void OnDoRegistration(PTimer &, INT);
00110 #else
00111 PDECLARE_NOTIFIER(PTimer, IAX2RegProcessor, OnDoRegistration);
00112 #endif
00113
00115 PTimer registrationTimer;
00116
00118 void ProcessIaxCmdRegAuth(IAX2FullFrameProtocol * src);
00119
00121 void ProcessIaxCmdRegAck(IAX2FullFrameProtocol * src);
00122
00124 void ProcessIaxCmdRegRej(IAX2FullFrameProtocol * src);
00125
00128 void ProcessIaxCmdUnRegAuth(IAX2FullFrameProtocol * src);
00129
00131 void ProcessIaxCmdUnRegAck(IAX2FullFrameProtocol * src);
00132
00134 void ProcessIaxCmdUnRegRej(IAX2FullFrameProtocol * src);
00135
00138 void OnNoResponseTimeout();
00139
00142 void PrintOn(ostream & strm) const;
00143
00145 virtual void ProcessLists();
00146
00149 virtual void ProcessFullFrame(IAX2FullFrame & fullFrame);
00150
00152 virtual void ProcessNetworkFrame(IAX2MiniFrame * src);
00153
00156 virtual PBoolean ProcessNetworkFrame(IAX2FullFrameProtocol * src);
00157
00163 void ResetCall();
00164
00171 virtual PBoolean IncomingMessageOutOfOrder(IAX2FullFrame *)
00172 { return PFalse; };
00173
00174
00177 PRandom regRandom;
00178 };
00179
00180
00181 #endif // OPAL_IAX2
00182
00183 #endif // OPAL_IAX2_REGPROCESSOR_H