From 8e497d71eff983feaec4aa0e409a30e2a32a5887 Mon Sep 17 00:00:00 2001 From: Ludivine Fafournoux Date: Mon, 13 Apr 2020 11:56:26 +0200 Subject: [PATCH 1/4] #212 add delay to re-registration WIP --- .../Configurations/VSLAccountConfiguration.h | 34 +++++++++++++++++++ Pod/Classes/VSLAccount.m | 9 +++++ Pod/Classes/VialerSIPLib.h | 7 ++++ Pod/Classes/VialerSIPLib.m | 8 +++++ 4 files changed, 58 insertions(+) diff --git a/Pod/Classes/Configurations/VSLAccountConfiguration.h b/Pod/Classes/Configurations/VSLAccountConfiguration.h index cb8d1a6d..74e0d8ad 100644 --- a/Pod/Classes/Configurations/VSLAccountConfiguration.h +++ b/Pod/Classes/Configurations/VSLAccountConfiguration.h @@ -108,6 +108,40 @@ typedef NS_ENUM(NSUInteger, VSLContactRewriteMethod) { */ @property (nonatomic) BOOL sipRegisterOnAdd; +/** +* Specify interval of auto registration retry upon registration failure +* (including caused by transport problem), in second. Set to 0 to +* disable auto re-registration. Note that if the registration retry +* occurs because of transport failure, the first retry will be done +* after \a firstRetryIntervalSec seconds instead. Also note that +* the interval will be randomized slightly by some seconds (specified +* in \a reg_retry_random_interval) to avoid all clients re-registering +* at the same time. +* +* See also \a firstRetryIntervalSec and \a randomRetryIntervalSec +* settings. +* +* Default: PJSUA_REG_RETRY_INTERVAL +*/ +@property (nonatomic) unsigned int retryIntervalSec; + +/** +* Specify interval of auto registration retry upon registration failure +* (including caused by transport problem), in second. Set to 0 to +* disable auto re-registration. Note that if the registration retry +* occurs because of transport failure, the first retry will be done +* after \a firstRetryIntervalSec seconds instead. Also note that +* the interval will be randomized slightly by some seconds (specified +* in \a reg_retry_random_interval) to avoid all clients re-registering +* at the same time. +* +* See also \a firstRetryIntervalSec and \a randomRetryIntervalSec +* settings. +* +* Default: PJSUA_REG__FIRST_RETRY_INTERVAL +*/ +@property (nonatomic) unsigned int retryFirstIntervalSec; + /** * If YES, the account presence will be published to the server where the account belongs. */ diff --git a/Pod/Classes/VSLAccount.m b/Pod/Classes/VSLAccount.m index 438f0d89..99ba16cb 100644 --- a/Pod/Classes/VSLAccount.m +++ b/Pod/Classes/VSLAccount.m @@ -111,6 +111,15 @@ - (BOOL)configureWithAccountConfiguration:(VSLAccountConfiguration * _Nonnull)ac acc_cfg.id = [[accountConfiguration.sipAddress stringByAppendingString:transportString] prependSipUri].pjString; acc_cfg.reg_uri = [[accountConfiguration.sipDomain stringByAppendingString:transportString] prependSipUri].pjString; acc_cfg.register_on_acc_add = accountConfiguration.sipRegisterOnAdd ? PJ_TRUE : PJ_FALSE; + + acc_cfg.reg_first_retry_interval = accountConfiguration.retryFirstIntervalSec ? accountConfiguration.retryFirstIntervalSec : 10; + NSLog(@"lib"); + NSLog(@"%i", acc_cfg.reg_first_retry_interval); + NSLog(@"%i", accountConfiguration.retryFirstIntervalSec); + acc_cfg.reg_retry_interval = accountConfiguration.retryIntervalSec ? accountConfiguration.retryIntervalSec : 300; + NSLog(@"lib"); + NSLog(@"%i ", acc_cfg.reg_retry_interval); + NSLog(@"%i ", accountConfiguration.retryIntervalSec); acc_cfg.publish_enabled = accountConfiguration.sipPublishEnabled ? PJ_TRUE : PJ_FALSE; acc_cfg.reg_timeout = VSLAccountRegistrationTimeoutInSeconds; acc_cfg.drop_calls_on_reg_fail = accountConfiguration.dropCallOnRegistrationFailure ? PJ_TRUE : PJ_FALSE; diff --git a/Pod/Classes/VialerSIPLib.h b/Pod/Classes/VialerSIPLib.h index 7ca071e2..8c056ab3 100644 --- a/Pod/Classes/VialerSIPLib.h +++ b/Pod/Classes/VialerSIPLib.h @@ -107,6 +107,13 @@ typedef NS_ENUM(NSUInteger, VialerSIPLibErrors) { */ @property (readonly, nonatomic) BOOL sipRegisterOnAdd; + +@property (readonly, nonatomic) unsigned int retryIntervalSec; +@optional + + +@property (readonly, nonatomic) unsigned int retryFirstIntervalSec; +@optional /** * When set to YES, calls will be dropped after registration fails. * diff --git a/Pod/Classes/VialerSIPLib.m b/Pod/Classes/VialerSIPLib.m index 82d3729a..95d27f47 100644 --- a/Pod/Classes/VialerSIPLib.m +++ b/Pod/Classes/VialerSIPLib.m @@ -113,6 +113,14 @@ - (VSLAccount *)createAccountWithSipUser:(id _Nonnull __autorel if ([sipUser respondsToSelector:@selector(sipRegisterOnAdd)]) { accountConfiguration.sipRegisterOnAdd = sipUser.sipRegisterOnAdd; } + + if ([sipUser respondsToSelector:@selector(retryFirstIntervalSec)]) { + accountConfiguration.retryFirstIntervalSec = sipUser.retryFirstIntervalSec; + } + + if ([sipUser respondsToSelector:@selector(retryIntervalSec)]) { + accountConfiguration.retryIntervalSec = sipUser.retryIntervalSec; + } if ([sipUser respondsToSelector:@selector(dropCallOnRegistrationFailure)]) { accountConfiguration.dropCallOnRegistrationFailure = sipUser.dropCallOnRegistrationFailure; From 8202645bf52809a4040c51bddffcad68d167b9d5 Mon Sep 17 00:00:00 2001 From: Ludivine Fafournoux Date: Mon, 13 Apr 2020 12:10:03 +0200 Subject: [PATCH 2/4] Clean + update version --- Pod/Classes/VSLAccount.m | 6 ------ VialerSIPLib.podspec | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/Pod/Classes/VSLAccount.m b/Pod/Classes/VSLAccount.m index 99ba16cb..43fc198e 100644 --- a/Pod/Classes/VSLAccount.m +++ b/Pod/Classes/VSLAccount.m @@ -113,13 +113,7 @@ - (BOOL)configureWithAccountConfiguration:(VSLAccountConfiguration * _Nonnull)ac acc_cfg.register_on_acc_add = accountConfiguration.sipRegisterOnAdd ? PJ_TRUE : PJ_FALSE; acc_cfg.reg_first_retry_interval = accountConfiguration.retryFirstIntervalSec ? accountConfiguration.retryFirstIntervalSec : 10; - NSLog(@"lib"); - NSLog(@"%i", acc_cfg.reg_first_retry_interval); - NSLog(@"%i", accountConfiguration.retryFirstIntervalSec); acc_cfg.reg_retry_interval = accountConfiguration.retryIntervalSec ? accountConfiguration.retryIntervalSec : 300; - NSLog(@"lib"); - NSLog(@"%i ", acc_cfg.reg_retry_interval); - NSLog(@"%i ", accountConfiguration.retryIntervalSec); acc_cfg.publish_enabled = accountConfiguration.sipPublishEnabled ? PJ_TRUE : PJ_FALSE; acc_cfg.reg_timeout = VSLAccountRegistrationTimeoutInSeconds; acc_cfg.drop_calls_on_reg_fail = accountConfiguration.dropCallOnRegistrationFailure ? PJ_TRUE : PJ_FALSE; diff --git a/VialerSIPLib.podspec b/VialerSIPLib.podspec index cd7f4174..d20896be 100644 --- a/VialerSIPLib.podspec +++ b/VialerSIPLib.podspec @@ -9,7 +9,7 @@ Pod::Spec.new do |s| s.name = "VialerSIPLib" - s.version = "3.7.1" + s.version = "3.7.2" s.summary = "Vialer SIP Library for iOS" s.description = "Objective-C wrapper around PJSIP." s.homepage = "https://github.com/VoIPGRID/VialerSIPLib" From fdfa16460a013d96b5c5d1c924874385c35e8add Mon Sep 17 00:00:00 2001 From: Ludivine Fafournoux Date: Mon, 27 Apr 2020 10:55:21 +0200 Subject: [PATCH 3/4] Fix version number --- VialerSIPLib.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VialerSIPLib.podspec b/VialerSIPLib.podspec index d20896be..cd7f4174 100644 --- a/VialerSIPLib.podspec +++ b/VialerSIPLib.podspec @@ -9,7 +9,7 @@ Pod::Spec.new do |s| s.name = "VialerSIPLib" - s.version = "3.7.2" + s.version = "3.7.1" s.summary = "Vialer SIP Library for iOS" s.description = "Objective-C wrapper around PJSIP." s.homepage = "https://github.com/VoIPGRID/VialerSIPLib" From 1b5fc8836c5887835c1ed871b6b8c9d66498cf99 Mon Sep 17 00:00:00 2001 From: Ludivine Fafournoux Date: Mon, 27 Apr 2020 10:57:08 +0200 Subject: [PATCH 4/4] Fix description retryIntervalSec and retryFirstIntervalSec --- .../Configurations/VSLAccountConfiguration.h | 36 +++++-------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/Pod/Classes/Configurations/VSLAccountConfiguration.h b/Pod/Classes/Configurations/VSLAccountConfiguration.h index 74e0d8ad..21a19d59 100644 --- a/Pod/Classes/Configurations/VSLAccountConfiguration.h +++ b/Pod/Classes/Configurations/VSLAccountConfiguration.h @@ -109,37 +109,17 @@ typedef NS_ENUM(NSUInteger, VSLContactRewriteMethod) { @property (nonatomic) BOOL sipRegisterOnAdd; /** -* Specify interval of auto registration retry upon registration failure -* (including caused by transport problem), in second. Set to 0 to -* disable auto re-registration. Note that if the registration retry -* occurs because of transport failure, the first retry will be done -* after \a firstRetryIntervalSec seconds instead. Also note that -* the interval will be randomized slightly by some seconds (specified -* in \a reg_retry_random_interval) to avoid all clients re-registering -* at the same time. -* -* See also \a firstRetryIntervalSec and \a randomRetryIntervalSec -* settings. -* -* Default: PJSUA_REG_RETRY_INTERVAL -*/ + * Specify interval in seconds of auto registration retry upon registration failure. + * + * Default: PJSUA_REG_RETRY_INTERVAL + */ @property (nonatomic) unsigned int retryIntervalSec; /** -* Specify interval of auto registration retry upon registration failure -* (including caused by transport problem), in second. Set to 0 to -* disable auto re-registration. Note that if the registration retry -* occurs because of transport failure, the first retry will be done -* after \a firstRetryIntervalSec seconds instead. Also note that -* the interval will be randomized slightly by some seconds (specified -* in \a reg_retry_random_interval) to avoid all clients re-registering -* at the same time. -* -* See also \a firstRetryIntervalSec and \a randomRetryIntervalSec -* settings. -* -* Default: PJSUA_REG__FIRST_RETRY_INTERVAL -*/ + * Specify interval in seconds of the registration retry upon first registration failure. + * + * Default: PJSUA_REG__FIRST_RETRY_INTERVAL + */ @property (nonatomic) unsigned int retryFirstIntervalSec; /**