Index: /pjproject/trunk/pjmedia/src/pjmedia-audiodev/coreaudio_dev.c
===================================================================
--- /pjproject/trunk/pjmedia/src/pjmedia-audiodev/coreaudio_dev.c	(revision 4589)
+++ /pjproject/trunk/pjmedia/src/pjmedia-audiodev/coreaudio_dev.c	(revision 4590)
@@ -51,4 +51,10 @@
     #define USE_AUDIO_ROUTE_CHANGE_PROP_LISTENER 0
 
+    /* Starting iOS SDK 7, Audio Session API is deprecated. */
+    #ifdef __IPHONE_7_0
+        #define USE_AUDIO_SESSION_API 0
+    #else
+        #define USE_AUDIO_SESSION_API 1
+    #endif
 #endif
 
@@ -177,5 +183,5 @@
 				     struct coreaudio_stream *strm,
 				     AudioUnit *io_unit);
-#if !COREAUDIO_MAC
+#if !COREAUDIO_MAC && USE_AUDIO_SESSION_API != 0
 static void interruptionListener(void *inClientData, UInt32 inInterruption);
 static void propListener(void *                 inClientData,
@@ -237,5 +243,4 @@
 #if !COREAUDIO_MAC
     unsigned i;
-    OSStatus ostatus;
 #endif
 
@@ -284,4 +289,5 @@
 
 	/* Set the device capabilities here */
+#if USE_AUDIO_SESSION_API != 0
  	cdi->info.caps = PJMEDIA_AUD_DEV_CAP_INPUT_LATENCY |
 			 PJMEDIA_AUD_DEV_CAP_OUTPUT_LATENCY |
@@ -293,4 +299,7 @@
 			   PJMEDIA_AUD_DEV_ROUTE_EARPIECE |
 			   PJMEDIA_AUD_DEV_ROUTE_BLUETOOTH;
+#else
+        cdi->info.caps = PJMEDIA_AUD_DEV_CAP_EC;
+#endif
 
 	PJ_LOG(4, (THIS_FILE, " dev_id %d: %s  (in=%d, out=%d) %dHz",
@@ -302,21 +311,28 @@
     }
 
-    /* Initialize the Audio Session */
-    ostatus = AudioSessionInitialize(NULL, NULL, interruptionListener, NULL);
-    if (ostatus != kAudioSessionNoError) {
-	PJ_LOG(4, (THIS_FILE,
-		   "Warning: cannot initialize audio session services (%i)",
-		   ostatus));
-    }
-
-    /* Listen for audio routing change notifications. */
+#if USE_AUDIO_SESSION_API != 0
+    {
+        OSStatus ostatus;
+
+        /* Initialize the Audio Session */
+        ostatus = AudioSessionInitialize(NULL, NULL, interruptionListener,
+                                         NULL);
+        if (ostatus != kAudioSessionNoError) {
+            PJ_LOG(4, (THIS_FILE,
+                       "Warning: cannot initialize audio session services (%i)",
+                       ostatus));
+        }
+
+        /* Listen for audio routing change notifications. */
 #if USE_AUDIO_ROUTE_CHANGE_PROP_LISTENER != 0
-    ostatus = AudioSessionAddPropertyListener(
-	          kAudioSessionProperty_AudioRouteChange,
-		  propListener, cf);
-    if (ostatus != kAudioSessionNoError) {
-	PJ_LOG(4, (THIS_FILE,
-		   "Warning: cannot listen for audio route change "
-		   "notifications (%i)", ostatus));
+        ostatus = AudioSessionAddPropertyListener(
+                      kAudioSessionProperty_AudioRouteChange,
+		      propListener, cf);
+        if (ostatus != kAudioSessionNoError) {
+            PJ_LOG(4, (THIS_FILE,
+                       "Warning: cannot listen for audio route change "
+                       "notifications (%i)", ostatus));
+        }
+#endif
     }
 #endif
@@ -341,5 +357,5 @@
 
 #if !COREAUDIO_MAC
-#if USE_AUDIO_ROUTE_CHANGE_PROP_LISTENER != 0
+#if USE_AUDIO_SESSION_API != 0 && USE_AUDIO_ROUTE_CHANGE_PROP_LISTENER != 0
     AudioSessionRemovePropertyListenerWithUserData(
         kAudioSessionProperty_AudioRouteChange, propListener, cf);
@@ -1059,5 +1075,5 @@
 }
 
-#if !COREAUDIO_MAC
+#if !COREAUDIO_MAC && USE_AUDIO_SESSION_API != 0
 static void propListener(void 			*inClientData,
 			 AudioSessionPropertyID	inID,
@@ -1224,5 +1240,5 @@
 {
     OSStatus ostatus;
-#if !COREAUDIO_MAC
+#if !COREAUDIO_MAC && USE_AUDIO_SESSION_API != 0
     UInt32 audioCategory = kAudioSessionCategory_PlayAndRecord;
     /* We want to be able to open playback and recording streams */
@@ -1700,5 +1716,5 @@
 	    }
 	}
-#else
+#elif USE_AUDIO_SESSION_API != 0
 	Float32 latency, latency2;
 	UInt32 size = sizeof(Float32);
@@ -1748,5 +1764,5 @@
 	    }
 	}
