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 #ifndef _AmSessionEventHandler_h
00028 #define _AmSessionEventHandler_h
00029
00030 #include "AmArg.h"
00031 #include "AmSipMsg.h"
00032 #include "AmSipEvent.h"
00033 #include "AmSipDialog.h"
00034 #include <string>
00035 using std::string;
00036
00037 class AmConfigReader;
00038
00049 class AmSessionEventHandler
00050 : public AmObject
00051 {
00052 public:
00053 bool destroy;
00054
00055 AmSessionEventHandler()
00056 : destroy(true) {}
00057
00058 virtual ~AmSessionEventHandler() {}
00059
00061 virtual int configure(AmConfigReader& conf);
00062
00063
00064
00065
00066
00067 virtual bool process(AmEvent*);
00068
00069 virtual bool onSipRequest(const AmSipRequest&);
00070 virtual bool onSipReply(const AmSipReply&, AmSipDialog::Status old_dlg_status);
00071 virtual bool onSipReqTimeout(const AmSipRequest &);
00072 virtual bool onSipRplTimeout(const AmSipRequest &, const AmSipReply &);
00073
00074 virtual bool onSendRequest(AmSipRequest& req, int flags);
00075 virtual bool onSendReply(AmSipReply& reply, int flags);
00076 };
00077
00078
00079 #if __GNUC__ < 3
00080 #define CALL_EVENT_H(method,args...) \
00081 do{\
00082 vector<AmSessionEventHandler*>::iterator evh = ev_handlers.begin(); \
00083 bool stop = false; \
00084 while((evh != ev_handlers.end()) && !stop){ \
00085 stop = (*evh)->method( ##args ); \
00086 evh++; \
00087 } \
00088 if(stop) \
00089 return; \
00090 }while(0)
00091 #else
00092 #define CALL_EVENT_H(method,...) \
00093 do{\
00094 vector<AmSessionEventHandler*>::iterator evh = ev_handlers.begin(); \
00095 bool stop = false; \
00096 while((evh != ev_handlers.end()) && !stop){ \
00097 stop = (*evh)->method( __VA_ARGS__ ); \
00098 evh++; \
00099 } \
00100 if(stop) \
00101 return; \
00102 }while(0)
00103 #endif
00104
00105 #endif