Liusheng, You can do this way. pjcallback.h class PjCallback { public: PjCallback() {} ~PjCallback() {} void OnIncomingCall(); } extern "C" void pjcallback_on_incoming_call_wrapper(pjsip_rx_data *rdata); pjcallback.cpp #include "pjcallback.h" void PjCallback::OnIncomingCall(pjsip_rx_data *rdata) { // do something } PjCallback mycb(); // you can put this somewhere void pjcallback_on_incoming_call_wrapper(pjsip_rx_data *rdata) { mycb.onIncomingCall(); } then you can call "pjcallback_on_incoming_call_wrapper" from pjsip module's callback func. regards, Gang > Liusheng schrieb: > > I have an compile error as follow, when I used klaus's class PjCallback. > > > > main.cpp:(.text+0x8a): undefined reference to `globalPjCallback' > > main.cpp:(.text+0xa4): undefined reference to `PjCallback::PjCallback()' > > main.cpp:(.text+0xbf): undefined reference to > > `PjCallback::on_incoming_call_wrapper(int, int, pjsip_rx_data*)' > > main.cpp:(.text+0xc9): undefined reference to > > `PjCallback::on_call_media_state_wrapper(int)' > > main.cpp:(.text+0xd3): undefined reference to > > `PjCallback::on_call_state_wrapper(int, pjsip_event*)' > > collect2: ld returned 1 exit status > > make: *** [main.o] Error 1 > > > > > > Actually, I have defined all this function in Pjcallback class, and call > > them as follow: > > /* Init pjsua */ > > { > > pjsua_config cfg; > > pjsua_logging_config log_cfg; > > PjCallback *pjCallback; > > globalPjCallback = pjCallback = 0; > > pjCallback = new PjCallback(); > > > > pjsua_config_default(&cfg); > > cfg.cb.on_incoming_call = > > PjCallback::on_incoming_call_wrapper; //&on_incoming_call; > > cfg.cb.on_call_media_state > > =PjCallback::on_call_media_state_wrapper; // &on_call_media_state; > > cfg.cb.on_call_state = > > PjCallback::on_call_state_wrapper; //&on_call_state; > > > > Can you help me? > > > > my make file as follow: > > > > #Modify this to point to the PJSIP location. > > PJBASE=/home/ym/legacy_project_here/pjproject-0.9.0 > > include $(PJBASE)/build.mak > > CC = $(APP_CC) > > CC = g++ > > LDFLAGS = $(APP_LDFLAGS) > > LDLIBS = $(APP_LDLIBS) > > CFLAGS = $(APP_CFLAGS) > > CPPFLAGS= ${CFLAGS} > > > > # this is the line you will need to build the binary. > > all: PjSourcePort.o PjSinkPort.o PjCallback.o main.o > > PjSourcePort.o: PjSourcePort.cpp > > PjSinkPort.o: PjSinkPort.cpp > > PjCallback.o: PjCallback.cpp > > main.o: main.cpp > > $(CC) -o $@ $< $(CPPFLAGS) $(LDFLAGS) $(LDLIBS) > > clean: > > rm -f PjSourcePort.o PjSinkPort.o PjCallback.o main.o sipgw > > > > > > > > Thanks very much > > > > > > > > > > > Date: Fri, 25 Jul 2008 16:27:38 +0200 > > > From: klaus.mailinglists@xxxxxxxxx > > > To: pjsip at lists.pjsip.org > > > Subject: Re: who have the sample souce code use C++ call > PJSIP? > > > > > > > > > You can take a look at QjSImple. It is Qt based (C++), thus you can > get > > > an idea how it works. (With C++ you need some kind of wrapper for the > C > > > callbacks, otherwise there is no difference if you program in C or > C++) > > > > > > http://www.ipcom.at/index.php?id=560 > > > > > > regards > > > klaus > > > > > > Liusheng schrieb: > > > > Hi,ALL: > > > > > > > > I want to develop c++ class to call API of PJSIP, for example; > > > > pjsua_call_make_call. > > > > > > > > Does someone have such example souce code? could you help me? > > > > > > > > Thanks > > > > > > > > > > ------------------------------------------------------------------------ > > > > ???Hotmail???????? Windows Live Mail? ????? > > > > <http://get.live.com/wl/all> > > > > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > > > _______________________________________________ > > > > Visit our blog: http://blog.pjsip.org > > > > > > > > pjsip mailing list > > > > pjsip at lists.pjsip.org > > > > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > > > > > > _______________________________________________ > > > Visit our blog: http://blog.pjsip.org > > > > > > pjsip mailing list > > > pjsip at lists.pjsip.org > > > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > > > > > > ------------------------------------------------------------------------ > > MSN????????????? ??????? <http://im.live.cn/minigame> > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Visit our blog: http://blog.pjsip.org > > > > pjsip mailing list > > pjsip at lists.pjsip.org > > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip at lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20080731/842e75c5/attachment-0001.html