diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7fa405218..c1509b310 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,8 @@ Group changes to describe their impact on the project, as follows:
## [Unreleased]
### Added
- Added "Forgot your password?" link in Linphone account assistant
+### Changed
+- Push notifications are now configurable per account
### Fixed
- Fix invalid photo rotation when using Camera for avatars
- Parse user input as SIP address or phone number depending on default account settings: if "substitute + by country code" is set,
diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m
index 2e66d61df..ed6232b32 100644
--- a/Classes/LinphoneCoreSettingsStore.m
+++ b/Classes/LinphoneCoreSettingsStore.m
@@ -124,6 +124,7 @@
// default values
{
+ [self setBool:NO forKey:@"account_pushnotification_preference"];
[self setObject:@"" forKey:@"account_mandatory_username_preference"];
[self setObject:@"" forKey:@"account_mandatory_domain_preference"];
[self setCString:"" forKey:@"account_display_name_preference"];
@@ -146,6 +147,11 @@
proxy = proxies->data;
// root section
{
+ const char *refkey = linphone_proxy_config_get_ref_key(proxy);
+ if (refkey) {
+ BOOL pushEnabled = (strcmp(refkey, "push_notification") == 0);
+ [self setBool:pushEnabled forKey:@"account_pushnotification_preference"];
+ }
const LinphoneAddress *identity_addr = linphone_proxy_config_get_identity_address(proxy);
if (identity_addr) {
const char *server_addr = linphone_proxy_config_get_server_addr(proxy);
@@ -336,8 +342,6 @@
break;
}
[self setCString:val forKey:@"media_encryption_preference"];
- [self setBool:[lm lpConfigBoolForKey:@"pushnotification_preference" withDefault:NO]
- forKey:@"pushnotification_preference"];
[self setInteger:linphone_core_get_upload_bandwidth(LC) forKey:@"upload_bandwidth_preference"];
[self setInteger:linphone_core_get_download_bandwidth(LC) forKey:@"download_bandwidth_preference"];
[self setBool:linphone_core_adaptive_rate_control_enabled(LC) forKey:@"adaptive_rate_control_preference"];
@@ -443,7 +447,7 @@
if (username && [username length] > 0 && domain && [domain length] > 0) {
int expire = [self integerForKey:@"account_expire_preference"];
BOOL isWifiOnly = [self boolForKey:@"wifi_only_preference"];
- BOOL pushnotification = [self boolForKey:@"pushnotification_preference"];
+ BOOL pushnotification = [self boolForKey:@"account_pushnotification_preference"];
NSString *prefix = [self stringForKey:@"account_prefix_preference"];
NSString *proxyAddress = [self stringForKey:@"account_proxy_preference"];
@@ -522,7 +526,7 @@
linphone_proxy_config_set_dial_escape_plus(proxyCfg, substitute_plus_by_00);
}
- [lm lpConfigSetInt:pushnotification forKey:@"pushnotification_preference"];
+ linphone_proxy_config_set_ref_key(proxyCfg, pushnotification ? "push_notification" : NULL);
[LinphoneManager.instance configurePushTokenForProxyConfig:proxyCfg];
linphone_proxy_config_enable_register(proxyCfg, is_enabled);
@@ -599,7 +603,6 @@
account_changed |= [self valueChangedForKey:@"port_preference"];
account_changed |= [self valueChangedForKey:@"random_port_preference"];
account_changed |= [self valueChangedForKey:@"use_ipv6"];
- account_changed |= [self valueChangedForKey:@"pushnotification_preference"];
if (account_changed)
[self synchronizeAccounts];
diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m
index 558ab7bc2..37d67e471 100644
--- a/Classes/LinphoneManager.m
+++ b/Classes/LinphoneManager.m
@@ -520,6 +520,20 @@ static void migrateWizardToAssistant(const char *entry, void *user_data) {
// lp_config_for_each_entry(_configDb, "wizard", migrateWizardToAssistant, (__bridge void *)(self));
}
+- (void)migratePushNotificationPerAccount {
+ NSString *s = [self lpConfigStringForKey:@"pushnotification_preference"];
+ if (s && s.boolValue) {
+ LOGI(@"Migrating push notification per account, enabling for ALL");
+ [self lpConfigSetBool:NO forKey:@"pushnotification_preference"];
+ const MSList *proxies = linphone_core_get_proxy_config_list(LC);
+ while (proxies) {
+ linphone_proxy_config_set_ref_key(proxies->data, "push_notification");
+ [self configurePushTokenForProxyConfig:proxies->data];
+ proxies = proxies->next;
+ }
+ }
+}
+
#pragma mark - Linphone Core Functions
+ (LinphoneCore *)getLc {
@@ -533,27 +547,12 @@ static void migrateWizardToAssistant(const char *entry, void *user_data) {
#pragma mark Debug functions
-struct _entry_data {
- const LpConfig *conf;
- const char *section;
-};
-
-static void dump_entry(const char *entry, void *data) {
- struct _entry_data *d = (struct _entry_data *)data;
- const char *value = lp_config_get_string(d->conf, d->section, entry, "");
- LOGI(@"%s=%s", entry, value);
-}
-
-static void dump_section(const char *section, void *data) {
- LOGI(@"[%s]", section);
- struct _entry_data d = {(const LpConfig *)data, section};
- lp_config_for_each_entry((const LpConfig *)data, section, dump_entry, &d);
-}
-
+ (void)dumpLcConfig {
if (theLinphoneCore) {
LpConfig *conf = LinphoneManager.instance.configDb;
- lp_config_for_each_section(conf, dump_section, conf);
+ char *config = lp_config_dump(conf);
+ LOGI(@"\n%s", config);
+ ms_free(config);
}
}
@@ -825,9 +824,7 @@ static void linphone_iphone_configuring_status_changed(LinphoneCore *lc, Linphon
if (_wasRemoteProvisioned) {
LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(LC);
if (cfg) {
- linphone_proxy_config_edit(cfg);
[self configurePushTokenForProxyConfig:cfg];
- linphone_proxy_config_done(cfg);
}
}
}
@@ -1398,8 +1395,8 @@ static LinphoneCoreVTable linphonec_vtable = {
linphone_core_set_call_logs_database_path(theLinphoneCore, [chatDBFileName UTF8String]);
[self migrationLinphoneSettings];
-
[self migrationFromVersion2To3];
+ [self migratePushNotificationPerAccount];
[self setupNetworkReachabilityCallback];
@@ -1686,9 +1683,9 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
// handle proxy config if any
if (proxyCfg) {
- if ([LinphoneManager.instance lpConfigBoolForKey:@"backgroundmode_preference"] ||
- [LinphoneManager.instance lpConfigBoolForKey:@"pushnotification_preference"]) {
-
+ const char *refkey = linphone_proxy_config_get_ref_key(proxyCfg);
+ BOOL pushNotifEnabled = (refkey && strcmp(refkey, "push_notification") == 0);
+ if ([LinphoneManager.instance lpConfigBoolForKey:@"backgroundmode_preference"] || pushNotifEnabled) {
// For registration register
[self refreshRegisters];
}
@@ -1739,7 +1736,9 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
LOGI(@"Entering [%s] bg mode", shouldEnterBgMode ? "normal" : "lite");
if (!shouldEnterBgMode) {
- if ([LinphoneManager.instance lpConfigBoolForKey:@"pushnotification_preference"]) {
+ const char *refkey = linphone_proxy_config_get_ref_key(proxyCfg);
+ BOOL pushNotifEnabled = (refkey && strcmp(refkey, "push_notification") == 0);
+ if (pushNotifEnabled) {
LOGI(@"Keeping lc core to handle push");
/*destroy voip socket if any and reset connectivity mode*/
connectivity = none;
@@ -2052,17 +2051,21 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
}
_pushNotificationToken = apushNotificationToken;
- LinphoneProxyConfig *cfg = linphone_core_get_default_proxy_config(theLinphoneCore);
- if (cfg) {
- linphone_proxy_config_edit(cfg);
- [self configurePushTokenForProxyConfig:cfg];
- linphone_proxy_config_done(cfg);
+ const MSList *proxies = linphone_core_get_proxy_config_list(LC);
+ while (proxies) {
+ linphone_proxy_config_set_ref_key(proxies->data, "push_notification");
+ [self configurePushTokenForProxyConfig:proxies->data];
+ proxies = proxies->next;
}
}
- (void)configurePushTokenForProxyConfig:(LinphoneProxyConfig *)proxyCfg {
+ linphone_proxy_config_edit(proxyCfg);
+
NSData *tokenData = _pushNotificationToken;
- if (tokenData != nil && [self lpConfigBoolForKey:@"pushnotification_preference"]) {
+ const char *refkey = linphone_proxy_config_get_ref_key(proxyCfg);
+ BOOL pushNotifEnabled = (refkey && strcmp(refkey, "push_notification") == 0);
+ if (tokenData != nil && pushNotifEnabled) {
const unsigned char *tokenBuffer = [tokenData bytes];
NSMutableString *tokenString = [NSMutableString stringWithCapacity:[tokenData length] * 2];
for (int i = 0; i < [tokenData length]; ++i) {
@@ -2092,6 +2095,8 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) {
linphone_proxy_config_set_contact_uri_parameters(proxyCfg, NULL);
linphone_proxy_config_set_contact_parameters(proxyCfg, NULL);
}
+
+ linphone_proxy_config_done(proxyCfg);
}
#pragma mark - Misc Functions
diff --git a/Resources/assistant_external_sip.rc b/Resources/assistant_external_sip.rc
index f7bd40da1..02c4b9408 100644
--- a/Resources/assistant_external_sip.rc
+++ b/Resources/assistant_external_sip.rc
@@ -9,6 +9,7 @@
1
+
diff --git a/Resources/assistant_linphone_create.rc b/Resources/assistant_linphone_create.rc
index 36e5773ca..0488ae3cf 100644
--- a/Resources/assistant_linphone_create.rc
+++ b/Resources/assistant_linphone_create.rc
@@ -11,6 +11,7 @@
1314000
sip:?@sip.linphone.org
1
+ push_notification
diff --git a/Resources/assistant_linphone_existing.rc b/Resources/assistant_linphone_existing.rc
index 724d3328f..d19f12ea8 100644
--- a/Resources/assistant_linphone_existing.rc
+++ b/Resources/assistant_linphone_existing.rc
@@ -11,6 +11,7 @@
1314000
sip:?@sip.linphone.org
1
+ push_notification
diff --git a/Resources/assistant_remote.rc b/Resources/assistant_remote.rc
index 045029f56..08def0c30 100644
--- a/Resources/assistant_remote.rc
+++ b/Resources/assistant_remote.rc
@@ -9,6 +9,7 @@
1
+
diff --git a/Resources/linphonerc b/Resources/linphonerc
index 2e92dc016..1a85b7e75 100644
--- a/Resources/linphonerc
+++ b/Resources/linphonerc
@@ -1,73 +1,69 @@
-[net]
-mtu=1300
-activate_edge_workarounds=0
-edge_ping_time=10
-edge_bw=10
-
-[sip]
-contact="Linphone iPhone"
-keepalive_period=30000
-sip_port=-1
-sip_tcp_port=-1
-use_ipv6=0
-inc_timeout=45
-use_info=0
-guess_hostname=1
-register_only_when_network_is_up=1
-auto_net_state_mon=0
-keepalive_period=30000
-ping_with_options=0
-rtcp_xr_enabled=1
-rtcp_xr_rcvr_rtt_mode=all
-rtcp_xr_rcvr_rtt_max_size=10000
-rtcp_xr_stat_summary_enabled=1
-rtcp_xr_voip_metrics_enabled=1
-
-[rtp]
-audio_rtp_port=7200-7299
-video_rtp_port=9200-9299
-audio_jitt_comp=60
-video_jitt_comp=60
-nortp_timeout=30
-
-[video]
-display=1
-capture=1
-show_local=0
-enabled=1
-size=qvga
-automatically_initiate=0
-automatically_accept=0
-
-[net]
-download_bw=380
-upload_bw=380
-firewall_policy=ice
-stun_server=stun.linphone.org
-
-[sound]
-playback_dev_id=AU: Audio Unit Receiver
-capture_dev_id=AU: Audio Unit Receiver
-eq_active=0
-
[app]
-preview_preference=0
animations_preference=1
-edge_opt_preference=0
-start_at_boot_preference=1
-backgroundmode_preference=1
autoanswer_notif_preference=1
-voiceproc_preference=1
+backgroundmode_preference=1
+edge_opt_preference=0
enable_log_collect=0
file_transfer_migration_done=1
-pushnotification_preference=1
ice_preference=1
-stun_preference=stun.linphone.org
+preview_preference=0
random_port_preference=1
+start_at_boot_preference=1
+stun_preference=stun.linphone.org
+voiceproc_preference=1
[default_values]
reg_expires=1314000
[misc]
-max_calls=3
file_transfer_server_url=https://www.linphone.org:444/lft.php
+max_calls=3
+
+[net]
+download_bw=380
+edge_bw=10
+edge_ping_time=10
+firewall_policy=ice
+mtu=1300
+stun_server=stun.linphone.org
+upload_bw=380
+
+[rtp]
+audio_jitt_comp=60
+audio_rtp_port=7200-7299
+nortp_timeout=30
+video_jitt_comp=60
+video_rtp_port=9200-9299
+
+[sip]
+auto_net_state_mon=0
+contact="Linphone iPhone"
+guess_hostname=1
+inc_timeout=45
+keepalive_period=30000
+ping_with_options=0
+register_only_when_network_is_up=1
+rtcp_xr_enabled=1
+rtcp_xr_rcvr_rtt_max_size=10000
+rtcp_xr_rcvr_rtt_mode=all
+rtcp_xr_stat_summary_enabled=1
+rtcp_xr_voip_metrics_enabled=1
+sip_port=-1
+sip_tcp_port=-1
+use_info=0
+use_ipv6=0
+
+[sound]
+capture_dev_id=AU: Audio Unit Receiver
+eq_active=0
+playback_dev_id=AU: Audio Unit Receiver
+
+[video]
+automatically_accept=0
+automatically_initiate=0
+capture=1
+display=1
+enabled=1
+show_local=0
+size=qvga
+
diff --git a/Resources/linphonerc-factory b/Resources/linphonerc-factory
index 0c280c138..14fe40698 100644
--- a/Resources/linphonerc-factory
+++ b/Resources/linphonerc-factory
@@ -1,32 +1,37 @@
+[app]
+#contact_display_username_only=1
+#contact_filter_on_default_domain=1
+#debug_popup_magic=**00**
+debug_popup_email=linphone-iphone@belledonne-communications.com
+send_logs_include_linphonerc_and_chathistory=0
+#use_phone_number=0
+
+[assistant]
+password_length=-1
+username_length=-1
+
+[misc]
+add_missing_audio_codecs=0
+add_missing_video_codecs=0
+#by default it is set to 30 by liblinphone
+history_max_size=-1
+
[sip]
sip_random_port=0
store_ha1_passwd=0
[sound]
-ringer_dev_id=AQ: Audio Queue Device
-echocancellation=0
dtmf_player_amp=0.007
-eq_location=mic
+echocancellation=0
eq_gains=50:2:50 100:2:50
+eq_location=mic
+ringer_dev_id=AQ: Audio Queue Device
[video]
display_filter_auto_rotate=0
-[app]
-#contact_display_username_only=1
-#contact_filter_on_default_domain=1
-#use_phone_number=0
-send_logs_include_linphonerc_and_chathistory=0
-#debug_popup_magic=**00**
-debug_popup_email=linphone-iphone@belledonne-communications.com
+[proxy_0]
+lol=toto
-[assistant]
-username_length=-1
-password_length=-1
-
-[in_app_purchase]
-enabled=0
-
-[misc]
-#by default it is set to 30 by liblinphone
-history_max_size=-1
\ No newline at end of file
+[misc234]
+lol=tata
diff --git a/Resources/linphonerc~ipad b/Resources/linphonerc~ipad
index f3f5ad09d..b0d299d55 100644
--- a/Resources/linphonerc~ipad
+++ b/Resources/linphonerc~ipad
@@ -1,73 +1,68 @@
-[net]
-mtu=1300
-activate_edge_workarounds=0
-edge_ping_time=10
-edge_bw=10
-
-[sip]
-contact="Linphone iPhone"
-keepalive_period=30000
-sip_port=-1
-sip_tcp_port=-1
-use_ipv6=0
-inc_timeout=45
-use_info=0
-guess_hostname=1
-register_only_when_network_is_up=1
-auto_net_state_mon=0
-keepalive_period=30000
-ping_with_options=0
-rtcp_xr_enabled=1
-rtcp_xr_rcvr_rtt_mode=all
-rtcp_xr_rcvr_rtt_max_size=10000
-rtcp_xr_stat_summary_enabled=1
-rtcp_xr_voip_metrics_enabled=1
-
-[rtp]
-audio_rtp_port=7200-7299
-video_rtp_port=9200-9299
-audio_jitt_comp=60
-video_jitt_comp=60
-nortp_timeout=30
-
-[video]
-display=1
-capture=1
-show_local=1
-enabled=1
-size=vga
-automatically_initiate=0
-automatically_accept=0
-
-[net]
-download_bw=512
-upload_bw=512
-firewall_policy=ice
-stun_server=stun.linphone.org
-
-[sound]
-playback_dev_id=AU: Audio Unit Receiver
-capture_dev_id=AU: Audio Unit Receiver
-eq_active=0
-
[app]
-preview_preference=1
animations_preference=1
-edge_opt_preference=0
-start_at_boot_preference=1
-backgroundmode_preference=1
autoanswer_notif_preference=1
-voiceproc_preference=1
+backgroundmode_preference=1
+edge_opt_preference=0
enable_log_collect=0
file_transfer_migration_done=1
-pushnotification_preference=1
ice_preference=1
-stun_preference=stun.linphone.org
+preview_preference=1
random_port_preference=1
+start_at_boot_preference=1
+stun_preference=stun.linphone.org
+voiceproc_preference=1
[default_values]
reg_expires=1314000
[misc]
-max_calls=3
file_transfer_server_url=https://www.linphone.org:444/lft.php
+max_calls=3
+
+[net]
+download_bw=512
+edge_bw=10
+edge_ping_time=10
+firewall_policy=ice
+mtu=1300
+stun_server=stun.linphone.org
+upload_bw=512
+
+[rtp]
+audio_jitt_comp=60
+audio_rtp_port=7200-7299
+nortp_timeout=30
+video_jitt_comp=60
+video_rtp_port=9200-9299
+
+[sip]
+auto_net_state_mon=0
+contact="Linphone iPhone"
+guess_hostname=1
+inc_timeout=45
+keepalive_period=30000
+ping_with_options=0
+register_only_when_network_is_up=1
+rtcp_xr_enabled=1
+rtcp_xr_rcvr_rtt_max_size=10000
+rtcp_xr_rcvr_rtt_mode=all
+rtcp_xr_stat_summary_enabled=1
+rtcp_xr_voip_metrics_enabled=1
+sip_port=-1
+sip_tcp_port=-1
+use_info=0
+use_ipv6=0
+
+[sound]
+capture_dev_id=AU: Audio Unit Receiver
+eq_active=0
+playback_dev_id=AU: Audio Unit Receiver
+
+[video]
+automatically_accept=0
+automatically_initiate=0
+capture=1
+display=1
+enabled=1
+show_local=1
+size=vga
diff --git a/Settings/InAppSettings.bundle/Account.plist b/Settings/InAppSettings.bundle/Account.plist
index 4dd0e4f48..7071868ad 100644
--- a/Settings/InAppSettings.bundle/Account.plist
+++ b/Settings/InAppSettings.bundle/Account.plist
@@ -24,6 +24,16 @@
DefaultValue
+
+ Title
+ Push Notification
+ Key
+ account_pushnotification_preference
+ Type
+ PSToggleSwitchSpecifier
+ DefaultValue
+
+
AutocapitalizationType
None
diff --git a/Settings/InAppSettings.bundle/Network.plist b/Settings/InAppSettings.bundle/Network.plist
index ecf448492..10c5fe294 100644
--- a/Settings/InAppSettings.bundle/Network.plist
+++ b/Settings/InAppSettings.bundle/Network.plist
@@ -136,16 +136,6 @@
DTLS
-
- Title
- Push Notification
- Key
- pushnotification_preference
- Type
- PSToggleSwitchSpecifier
- DefaultValue
-
-
Key
network_limit_group
diff --git a/submodules/linphone b/submodules/linphone
index 0b69dbaa2..b105e0b38 160000
--- a/submodules/linphone
+++ b/submodules/linphone
@@ -1 +1 @@
-Subproject commit 0b69dbaa216cf5e6b6160da4f990345cf34f37f3
+Subproject commit b105e0b38b340ca4cd29f0c72263950add70aca6