Hi Thiago! Thanks for this hint. I did it similar. I stored the pointer to my main object in a global variable. Then, the registered C callback function just calls the real callback (a member of my main object). Unfortunately sometimes my application crashes and I have no idea why :-( thanks klaus tloginbr-pjsip at yahoo.com.br schrieb: > I have one application in c++. My solution is not the > most pretty, but it works just fine. I have one file > called app_main.cpp that has all my callback functions > in plain C that I register with pjsua. When the call > comes in (on_incoming_call) I use > pjsua_call_set_user_data to save the pointer to the > object that I have my callback function (the real > one). All my callbacks that are inside app_main.cpp > only get the address of the object with > pjsua_call_get_user_data and then call the real > callback function from this object. Bellow is one > example for the callback that receives dtmf: > > static void on_dtmf_digit(pjsua_call_id call_id, int > digit ) > { > void *tpjcCallPtr; > tpjcCallPtr = pjsua_call_get_user_data(call_id); > ((TPJCall*)tpjcCallPtr)->ReceiveDTMF((char)digit); > } > > > My object that holds the code for the callback is of > type TPJCall that has a member function called > ReceiveDTMF. It doesn't even need to be static or > anything. > > Thiago > >> Hi! >> >> I'm trying to add pjsip to a QT C++ application. >> This gives me headaches >> as I have no clue how to make callbacks in C++. >> There are lots of >> different approaches (static member function as >> wrapper, templates ...). >> >> I tried the static member function wrapper with >> logging callbacks but my >> application crashes ~50%. >> >> I wonder if someone have practical tips for my how >> to connect pjsip's >> callbacks to member functions. >> >> thanks >> klaus >> >> _______________________________________________ >> 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 > > > > Abra sua conta no Yahoo! Mail, o ?nico sem limite de espa?o para armazenamento! > http://br.mail.yahoo.com/ > > _______________________________________________ > 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