-#else
+#elif USE_AUDIO_SESSION_API != 0
 	Float32 latency, latency2;
 	UInt32 size = sizeof(Float32);
@@ -1766,4 +1782,5 @@
 	*(unsigned*)pval = (++strm->param.output_latency_ms * 2);
 	return PJ_SUCCESS;
+#if COREAUDIO_MAC || USE_AUDIO_SESSION_API != 0
     } else if (cap==PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING &&
 	       (strm->param.dir & PJMEDIA_DIR_PLAYBACK))
@@ -1784,5 +1801,5 @@
 	if (ostatus != noErr)
 	    return PJMEDIA_AUDIODEV_ERRNO_FROM_COREAUDIO(ostatus);
-#else
+#elif USE_AUDIO_SESSION_API != 0
 	ostatus = AudioSessionGetProperty(
 		  kAudioSessionProperty_CurrentHardwareOutputVolume,
@@ -1795,5 +1812,8 @@
 	*(unsigned*)pval = (unsigned)(volume * 100);
 	return PJ_SUCCESS;
+#endif
+
 #if !COREAUDIO_MAC
+#if USE_AUDIO_SESSION_API != 0
     } else if (cap==PJMEDIA_AUD_DEV_CAP_INPUT_ROUTE &&
 	       (strm->param.dir & PJMEDIA_DIR_CAPTURE))
@@ -1837,4 +1857,5 @@
 
 	return PJ_SUCCESS;
