Hi,
To do that you'll have to modify a little bit more deep the project. I've yet integrated that as an easy way to get additionals headers so you'll have to do that by hand.
So several steps to follow :
1 - Modify this file :
http://code.google.com/p/csipsimple/source/browse/trunk/CSipSimple/jni/swig-glue/pj_callback.cpp to add a
on_reg2_state_wrapper
Just copy paste what's done for on_reg_state_wrapper and replace the reg by reg2 and add the additional parameter.
Also add it on the bottom of the file to the pjsua_callback struct.
2 - In the previous steps you have normally used a
registeredCallbackObject->on_reg2_state(acc_id, info);
You have to define it in the CallbackObject now.
To do so, edit the
http://code.google.com/p/csipsimple/source/browse/trunk/CSipSimple/jni/swig-glue/pj_callback.h
which is basically the interface of this callback object and is used to generate the swig bindings
3 - Run make again, it should detects interface has changed and regenerate the java interface.
At this point you can add in the UAStateReceiver class your implementation of the on_reg2_state.
For now just put a placeholder to log and test that you pass in this method.
4 - No you have to add your method that will treat the pjsua_reg_info and return your balance.
To do so, I advise you to do it in a separate file in csipsimple-wrapper folders for long terms ease to support it. (it means that you'll have to modify swig-glue makefile so that it takes your .h file into account).
But for now, for simplicity I'll explain you adding things in
http://code.google.com/p/csipsimple/source/browse/trunk/CSipSimple/jni/csipsimple-wrapper/src/pjsua_jni_addons.c
(Once it will work with that you should migrate to your own file).
So for the fast way, add in the
http://code.google.com/p/csipsimple/source/browse/trunk/CSipSimple/jni/csipsimple-wrapper/src/pjsua_jni_addons.c your own method that takes as parameter a pjsua_reg_info* and returns a pj_str_t.
Also add it to the .h of pjsua_jni_addons.h so that it will be taken into account in the swig glue generation process.
Take care to declare the the method just like it's done for other methods in .h else it may not be taken into account as an exported method.
5 - Run make again, it should detects interface has changed and regenerate java interface.
At this point you can now add on the java on_reg2_state method (where previously you added the log) the call to pjsua.your_method_name(info). It will return you the pj_str_t that you can transform to java string using the dedicated method of pjService (it's a static that safely convert).
6 - you have now your java string in the callback. I advise you at option to :
-- Have your own content provider on your code (the code that is dedicated to your application and should not overlap csipsimple code) and update your content provider with this new value.
-- Broadcast an intent that your code has registered on it's side and will get.
In any case, do NOT add a static string somewhere or access directly to the value from outside/from the UI. If you do so, it will be hard to maintain, not clean and you'll experiment problems with processes. So broadcast intent or content provider are the correct solution.
On my side I have one task to add possibility to get all private headers as a bundle available in state of the profile registration. I'll do more or less the same thing (except I'll extract all X-* headers and save it as a bundle in the profile state content provider).