On 27.09.10 16:39, Антон Загорский wrote:
Hello, it is again me =)Now I'm developing a callcenter module which will implements ACD feature. So, I should maintain SIP signals. Here is main part of my classes: Interfaces: class CallCenterFactory: public AmSessionFactory, public AmSessionEventHandler { public: CallCenterFactory(const string& _app_name); ... bool onSipReply (const AmSipReply& rep); bool onSipEvent (AmSipEvent* ev); static CallCenterFactory* instance; }; class CallCenterCallerDialog: public AmB2ABCallerSession { AmB2ABCallerSession * myCaller; ... public: CallCenterCallerDialog(const string& filename); void onInvite(const AmSipRequest& req); void process(AmEvent* event); void onSessionStart(const AmSipRequest& req); }; Realizations: CallCenterFactory* CallCenterFactory::instance = NULL; EXPORT_SESSION_FACTORY(CallCenterFactory,MOD_NAME); CallCenterFactory::CallCenterFactory(const string& _app_name) : AmSessionFactory(_app_name) { instance = this; }; bool CallCenterFactory::onSipReply (const AmSipReply& rep) { DBG("onSipReply\n"); return false; }; bool CallCenterFactory::onSipEvent (AmSipEvent* ev) { DBG("onSipEvent\n"); return false; }; void CallCenterCallerDialog::onSessionStart(const AmSipRequest& req) { ... myCaller = new AmB2ABCallerSession(); myCaller->connectCallee("sip:[email protected]", "sip:[email protected]", "sip:[email protected]", "sip:[email protected]"); myCaller->addHandler(CallCenterFactory::instance); }; But CallCenterFactory::onSipReply and CallCenterFactory::onSipEvent didn't call. Why? How can I react on SIP events (Trying, Ringing, OK, BYE, etc) having just instance of AmSession (AmB2BASession) class? Or there is no another way that writing my own class deriving from AmB2ABSession?
In fact, deriving directly from AmSession should be just fine. Are you sure that your module is loaded and executed (i.e. some call get redirected to your plug-in)?
Also, beware that C++ can be very nasty: if your virtual functions do not exactly correspond to those used in the parent class, the compiler will think that you want to define another function, which of course will not be called from the core.
For the details, I need to know which code-base you are exactly using, and have a look at the exact code you are trying. You can also try to load the code in gdb and place some breakpoints where the methods in question are referenced in the core.
Cheers Raphael. _______________________________________________ Sems mailing list [email protected] http://lists.iptel.org/mailman/listinfo/sems