+#endif
     } else if (cap==PJMEDIA_AUD_DEV_CAP_EC) {
 	AudioComponentDescription desc;
@@ -1888,6 +1909,33 @@
 
 #else
-
-    if ((cap==PJMEDIA_AUD_DEV_CAP_INPUT_LATENCY &&
+    if (cap==PJMEDIA_AUD_DEV_CAP_EC) {
+	AudioComponentDescription desc;
+	AudioComponent io_comp;
+        
+	desc.componentType = kAudioUnitType_Output;
+	desc.componentSubType = (*(pj_bool_t*)pval)?
+        kAudioUnitSubType_VoiceProcessingIO :
+        kAudioUnitSubType_RemoteIO;
+	desc.componentManufacturer = kAudioUnitManufacturer_Apple;
+	desc.componentFlags = 0;
+	desc.componentFlagsMask = 0;
+        
+	io_comp = AudioComponentFindNext(NULL, &desc);
+	if (io_comp == NULL)
+	    return PJMEDIA_AUDIODEV_ERRNO_FROM_COREAUDIO(-1);
+	strm->cf->io_comp = io_comp;
+	strm->param.ec_enabled = *(pj_bool_t*)pval;
+        
+        PJ_LOG(4, (THIS_FILE, "Using %s audio unit",
+                   (desc.componentSubType ==
+                    kAudioUnitSubType_RemoteIO? "RemoteIO":
+                    "VoiceProcessingIO")));
+        
+	return PJ_SUCCESS;
+    }
+
+#if USE_AUDIO_SESSION_API != 0
+
+    else if ((cap==PJMEDIA_AUD_DEV_CAP_INPUT_LATENCY &&
 	 (strm->param.dir & PJMEDIA_DIR_CAPTURE)) ||
 	(cap==PJMEDIA_AUD_DEV_CAP_OUTPUT_LATENCY &&
@@ -1949,29 +1997,6 @@
 	strm->param.output_route = *(pjmedia_aud_dev_route*)pval;
 	return PJ_SUCCESS;
-    } else if (cap==PJMEDIA_AUD_DEV_CAP_EC) {
-	AudioComponentDescription desc;
-	AudioComponent io_comp;
-
-	desc.componentType = kAudioUnitType_Output;
-	desc.componentSubType = (*(pj_bool_t*)pval)?
-				kAudioUnitSubType_VoiceProcessingIO :
-				kAudioUnitSubType_RemoteIO;
-	desc.componentManufacturer = kAudioUnitManufacturer_Apple;
-	desc.componentFlags = 0;
-	desc.componentFlagsMask = 0;
-
-	io_comp = AudioComponentFindNext(NULL, &desc);
-	if (io_comp == NULL)
-	    return PJMEDIA_AUDIODEV_ERRNO_FROM_COREAUDIO(-1);
-	strm->cf->io_comp = io_comp;
-	strm->param.ec_enabled = *(pj_bool_t*)pval;
-
-        PJ_LOG(4, (THIS_FILE, "Using %s audio unit", 
-                              (desc.componentSubType ==
-                               kAudioUnitSubType_RemoteIO? "RemoteIO":
-                               "VoiceProcessingIO")));
-        
-	return PJ_SUCCESS;
-    }
+    }
+#endif
 #endif
 
@@ -2001,5 +2026,5 @@
     }
 
-#if !COREAUDIO_MAC
+#if !COREAUDIO_MAC && USE_AUDIO_SESSION_API != 0
     AudioSessionSetActive(true);
 #endif
@@ -2059,5 +2084,5 @@
     pj_mutex_unlock(stream->cf->mutex);
 
-#if !COREAUDIO_MAC
+#if !COREAUDIO_MAC && USE_AUDIO_SESSION_API != 0
     if (should_deactivate)
 	AudioSessionSetActive(false);
Index: /pjproject/trunk/pjsip-apps/src/pjsua/ios/ipjsua.xcodeproj/project.pbxproj
===================================================================
--- /pjproject/trunk/pjsip-apps/src/pjsua/ios/ipjsua.xcodeproj/project.pbxproj	(revision 4589)
+++ /pjproject/trunk/pjsip-apps/src/pjsua/ios/ipjsua.xcodeproj/project.pbxproj	(revision 4590)
@@ -421,4 +421,5 @@
 				ONLY_ACTIVE_ARCH = YES;
 				PRODUCT_NAME = "$(TARGET_NAME)";
+				VALID_ARCHS = armv7;
 				WRAPPER_EXTENSION = app;
 			};
@@ -455,4 +456,5 @@
 				ONLY_ACTIVE_ARCH = YES;
 				PRODUCT_NAME = "$(TARGET_NAME)";
+				VALID_ARCHS = armv7;
 				WRAPPER_EXTENSION = app;
 			};
Index: /pjproject/trunk/pjsip-apps/src/pjsua/ios/ipjsua/ipjsuaAppDelegate.m
===================================================================
--- /pjproject/trunk/pjsip-apps/src/pjsua/ios/ipjsua/ipjsuaAppDelegate.m	(revision 4589)
+++ /pjproject/trunk/pjsip-apps/src/pjsua/ios/ipjsua/ipjsuaAppDelegate.m	(revision 4590)
@@ -152,5 +152,5 @@
 
 - (void)keepAlive {
-    int i, timeout = KEEP_ALIVE_INTERVAL;
+    int i;
     
     if (!pj_thread_is_registered())
@@ -159,17 +159,11 @@
     }
     
+    /* Since iOS requires that the minimum keep alive interval is 600s,
+     * application needs to make sure that the account's registration
+     * timeout is long enough.
+     */
     for (i = 0; i < (int)pjsua_acc_get_count(); ++i) {
         if (pjsua_acc_is_valid(i)) {
-            pjsua_acc_config acc_cfg;
-
-	    pjsua_acc_get_config(i, &acc_cfg);
-            if (!acc_cfg.reg_uri.slen)
-                continue;
-            if (acc_cfg.reg_timeout < timeout) {
-                acc_cfg.reg_timeout = timeout;
-                pjsua_acc_modify(i, &acc_cfg);
-            } else {
-                pjsua_acc_set_registration(i, PJ_TRUE);
-            }
+            pjsua_acc_set_registration(i, PJ_TRUE);
         }
     }
