krunal09 / sample

Automatically exported from code.google.com/p/csipsimple
0 stars 0 forks source link

Register timeout always reverts to 15 sec (Expert account wizard) #75

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create an account with the Expert Wizard
2. Set the Register Timeout to 120
3. Save the account
4. Re-edit the account and open Register Timeout

What is the expected output? What do you see instead?

Expected to see 120, saw 15.

What version of the product are you using? On what operating system?

Build from trunk build 127. Android 2.1 Update 1 (HTC Incredible)

SOLUTION:

See attached copy of modified Expert.java

Please provide any additional information below.

Original issue reported on code.google.com by dc3de...@gmail.com on 9 Jul 2010 at 2:18

Attachments:

GoogleCodeExporter commented 9 years ago
Fantastic !

Do you want to directly contribute to the code, all your modification seems 
good. I can open the svn for you if you want.

Just mail me your google account at 
r3gis.3r at gmail.com
or 
r3gis at r3gis.fr

Btw, i'll integrate your modifications right now.

Original comment by r3gis...@gmail.com on 9 Jul 2010 at 10:22

GoogleCodeExporter commented 9 years ago
Ok, in fact, only the ka_interval modification is needed in expert wizard.

In the case account has been modified, account.cfg.getReg_timeout() doesn't 
contains default value, but the value filled by account creation from the 
database.

See .db.DBAdapter.contentValuesToAccount()
If not, there is maybe something wrong in this function. But, it's this 
function that should be modified : else it means that the configuration is not 
taken into account by sip stack.
I'll check it .

Original comment by r3gis...@gmail.com on 9 Jul 2010 at 10:33

GoogleCodeExporter commented 9 years ago
Issue 76 has been merged into this issue.

Original comment by r3gis...@gmail.com on 9 Jul 2010 at 10:36

GoogleCodeExporter commented 9 years ago
Should be ok in prebuild 4 for 0.00-12

http://code.google.com/p/csipsimple/downloads/detail?name=CSipSimple_pre4.apk

Original comment by r3gis...@gmail.com on 9 Jul 2010 at 11:54

GoogleCodeExporter commented 9 years ago
> Ok, in fact, only the ka_interval modification is needed in expert wizard.
> [...]
> See .db.DBAdapter.contentValuesToAccount()

That's the first area I looked into. I walked through contentValuesToAccount() 
in the debugger for both new account creation and for editing an existing 
account, and it is correctly setting the Register Timeout in the db 

tmp_i = args.getAsInteger(FIELD_REG_TIMEOUT);
if (tmp_i != null) {
    account.cfg.setReg_timeout(tmp_i);
}

The correct value is coming out of the db correctly in accountToContentValues() 
as well:

args.put(FIELD_REG_TIMEOUT, account.cfg.getReg_timeout());

The problem is that later, the code I modified runs and it replaces the value 
coming from the preference with whatever value is in the SIP stack, and that is 
NOT what was in the preference, it is always 15 sec. By the way this interval 
for register is FAR too short.

> Do you want to directly contribute to the code[...]?

I'm brand new to Eclipse and to Android development (days, not even weeks), but 
I used to do Java development years ago and that part is all coming back 
quickly. 

I have made several changes to the resource strings for clarity and to satisfy 
my language preferences (American English ... I know both British and American 
English and the differences between them).

I also am fairly familiar with SIP etc. and have diagnosed multiple problems 
via network packet sniffing. 

With that said, I'd be honored to have commit access, and I will do my very 
best. I will write you.

Original comment by dc3de...@gmail.com on 9 Jul 2010 at 12:11

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
OK I just diffed my code with yours in 131, and as you said, you only fixed the 
incorrect variable ref for Keep Alive. The problem with the value returning to 
15 seconds for Register Timeout will still be there. Did you test it by setting 
it to 300 sec then saving the account, exiting from CSipSimple, starting back 
up, and looking at the value? It will not be 300 but 15. And the same type of 
problem will still exist for Keep Alive Interval.

Original comment by dc3de...@gmail.com on 9 Jul 2010 at 12:31

GoogleCodeExporter commented 9 years ago
You're right, there is still something wrong with my correction.
My mistake is that I though that I was in set values and not get values.

I commit another version (without the test on the current value of the field 
since always empty at creation).

I also have to change the default value for registration timeout. You're right, 
15s is really too short. That's the default value for desktop stack but it's 
not really good for a mobile sip application.

Original comment by r3gis...@gmail.com on 9 Jul 2010 at 12:49

GoogleCodeExporter commented 9 years ago
Ok for the default value, it's 300s in fact. 
The 15s was a side effect of the ka_interval bug.

Original comment by r3gis...@gmail.com on 9 Jul 2010 at 12:57

GoogleCodeExporter commented 9 years ago
I am confused. First the saved preference is used to fill the Register Timeout 
field

  accountRegTimeout = (EditTextPreference) findPreference("reg_timeout");

Then later, the (saved preference) field is REPLACED by the default value from 
the SIP stack:

  accountRegTimeout.setText(Long.toString(account.cfg.getReg_timeout()));

It seems that this will OVERWRITE  the saved preference with the SIP stack 
default value...

Original comment by dc3de...@gmail.com on 9 Jul 2010 at 1:37

GoogleCodeExporter commented 9 years ago
I believe you want to test to see if there was NO saved preference (new 
account), and only then should you fill the field with the SIP stack default?

Original comment by dc3de...@gmail.com on 9 Jul 2010 at 1:39

GoogleCodeExporter commented 9 years ago
You are confusing the role of each method I think.

In fact,
this :
accountRegTimeout = (EditTextPreference) findPreference("reg_timeout");
Only associate the editText UI component to an internal object of the class.
It has no interaction with the account.

accountRegTimeout.setText(Long.toString(account.cfg.getReg_timeout()));
is call then and fill the field with values from the current account. This can 
be the default value if it is a new account, but it can also be the current 
account value. A important thing to understand is that here preferences are not 
use to store something here. Preference are only used to make the interface 
easier to code. The account object contains the accurate value for this current 
account. Theses values are get from the database (if present) and if not from 
the default values from pjsip.
So when the setText is done, value from account.cfg should be ok.

Original comment by r3gis...@gmail.com on 9 Jul 2010 at 1:52

GoogleCodeExporter commented 9 years ago
I get it, thanks!

Original comment by dc3de...@gmail.com on 9 Jul 2010 at 2:03

GoogleCodeExporter commented 9 years ago
This all works now (tested on r147), so I am changing it to Verified. 

Original comment by dc3de...@gmail.com on 14 Jul 2010 at 1:26

GoogleCodeExporter commented 9 years ago
I have installed latest nighlty build of CsipSimple on Android 4.0.But after 
dialling a number on local using expert mode it is giving error that 
PJLIB_EDSN_NXDOMAIN "Name Error".Please tell the solution.
Thank you. 

Original comment by apurva.r...@gmail.com on 22 Apr 2013 at 1:48