Index: pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app_cli.c
===================================================================
--- pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app_cli.c	(revision 4728)
+++ pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app_cli.c	(revision 4729)
@@ -1,4 +1,4 @@
 /* $Id$ */
-/* 
+/*
  * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
  * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
@@ -16,5 +16,5 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
@@ -156,5 +156,5 @@
 void cli_destroy();
 
-PJ_DEF(void) cli_get_info(char *info, pj_size_t size) 
+PJ_DEF(void) cli_get_info(char *info, pj_size_t size)
 {
     pj_cli_telnet_info telnet_info;
@@ -162,6 +162,6 @@
 
     pj_ansi_snprintf(info, size, "Telnet to %.*s:%d",
-		     (int)telnet_info.ip_address.slen, 
-		     telnet_info.ip_address.ptr, 
+		     (int)telnet_info.ip_address.slen,
+		     telnet_info.ip_address.ptr,
 		     telnet_info.port);
 }
@@ -221,5 +221,5 @@
     if (app_config.cli_cfg.cli_fe & CLI_FE_CONSOLE) {
 	pj_cli_console_cfg *fe_cfg = &app_config.cli_cfg.console_cfg;
-	
+
 	fe_cfg->quit_command = pj_str("shutdown");
 	status = pj_cli_console_create(cli, fe_cfg,
@@ -262,5 +262,5 @@
 {
     /* Destroy CLI, it will automatically destroy any FEs */
-    if (cli) {		
+    if (cli) {
 	pj_cli_destroy(cli);
 	cli = NULL;
@@ -281,5 +281,5 @@
 
 /* Get input URL */
-static void get_input_url(char *buf, 
+static void get_input_url(char *buf,
 			  pj_size_t len,
 			  pj_cli_cmd_val *cval,
@@ -316,5 +316,5 @@
 	for (; i<len; ++i) {
 	    if (!pj_isdigit(buf[i])) {
-		pj_cli_sess_write_msg(cval->sess, err_invalid_input.ptr, 
+		pj_cli_sess_write_msg(cval->sess, err_invalid_input.ptr,
 				      (int)err_invalid_input.slen);
 		return;
@@ -324,6 +324,6 @@
 	result->nb_result = my_atoi(buf);
 
-	if (result->nb_result >= 0 && 
-	    result->nb_result <= (int)pjsua_get_buddy_count()) 
+	if (result->nb_result >= 0 &&
+	    result->nb_result <= (int)pjsua_get_buddy_count())
 	{
 	    return;
@@ -332,5 +332,5 @@
 	    return;
 
-	pj_cli_sess_write_msg(cval->sess, err_invalid_input.ptr, 
+	pj_cli_sess_write_msg(cval->sess, err_invalid_input.ptr,
 			      (int)err_invalid_input.slen);
 	result->nb_result = PJSUA_APP_NO_NB;
@@ -353,5 +353,5 @@
 static void get_buddy_id(pj_cli_dyn_choice_param *param)
 {
-    if (param->cnt < param->max_cnt) {	
+    if (param->cnt < param->max_cnt) {
 	pjsua_buddy_id ids[64];
 	int i = 0;
@@ -360,5 +360,5 @@
 
 	pjsua_enum_buddies(ids, &count);
-	
+
 	if (count > 0) {
 	    for (i=0; i<(int)count; ++i) {
@@ -372,17 +372,17 @@
 		pj_strdup2(param->pool, &param->choice[i].value, data_out);
 		pj_bzero(data_out, PJ_ARRAY_SIZE(data_out));
-    	    
+
 		/* Format & fill description */
-		pj_ansi_snprintf(data_out, 
+		pj_ansi_snprintf(data_out,
 				sizeof(data_out),
-				"<%.*s>  %.*s", 		    
+				"<%.*s>  %.*s",
 				(int)info.status_text.slen,
-				info.status_text.ptr, 
+				info.status_text.ptr,
 				(int)info.uri.slen,
 				info.uri.ptr);
 
-		pj_strdup2(param->pool, &param->choice[i].desc, data_out);		
+		pj_strdup2(param->pool, &param->choice[i].desc, data_out);
 		if (++param->cnt >= (param->max_cnt-1))
-		    break;	
+		    break;
 	    }
 	}
@@ -400,5 +400,5 @@
 static void get_account_id(pj_cli_dyn_choice_param *param)
 {
-    if (param->cnt < param->max_cnt) {	
+    if (param->cnt < param->max_cnt) {
 	char buf[8];
 	char buf_out[80];
@@ -407,18 +407,18 @@
 	pjsua_acc_id acc_ids[16];
 	unsigned count = PJ_ARRAY_SIZE(acc_ids);
-	int i;    
+	int i;
 
 	pjsua_enum_accs(acc_ids, &count);
-        
-	for (i=0; i<(int)count; ++i) {	
+
+	for (i=0; i<(int)count; ++i) {
 	    pj_bzero(&buf_out[0], PJ_ARRAY_SIZE(buf_out));
 
 	    pjsua_acc_get_info(acc_ids[i], &info);
 
-	    pj_ansi_snprintf(buf_out, 
+	    pj_ansi_snprintf(buf_out,
 			     sizeof(buf_out),
-			     "%c%.*s", 
+			     "%c%.*s",
 			     (acc_ids[i]==current_acc?'*':' '),
-			     (int)info.acc_uri.slen, 
+			     (int)info.acc_uri.slen,
 			     info.acc_uri.ptr);
 
@@ -428,5 +428,5 @@
 	    pj_strdup2(param->pool, &param->choice[i].desc, buf_out);
 	    if (++param->cnt >= param->max_cnt)
-		break;	
+		break;
 	}
     }
@@ -450,5 +450,5 @@
 	pjsua_conf_get_port_info(id[i], &info);
 
-	pj_ansi_snprintf(slot_id, sizeof(slot_id), 
+	pj_ansi_snprintf(slot_id, sizeof(slot_id),
 			 "%d", info.slot_id);
 	pj_strdup2(param->pool, &param->choice[i].value, slot_id);
@@ -459,19 +459,19 @@
 	    pj_ansi_snprintf(s, sizeof(s), "#%d ", info.listeners[j]);
 	    pj_ansi_strcat(txlist, s);
-	}	
-
-	pj_ansi_snprintf(desc,  
+	}
+
+	pj_ansi_snprintf(desc,
 	       sizeof(desc),
-	       "[%2dKHz/%dms/%d] %20.*s  transmitting to: %s", 	       
+	       "[%2dKHz/%dms/%d] %20.*s  transmitting to: %s",
 	       info.clock_rate/1000,
 	       info.samples_per_frame*1000/info.channel_count/info.clock_rate,
 	       info.channel_count,
-	       (int)info.name.slen, 
+	       (int)info.name.slen,
 	       info.name.ptr,
 	       txlist);
 
-	pj_strdup2(param->pool, &param->choice[i].desc, desc);	
+	pj_strdup2(param->pool, &param->choice[i].desc, desc);
 	if (++param->cnt >= param->max_cnt)
-	    break;	
+	    break;
     }
 }
@@ -479,21 +479,21 @@
 static void get_audio_codec_id(pj_cli_dyn_choice_param *param)
 {
-    if (param->cnt < param->max_cnt) {	
+    if (param->cnt < param->max_cnt) {
 	pjsua_codec_info c[32];
 	unsigned i, count = PJ_ARRAY_SIZE(c);
 	char codec_id[64];
 	char desc[128];
-        
+
 	pjsua_enum_codecs(c, &count);
-	for (i=0; i<count; ++i) {	
-	    pj_ansi_snprintf(codec_id, sizeof(codec_id), 
-			     "%.*s", (int)c[i].codec_id.slen, 
+	for (i=0; i<count; ++i) {
+	    pj_ansi_snprintf(codec_id, sizeof(codec_id),
+			     "%.*s", (int)c[i].codec_id.slen,
 			     c[i].codec_id.ptr);
 
 	    pj_strdup2(param->pool, &param->choice[param->cnt].value, codec_id);
 
-	    pj_ansi_snprintf(desc, sizeof(desc), 
-			     "Audio, prio: %d%s%.*s", 
-			     c[i].priority, 
+	    pj_ansi_snprintf(desc, sizeof(desc),
+			     "Audio, prio: %d%s%.*s",
+			     c[i].priority,
 			     c[i].desc.slen? " - ":"",
 			     (int)c[i].desc.slen,
@@ -502,13 +502,13 @@
 	    pj_strdup2(param->pool, &param->choice[param->cnt].desc, desc);
 	    if (++param->cnt >= param->max_cnt)
-		break;	
-	}
-    }
-}
-
-#if PJSUA_HAS_VIDEO  
+		break;
+	}
+    }
+}
+
+#if PJSUA_HAS_VIDEO
 static void get_video_stream_id(pj_cli_dyn_choice_param *param)
 {
-    if (param->cnt < param->max_cnt) {	
+    if (param->cnt < param->max_cnt) {
 	pjsua_call_info call_info;
 
@@ -519,32 +519,32 @@
 		if (call_info.media[i].type == PJMEDIA_TYPE_VIDEO) {
 		    char med_idx[8];
-		    pj_ansi_snprintf(med_idx, sizeof(med_idx), "%d", 
+		    pj_ansi_snprintf(med_idx, sizeof(med_idx), "%d",
 				     call_info.media[i].index);
 		    pj_strdup2(param->pool, &param->choice[i].value, med_idx);
 
-		    switch (call_info.media[i].status) {		    
+		    switch (call_info.media[i].status) {
 		    case PJSUA_CALL_MEDIA_NONE:
-			pj_strdup2(param->pool, &param->choice[i].desc, 
+			pj_strdup2(param->pool, &param->choice[i].desc,
 				   "Status:None");
 			break;
 		    case PJSUA_CALL_MEDIA_ACTIVE:
-			pj_strdup2(param->pool, &param->choice[i].desc, 
+			pj_strdup2(param->pool, &param->choice[i].desc,
 				   "Status:Active");
 			break;
 		    case PJSUA_CALL_MEDIA_LOCAL_HOLD:
-			pj_strdup2(param->pool, &param->choice[i].desc, 
+			pj_strdup2(param->pool, &param->choice[i].desc,
 				   "Status:Local Hold");
 			break;
 		    case PJSUA_CALL_MEDIA_REMOTE_HOLD:
-			pj_strdup2(param->pool, &param->choice[i].desc, 
+			pj_strdup2(param->pool, &param->choice[i].desc,
 				   "Status:Remote Hold");
 			break;
 		    case PJSUA_CALL_MEDIA_ERROR:
-			pj_strdup2(param->pool, &param->choice[i].desc, 
+			pj_strdup2(param->pool, &param->choice[i].desc,
 				   "Status:Media Error");
 			break;
 		    }
 		    if (++param->cnt >= param->max_cnt)
-			break;	
+			break;
 		}
 	    }
@@ -552,8 +552,8 @@
     }
 }
-  
-static void get_video_dev_hint(pj_cli_dyn_choice_param *param, 
+
+static void get_video_dev_hint(pj_cli_dyn_choice_param *param,
 			       pjmedia_vid_dev_info *vdi,
-			       unsigned vid_dev_id) 
+			       unsigned vid_dev_id)
 {
     char desc[128];
@@ -561,18 +561,18 @@
     pj_ansi_snprintf(dev_id, sizeof(dev_id),
 	"%d", vid_dev_id);
-    pj_ansi_snprintf(desc, sizeof(desc), "%s [%s]", 
+    pj_ansi_snprintf(desc, sizeof(desc), "%s [%s]",
 	vdi->name, vdi->driver);
 
-    pj_strdup2(param->pool, &param->choice[param->cnt].value, 
+    pj_strdup2(param->pool, &param->choice[param->cnt].value,
 	       dev_id);
-    pj_strdup2(param->pool, &param->choice[param->cnt].desc, 
-	       desc);    
-}
-
-static void get_video_dev_id(pj_cli_dyn_choice_param *param, 
+    pj_strdup2(param->pool, &param->choice[param->cnt].desc,
+	       desc);
+}
+
+static void get_video_dev_id(pj_cli_dyn_choice_param *param,
 			     pj_bool_t all,
 			     pj_bool_t capture)
 {
-    if (param->cnt < param->max_cnt) {	
+    if (param->cnt < param->max_cnt) {
 	unsigned i, count;
 	pjmedia_vid_dev_info vdi;
@@ -580,7 +580,7 @@
 
 	count = pjsua_vid_dev_count();
-	if (count == 0) {	
+	if (count == 0) {
 	    return;
-	} 
+	}
 
 	for (i=0; i<count; ++i) {
@@ -590,9 +590,9 @@
 		    ((capture) && (vdi.dir == PJMEDIA_DIR_CAPTURE)) ||
 		    ((!capture) && (vdi.dir == PJMEDIA_DIR_RENDER)))
-		{		
+		{
 		    get_video_dev_hint(param, &vdi, i);
 		    if (++param->cnt >= param->max_cnt)
-			break;	
-		} 
+			break;
+		}
 	    }
 	}
@@ -601,6 +601,6 @@
 
 static void get_video_codec_id(pj_cli_dyn_choice_param *param)
-{    
-    if (param->cnt < param->max_cnt) {	
+{
+    if (param->cnt < param->max_cnt) {
 	pjsua_codec_info ci[32];
 	unsigned i, count = PJ_ARRAY_SIZE(ci);
@@ -620,20 +620,20 @@
 	    vfd = pjmedia_format_get_video_format_detail(&cp.enc_fmt, PJ_TRUE);
 
-	    pj_ansi_snprintf(codec_id, sizeof(codec_id), 
-			     "%.*s", (int)ci[i].codec_id.slen, 
+	    pj_ansi_snprintf(codec_id, sizeof(codec_id),
+			     "%.*s", (int)ci[i].codec_id.slen,
 			     ci[i].codec_id.ptr);
 
 	    pj_strdup2(param->pool, &param->choice[param->cnt].value, codec_id);
 
-	    pj_ansi_snprintf(desc, sizeof(desc), 
-	    		     "Video, p[%d], f[%.2f], b[%d/%d], s[%dx%d]", 
-	    		     ci[i].priority, 
+	    pj_ansi_snprintf(desc, sizeof(desc),
+	    		     "Video, p[%d], f[%.2f], b[%d/%d], s[%dx%d]",
+	    		     ci[i].priority,
 			     (vfd->fps.num*1.0/vfd->fps.denum),
 			     vfd->avg_bps/1000, vfd->max_bps/1000,
 			     vfd->size.w, vfd->size.h);
 
-	    pj_strdup2(param->pool, &param->choice[param->cnt].desc, desc);	
+	    pj_strdup2(param->pool, &param->choice[param->cnt].desc, desc);
 	    if (++param->cnt >= param->max_cnt)
-		break;	
+		break;
 	}
     }
@@ -642,5 +642,5 @@
 static void get_video_window_id(pj_cli_dyn_choice_param *param)
 {
-    if (param->cnt < param->max_cnt) {	
+    if (param->cnt < param->max_cnt) {
 	pjsua_vid_win_id wids[PJSUA_MAX_VID_WINS];
 	unsigned i, cnt = PJ_ARRAY_SIZE(wids);
@@ -657,12 +657,12 @@
 	    pj_strdup2(param->pool, &param->choice[i].value, win_id);
 
-	    pj_ansi_snprintf(desc, sizeof(desc), 
-			     "Show:%c Pos(%d,%d)  Size(%dx%d)", 
+	    pj_ansi_snprintf(desc, sizeof(desc),
+			     "Show:%c Pos(%d,%d)  Size(%dx%d)",
 			     (wi.show?'Y':'N'), wi.pos.x, wi.pos.y,
 			     wi.size.w, wi.size.h);
 
-	    pj_strdup2(param->pool, &param->choice[i].desc, desc);	
+	    pj_strdup2(param->pool, &param->choice[i].desc, desc);
 	    if (++param->cnt >= param->max_cnt)
-		break;	
+		break;
 	}
     }
@@ -671,5 +671,5 @@
 static void get_call_id(pj_cli_dyn_choice_param *param)
 {
-    if (param->cnt < param->max_cnt) {	
+    if (param->cnt < param->max_cnt) {
 	char call_id[64];
 	char desc[128];
@@ -691,5 +691,5 @@
 		pj_ansi_snprintf(call_id, sizeof(call_id), "%d", ids[i]);
 		pj_strdup2(param->pool, &param->choice[i].value, call_id);
-		pj_ansi_snprintf(desc, sizeof(desc), "%.*s [%.*s]", 
+		pj_ansi_snprintf(desc, sizeof(desc), "%.*s [%.*s]",
 		    (int)call_info.remote_info.slen,
 		    call_info.remote_info.ptr,
@@ -698,5 +698,5 @@
 		pj_strdup2(param->pool, &param->choice[i].desc, desc);
 		if (++param->cnt >= param->max_cnt)
-		    break;	
+		    break;
 
 	    }
@@ -723,9 +723,9 @@
 	get_audio_codec_id(param);
 	break;
-#if PJSUA_HAS_VIDEO    
-    case DYN_CHOICE_CAP_DEV_ID:	
+#if PJSUA_HAS_VIDEO
+    case DYN_CHOICE_CAP_DEV_ID:
     case DYN_CHOICE_REN_DEV_ID:
     case DYN_CHOICE_VID_DEV_ID:
-	get_video_dev_id(param, 
+	get_video_dev_id(param,
 			 (param->arg_id==DYN_CHOICE_VID_DEV_ID),
 			 (param->arg_id==DYN_CHOICE_CAP_DEV_ID));
@@ -750,5 +750,5 @@
 }
 
-/* 
+/*
  * CLI command handler
  */
@@ -777,5 +777,5 @@
 	pjsua_perror(THIS_FILE, "Error adding new account", status);
     }
-    
+
     return status;
 }
@@ -790,5 +790,5 @@
 
     if (!pjsua_acc_is_valid(i)) {
-	pj_ansi_snprintf(out_str, sizeof(out_str), 
+	pj_ansi_snprintf(out_str, sizeof(out_str),
 		        "Invalid account id %d\n", i);
 	str_len = (unsigned)pj_ansi_strlen(out_str);
@@ -813,5 +813,5 @@
 /* Register account */
 static pj_status_t cmd_reg_account()
-{    
+{
     pjsua_acc_set_registration(current_acc, PJ_TRUE);
     return PJ_SUCCESS;
@@ -820,5 +820,5 @@
 /* Unregister account */
 static pj_status_t cmd_unreg_account()
-{    
+{
     pjsua_acc_set_registration(current_acc, PJ_FALSE);
     return PJ_SUCCESS;
@@ -834,5 +834,5 @@
     } else {
 	PJ_LOG(3,(THIS_FILE, "Invalid account id %d", i));
-    }    
+    }
     return PJ_SUCCESS;
 }
@@ -844,5 +844,5 @@
     unsigned count = PJ_ARRAY_SIZE(acc_ids);
     int i;
-    static const pj_str_t header = {"Account list:\n", 15};    
+    static const pj_str_t header = {"Account list:\n", 15};
 
     pjsua_enum_accs(acc_ids, &count);
@@ -857,5 +857,5 @@
 
 	if (!info.has_registration) {
-	    pj_ansi_snprintf(acc_info, sizeof(acc_info), "%.*s", 
+	    pj_ansi_snprintf(acc_info, sizeof(acc_info), "%.*s",
 			     (int)info.status_text.slen,
 			     info.status_text.ptr);
@@ -871,8 +871,8 @@
 	}
 
-	pj_ansi_snprintf(out_str, sizeof(out_str), 
-			 " %c[%2d] %.*s: %s\n", 
-			 (acc_ids[i]==current_acc?'*':' '), acc_ids[i],  
-			 (int)info.acc_uri.slen, info.acc_uri.ptr, 
+	pj_ansi_snprintf(out_str, sizeof(out_str),
+			 " %c[%2d] %.*s: %s\n",
+			 (acc_ids[i]==current_acc?'*':' '), acc_ids[i],
+			 (int)info.acc_uri.slen, info.acc_uri.ptr,
 			 acc_info);
 	pj_cli_sess_write_msg(cval->sess, out_str, pj_ansi_strlen(out_str));
@@ -880,5 +880,5 @@
 	pj_bzero(out_str, sizeof(out_str));
 	pj_ansi_snprintf(out_str, sizeof(out_str),
-			 "       Online status: %.*s\n", 
+			 "       Online status: %.*s\n",
 			 (int)info.online_status_text.slen,
 			 info.online_status_text.ptr);
@@ -892,5 +892,5 @@
 /* Account command handler */
 pj_status_t cmd_account_handler(pj_cli_cmd_val *cval)
-{    
+{
     pj_status_t status = PJ_SUCCESS;
 
@@ -913,12 +913,12 @@
 	status = cmd_unreg_account();
 	break;
-    case CMD_ACCOUNT_NEXT:	
+    case CMD_ACCOUNT_NEXT:
     case CMD_ACCOUNT_PREV:
-	status = cmd_next_account(cval);	
+	status = cmd_next_account(cval);
 	break;
     case CMD_ACCOUNT_SHOW:
 	status = cmd_show_account(cval);
 	break;
-    }    
+    }
     return status;
 }
@@ -926,5 +926,5 @@
 /* Add buddy */
 static pj_status_t cmd_add_buddy(pj_cli_cmd_val *cval)
-{    
+{
     char out_str[80];
     pjsua_buddy_config buddy_cfg;
@@ -934,5 +934,5 @@
 
     if (pjsua_verify_url(cval->argv[1].ptr) != PJ_SUCCESS) {
-	pj_ansi_snprintf(out_str, sizeof(out_str), 
+	pj_ansi_snprintf(out_str, sizeof(out_str),
 			 "Invalid URI '%s'\n", cval->argv[1].ptr);
     } else {
@@ -944,8 +944,8 @@
 	status = pjsua_buddy_add(&buddy_cfg, &buddy_id);
 	if (status == PJ_SUCCESS) {
-	    pj_ansi_snprintf(out_str, sizeof(out_str), 
+	    pj_ansi_snprintf(out_str, sizeof(out_str),
 			      "New buddy '%s' added at index %d\n",
 			      cval->argv[1].ptr, buddy_id+1);
-	}   
+	}
     }
     pj_cli_sess_write_msg(cval->sess, out_str, pj_ansi_strlen(out_str));
@@ -955,15 +955,15 @@
 /* Delete buddy */
 static pj_status_t cmd_del_buddy(pj_cli_cmd_val *cval)
-{    
+{
     int i = my_atoi(cval->argv[1].ptr) - 1;
     char out_str[80];
 
     if (!pjsua_buddy_is_valid(i)) {
-	pj_ansi_snprintf(out_str, sizeof(out_str), 
-			 "Invalid buddy id %d\n", i);	
+	pj_ansi_snprintf(out_str, sizeof(out_str),
+			 "Invalid buddy id %d\n", i);
     } else {
 	pjsua_buddy_del(i);
-	pj_ansi_snprintf(out_str, sizeof(out_str), 
-			 "Buddy %d deleted\n", i);		
+	pj_ansi_snprintf(out_str, sizeof(out_str),
+			 "Buddy %d deleted\n", i);
     }
     pj_cli_sess_write_msg(cval->sess, out_str, pj_ansi_strlen(out_str));
@@ -973,9 +973,9 @@
 /* Send IM */
 static pj_status_t cmd_send_im(pj_cli_cmd_val *cval)
-{    
-    int i = -1;    
+{
+    int i = -1;
     struct input_result result;
     char dest[64];
-    pj_str_t tmp = pj_str(dest);    
+    pj_str_t tmp = pj_str(dest);
 
     /* make compiler happy. */
@@ -983,12 +983,12 @@
 
     pj_strncpy_with_null(&tmp, &cval->argv[1], sizeof(dest));
-    
+
     /* input destination. */
     get_input_url(tmp.ptr, tmp.slen, cval, &result);
     if (result.nb_result != PJSUA_APP_NO_NB) {
 
-	if (result.nb_result == -1) {	    
+	if (result.nb_result == -1) {
 	    static const pj_str_t err_msg = {"you can't send broadcast im "
-					     "like that!\n", 40 };	    
+					     "like that!\n", 40 };
 	    pj_cli_sess_write_msg(cval->sess, err_msg.ptr, err_msg.slen);
 	    return PJ_SUCCESS;
@@ -997,5 +997,5 @@
 	} else {
 	    pjsua_buddy_info binfo;
-	    pjsua_buddy_get_info(result.nb_result-1, &binfo);	    
+	    pjsua_buddy_get_info(result.nb_result-1, &binfo);
 	    pj_strncpy_with_null(&tmp, &binfo.uri, sizeof(dest));
 	    uri = tmp.ptr;
@@ -1026,11 +1026,11 @@
 /* Subscribe/unsubscribe presence */
 static pj_status_t cmd_subs_pres(pj_cli_cmd_val *cval, pj_bool_t subscribe)
-{   
-    struct input_result result;    
+{
+    struct input_result result;
     char dest[64] = {0};
     pj_str_t tmp = pj_str(dest);
-    
+
     pj_strncpy_with_null(&tmp, &cval->argv[1], sizeof(dest));
-    get_input_url(tmp.ptr, tmp.slen, cval, &result);    
+    get_input_url(tmp.ptr, tmp.slen, cval, &result);
     if (result.nb_result != PJSUA_APP_NO_NB) {
 	if (result.nb_result == -1) {
@@ -1059,5 +1059,5 @@
 /* Toggle online state */
 static pj_status_t cmd_toggle_state(pj_cli_cmd_val *cval)
-{    
+{
     char out_str[128];
     pjsua_acc_info acc_info;
@@ -1066,5 +1066,5 @@
     acc_info.online_status = !acc_info.online_status;
     pjsua_acc_set_online_status(current_acc, acc_info.online_status);
-    pj_ansi_snprintf(out_str, sizeof(out_str), 
+    pj_ansi_snprintf(out_str, sizeof(out_str),
 		     "Setting %s online status to %s\n",
 		     acc_info.acc_uri.ptr,
@@ -1076,5 +1076,5 @@
 /* Set presence text */
 static pj_status_t cmd_set_presence_text(pj_cli_cmd_val *cval)
-{    
+{
     pjrpid_element elem;
     int choice;
@@ -1125,9 +1125,9 @@
 /* Show buddy list */
 static pj_status_t cmd_show_buddy(pj_cli_cmd_val *cval)
-{        
+{
     pjsua_buddy_id ids[64];
     int i;
     unsigned count = PJ_ARRAY_SIZE(ids);
-    static const pj_str_t header = {"Buddy list:\n", 13};    
+    static const pj_str_t header = {"Buddy list:\n", 13};
     char out_str[64];
 
@@ -1140,5 +1140,5 @@
 	pj_cli_sess_write_msg(cval->sess, out_str, pj_ansi_strlen(out_str));
     } else {
-	for (i=0; i<(int)count; ++i) {	    
+	for (i=0; i<(int)count; ++i) {
 	    pjsua_buddy_info info;
 	    pj_bzero(out_str, sizeof(out_str));
@@ -1147,9 +1147,9 @@
 		continue;
 
-	    pj_ansi_snprintf(out_str, sizeof(out_str), 
-		    " [%2d] <%.*s>  %.*s\n", 
-		    ids[i]+1, 
+	    pj_ansi_snprintf(out_str, sizeof(out_str),
+		    " [%2d] <%.*s>  %.*s\n",
+		    ids[i]+1,
 		    (int)info.status_text.slen,
-		    info.status_text.ptr, 
+		    info.status_text.ptr,
 		    (int)info.uri.slen,
 		    info.uri.ptr);
@@ -1157,5 +1157,5 @@
 	    pj_cli_sess_write_msg(cval->sess, out_str, pj_ansi_strlen(out_str));
 	}
-    }        
+    }
     return PJ_SUCCESS;
 }
@@ -1163,5 +1163,5 @@
 /* Presence/buddy command handler */
 pj_status_t cmd_presence_handler(pj_cli_cmd_val *cval)
-{    
+{
     pj_status_t status = PJ_SUCCESS;
 
@@ -1178,8 +1178,8 @@
 	status = cmd_send_im(cval);
 	break;
-    case CMD_PRESENCE_SUB:	
+    case CMD_PRESENCE_SUB:
     case CMD_PRESENCE_UNSUB:
-	status = cmd_subs_pres(cval, 
-		               pj_cli_get_cmd_id(cval->cmd)==CMD_PRESENCE_SUB);	
+	status = cmd_subs_pres(cval,
+		               pj_cli_get_cmd_id(cval->cmd)==CMD_PRESENCE_SUB);
 	break;
     case CMD_PRESENCE_TOG_STATE:
@@ -1192,5 +1192,5 @@
 	status = cmd_show_buddy(cval);
 	break;
-    }    
+    }
 
     return status;
@@ -1204,5 +1204,5 @@
     static const pj_str_t header = {"Conference ports:\n", 19};
 
-    pj_cli_sess_write_msg(cval->sess, header.ptr, header.slen);    
+    pj_cli_sess_write_msg(cval->sess, header.ptr, header.slen);
 
     count = PJ_ARRAY_SIZE(id);
@@ -1223,16 +1223,16 @@
 	    pj_ansi_strcat(txlist, s);
 	}
-	pj_ansi_snprintf(out_str, 
+	pj_ansi_snprintf(out_str,
 	       sizeof(out_str),
-	       "Port #%02d[%2dKHz/%dms/%d] %20.*s  transmitting to: %s\n", 
-	       info.slot_id, 
+	       "Port #%02d[%2dKHz/%dms/%d] %20.*s  transmitting to: %s\n",
+	       info.slot_id,
 	       info.clock_rate/1000,
 	       info.samples_per_frame*1000/info.channel_count/info.clock_rate,
 	       info.channel_count,
-	       (int)info.name.slen, 
+	       (int)info.name.slen,
 	       info.name.ptr,
 	       txlist);
-	pj_cli_sess_write_msg(cval->sess, out_str, pj_ansi_strlen(out_str));    
-    }    
+	pj_cli_sess_write_msg(cval->sess, out_str, pj_ansi_strlen(out_str));
+    }
     return PJ_SUCCESS;
 }
@@ -1242,15 +1242,15 @@
 {
     pj_status_t status;
-    
+
     if (connect)
-	status = pjsua_conf_connect(pj_strtol(&cval->argv[1]), 
+	status = pjsua_conf_connect(pj_strtol(&cval->argv[1]),
 				    pj_strtol(&cval->argv[2]));
     else
-	status = pjsua_conf_disconnect(pj_strtol(&cval->argv[1]), 
+	status = pjsua_conf_disconnect(pj_strtol(&cval->argv[1]),
 				       pj_strtol(&cval->argv[2]));
 
     if (status == PJ_SUCCESS) {
 	static const pj_str_t success_msg = {"Success\n", 9};
-	pj_cli_sess_write_msg(cval->sess, success_msg.ptr, success_msg.slen);	
+	pj_cli_sess_write_msg(cval->sess, success_msg.ptr, success_msg.slen);
     } else {
 	static const pj_str_t err_msg = {"ERROR!!\n", 9};
@@ -1270,5 +1270,5 @@
 
     /* Adjust mic level */
-    orig_level = app_config.mic_level;    
+    orig_level = app_config.mic_level;
     pj_strncpy_with_null(&tmp, &cval->argv[1], sizeof(level_val));
     app_config.mic_level = (float)strtod(level_val, &err);
@@ -1276,5 +1276,5 @@
 
     pj_ansi_snprintf(buf, sizeof(buf),
-		     "Adjust mic level: [%4.1fx] -> [%4.1fx]\n", 
+		     "Adjust mic level: [%4.1fx] -> [%4.1fx]\n",
 		     orig_level, app_config.mic_level);
 
@@ -1282,5 +1282,5 @@
 
     /* Adjust speaker level */
-    orig_level = app_config.speaker_level;        
+    orig_level = app_config.speaker_level;
     pj_strncpy_with_null(&tmp, &cval->argv[2], sizeof(level_val));
     app_config.speaker_level = (float)strtod(level_val, &err);
@@ -1288,5 +1288,5 @@
 
     pj_ansi_snprintf(buf, sizeof(buf),
-		      "Adjust speaker level: [%4.1fx] -> [%4.1fx]\n", 
+		      "Adjust speaker level: [%4.1fx] -> [%4.1fx]\n",
 		      orig_level, app_config.speaker_level);
 
@@ -1298,19 +1298,19 @@
 /* Set codec priority */
 static pj_status_t cmd_set_codec_prio(pj_cli_cmd_val *cval)
-{        
-    int new_prio;    
-    pj_status_t status;    
+{
+    int new_prio;
+    pj_status_t status;
 
     new_prio = pj_strtol(&cval->argv[2]);
-    if (new_prio < 0) 
+    if (new_prio < 0)
 	new_prio = 0;
-    else if (new_prio > PJMEDIA_CODEC_PRIO_HIGHEST) 
+    else if (new_prio > PJMEDIA_CODEC_PRIO_HIGHEST)
 	new_prio = PJMEDIA_CODEC_PRIO_HIGHEST;
 
-    status = pjsua_codec_set_priority(&cval->argv[1], 
+    status = pjsua_codec_set_priority(&cval->argv[1],
 				      (pj_uint8_t)new_prio);
 #if PJSUA_HAS_VIDEO
     if (status != PJ_SUCCESS) {
-	status = pjsua_vid_codec_set_priority(&cval->argv[1], 
+	status = pjsua_vid_codec_set_priority(&cval->argv[1],
 					      (pj_uint8_t)new_prio);
     }
@@ -1335,12 +1335,12 @@
     case CMD_MEDIA_CONF_CONNECT:
     case CMD_MEDIA_CONF_DISCONNECT:
-	status = cmd_media_connect(cval, 
-		          pj_cli_get_cmd_id(cval->cmd)==CMD_MEDIA_CONF_CONNECT);	
-	break;
-    case CMD_MEDIA_ADJUST_VOL:	
+	status = cmd_media_connect(cval,
+		          pj_cli_get_cmd_id(cval->cmd)==CMD_MEDIA_CONF_CONNECT);
+	break;
+    case CMD_MEDIA_ADJUST_VOL:
 	status = cmd_adjust_vol(cval);
 	break;
     case CMD_MEDIA_CODEC_PRIO:
-	status = cmd_set_codec_prio(cval);	
+	status = cmd_set_codec_prio(cval);
 	break;
     case CMD_MEDIA_SPEAKER_TOGGLE:
@@ -1369,5 +1369,5 @@
 	}
 	break;
-    }    
+    }
 
     return status;
@@ -1390,5 +1390,5 @@
 	PJ_LOG(1,(THIS_FILE, "Error: not enough buffer"));
     else
-	PJ_LOG(3,(THIS_FILE, 
+	PJ_LOG(3,(THIS_FILE,
 		  "Dumping configuration (%d bytes):\n%s\n",
 		  len, settings));
@@ -1404,5 +1404,5 @@
     pj_str_t tmp = pj_str(buf);
 
-    pj_strncpy_with_null(&tmp, &cval->argv[1], sizeof(buf));    
+    pj_strncpy_with_null(&tmp, &cval->argv[1], sizeof(buf));
 
     len = write_settings(&app_config, settings, sizeof(settings));
@@ -1447,10 +1447,10 @@
 	break;
     case CMD_CONFIG_DUMP_CONF:
-	status = cmd_show_config();	
-	break;
-    case CMD_CONFIG_WRITE_SETTING:	
+	status = cmd_show_config();
+	break;
+    case CMD_CONFIG_WRITE_SETTING:
 	status = cmd_write_config(cval);
 	break;
-    }    
+    }
 
     return status;
@@ -1463,26 +1463,26 @@
     char dest[64] = {0};
     char out_str[128];
-    pj_str_t tmp = pj_str(dest);      
-
-    pj_strncpy_with_null(&tmp, &cval->argv[1], sizeof(dest));    
-
-    pj_ansi_snprintf(out_str, 
-		     sizeof(out_str), 
+    pj_str_t tmp = pj_str(dest);
+
+    pj_strncpy_with_null(&tmp, &cval->argv[1], sizeof(dest));
+
+    pj_ansi_snprintf(out_str,
+		     sizeof(out_str),
 		     "(You currently have %d calls)\n",
 		     pjsua_call_get_count());
 
     pj_cli_sess_write_msg(cval->sess, out_str, pj_ansi_strlen(out_str));
-    
+
     /* input destination. */
-    get_input_url(tmp.ptr, tmp.slen, cval, &result);    
+    get_input_url(tmp.ptr, tmp.slen, cval, &result);
     if (result.nb_result != PJSUA_APP_NO_NB) {
 	pjsua_buddy_info binfo;
 	if (result.nb_result == -1 || result.nb_result == 0) {
-	    static const pj_str_t err_msg = 
+	    static const pj_str_t err_msg =
 		    {"You can't do that with make call!\n", 35};
 	    pj_cli_sess_write_msg(cval->sess, err_msg.ptr, err_msg.slen);
 	    return PJ_SUCCESS;
-	} 	
-	pjsua_buddy_get_info(result.nb_result-1, &binfo);	    
+	}
+	pjsua_buddy_get_info(result.nb_result-1, &binfo);
 	pj_strncpy(&tmp, &binfo.uri, sizeof(dest));
     } else if (result.uri_result) {
@@ -1494,5 +1494,5 @@
     pjsua_msg_data_init(&msg_data);
     TEST_MULTIPART(&msg_data);
-    pjsua_call_make_call(current_acc, &tmp, &call_opt, NULL, 
+    pjsua_call_make_call(current_acc, &tmp, &call_opt, NULL,
 			 &msg_data, &current_call);
     return PJ_SUCCESS;
@@ -1503,35 +1503,35 @@
 {
     struct input_result result;
-    char dest[64] = {0};    
+    char dest[64] = {0};
     char out_str[128];
     int i, count;
     pj_str_t tmp = pj_str(dest);
 
-    pj_ansi_snprintf(out_str, 
-		     sizeof(out_str), 
+    pj_ansi_snprintf(out_str,
+		     sizeof(out_str),
 		     "(You currently have %d calls)\n",
 		     pjsua_call_get_count());
-    
+
     count = pj_strtol(&cval->argv[1]);
     if (count < 1)
 	return PJ_SUCCESS;
-    
+
     pj_strncpy_with_null(&tmp, &cval->argv[2], sizeof(dest));
-    
+
     /* input destination. */
-    get_input_url(tmp.ptr, tmp.slen, cval, &result);    
+    get_input_url(tmp.ptr, tmp.slen, cval, &result);
     if (result.nb_result != PJSUA_APP_NO_NB) {
 	pjsua_buddy_info binfo;
 	if (result.nb_result == -1 || result.nb_result == 0) {
-	    static const pj_str_t err_msg = 
+	    static const pj_str_t err_msg =
 			    {"You can't do that with make call!\n", 35};
 	    pj_cli_sess_write_msg(cval->sess, err_msg.ptr, err_msg.slen);
 	    return PJ_SUCCESS;
-	} 	
-	pjsua_buddy_get_info(result.nb_result-1, &binfo);	    
-	pj_strncpy(&tmp, &binfo.uri, sizeof(dest));	
+	}
+	pjsua_buddy_get_info(result.nb_result-1, &binfo);
+	pj_strncpy(&tmp, &binfo.uri, sizeof(dest));
     } else {
 	tmp = pj_str(result.uri_result);
-    } 
+    }
 
     for (i=0; i<count; ++i) {
@@ -1559,9 +1559,9 @@
     }
 
-    if (current_call == PJSUA_INVALID_ID || 
+    if (current_call == PJSUA_INVALID_ID ||
 	call_info.role != PJSIP_ROLE_UAS ||
 	call_info.state >= PJSIP_INV_STATE_CONNECTING)
-    {	
-	static const pj_str_t err_msg = {"No pending incoming call\n", 26};	  
+    {
+	static const pj_str_t err_msg = {"No pending incoming call\n", 26};
 	pj_cli_sess_write_msg(cval->sess, err_msg.ptr, err_msg.slen);
 
@@ -1570,6 +1570,6 @@
 	char contact[120];
 	pj_str_t hname = { "Contact", 7 };
-	pj_str_t hvalue;	
-	pjsip_generic_string_hdr hcontact;	
+	pj_str_t hvalue;
+	pjsip_generic_string_hdr hcontact;
 
 	st_code = pj_strtol(&cval->argv[1]);
@@ -1583,5 +1583,5 @@
 		static const pj_str_t err_msg = {"Enter URL to be put "
 						 "in Contact\n",  32};
-		pj_cli_sess_write_msg(cval->sess, err_msg.ptr, err_msg.slen);		
+		pj_cli_sess_write_msg(cval->sess, err_msg.ptr, err_msg.slen);
 		return PJ_SUCCESS;
 	    }
@@ -1595,10 +1595,10 @@
 	/*
 	* Must check again!
-	* Call may have been disconnected while we're waiting for 
+	* Call may have been disconnected while we're waiting for
 	* keyboard input.
 	*/
 	if (current_call == PJSUA_INVALID_ID) {
-	    static const pj_str_t err_msg = {"Call has been disconnected\n", 
-					     28};	    
+	    static const pj_str_t err_msg = {"Call has been disconnected\n",
+					     28};
 	    pj_cli_sess_write_msg(cval->sess, err_msg.ptr, err_msg.slen);
 	}
@@ -1617,5 +1617,5 @@
     } else {
 	if (all)
-	    pjsua_call_hangup_all();	    
+	    pjsua_call_hangup_all();
 	else
 	    pjsua_call_hangup(current_call, 0, NULL, NULL);
@@ -1627,5 +1627,5 @@
 static pj_status_t cmd_hold_call()
 {
-    if (current_call != PJSUA_INVALID_ID) {	
+    if (current_call != PJSUA_INVALID_ID) {
 	pjsua_call_set_hold(current_call, NULL);
 
@@ -1675,10 +1675,10 @@
     }
 
-    if (current_call != PJSUA_INVALID_ID) {	
+    if (current_call != PJSUA_INVALID_ID) {
 	pjsua_call_info call_info;
 
 	pjsua_call_get_info(current_call, &call_info);
-	PJ_LOG(3,(THIS_FILE,"Current dialog: %.*s", 
-		  (int)call_info.remote_info.slen, 
+	PJ_LOG(3,(THIS_FILE,"Current dialog: %.*s",
+		  (int)call_info.remote_info.slen,
 		  call_info.remote_info.ptr));
 
@@ -1706,13 +1706,13 @@
 	pj_str_t STR_FALSE = { "false", 5 };
 	pjsua_call_info ci;
-	
-	pj_strncpy_with_null(&tmp, &cval->argv[1], sizeof(dest));	
+
+	pj_strncpy_with_null(&tmp, &cval->argv[1], sizeof(dest));
 
 	pjsua_call_get_info(current_call, &ci);
-	pj_ansi_snprintf(out_str, 
-			 sizeof(out_str), 
+	pj_ansi_snprintf(out_str,
+			 sizeof(out_str),
 			 "Transferring current call [%d] %.*s\n",
 			 current_call,
-			 (int)ci.remote_info.slen, 
+			 (int)ci.remote_info.slen,
 			 ci.remote_info.ptr);
 
@@ -1749,5 +1749,5 @@
 	    pjsua_call_xfer( current_call, &tmp, &msg_data);
 	}
-    }	    
+    }
     return PJ_SUCCESS;
 }
@@ -1755,5 +1755,5 @@
 /* Transfer call */
 static pj_status_t cmd_transfer_replace_call(pj_cli_cmd_val *cval)
-{    
+{
     if (current_call == -1) {
 	PJ_LOG(3,(THIS_FILE, "No current call"));
@@ -1764,19 +1764,19 @@
 	pj_str_t STR_REFER_SUB = { "Refer-Sub", 9 };
 	pj_str_t STR_FALSE = { "false", 5 };
-	pjsua_call_id ids[PJSUA_MAX_CALLS];	
+	pjsua_call_id ids[PJSUA_MAX_CALLS];
 	pjsua_msg_data msg_data;
-	char buf[8] = {0};	
+	char buf[8] = {0};
 	pj_str_t tmp = pj_str(buf);
-	unsigned count;	
-	static const pj_str_t err_invalid_num = 
+	unsigned count;
+	static const pj_str_t err_invalid_num =
 				    {"Invalid destination call number\n", 32 };
 	count = PJ_ARRAY_SIZE(ids);
 	pjsua_enum_calls(ids, &count);
 
-	if (count <= 1) {	    
-	    static const pj_str_t err_no_other_call = 
+	if (count <= 1) {
+	    static const pj_str_t err_no_other_call =
 				    {"There are no other calls\n", 25};
 
-	    pj_cli_sess_write_msg(cval->sess, err_no_other_call.ptr, 
+	    pj_cli_sess_write_msg(cval->sess, err_no_other_call.ptr,
 				  err_no_other_call.slen);
 	    return PJ_SUCCESS;
@@ -1787,9 +1787,9 @@
 
 	/* Check if call is still there. */
-	if (call != current_call) {	    
-	    static pj_str_t err_call_dc = 
+	if (call != current_call) {
+	    static pj_str_t err_call_dc =
 				    {"Call has been disconnected\n", 27};
 
-	    pj_cli_sess_write_msg(cval->sess, err_call_dc.ptr, 
+	    pj_cli_sess_write_msg(cval->sess, err_call_dc.ptr,
 				  err_call_dc.slen);
 	    return PJ_SUCCESS;
@@ -1798,9 +1798,9 @@
 	/* Check that destination call is valid. */
 	if (dst_call == call) {
-	    static pj_str_t err_same_num = 
+	    static pj_str_t err_same_num =
 				    {"Destination call number must not be the "
 				     "same as the call being transferred\n", 74};
 
-	    pj_cli_sess_write_msg(cval->sess, err_same_num.ptr, 
+	    pj_cli_sess_write_msg(cval->sess, err_same_num.ptr,
 				  err_same_num.slen);
 	    return PJ_SUCCESS;
@@ -1808,5 +1808,5 @@
 
 	if (dst_call >= PJSUA_MAX_CALLS) {
-	    pj_cli_sess_write_msg(cval->sess, err_invalid_num.ptr, 
+	    pj_cli_sess_write_msg(cval->sess, err_invalid_num.ptr,
 				  err_invalid_num.slen);
 	    return PJ_SUCCESS;
@@ -1814,5 +1814,5 @@
 
 	if (!pjsua_call_is_active(dst_call)) {
-	    pj_cli_sess_write_msg(cval->sess, err_invalid_num.ptr, 
+	    pj_cli_sess_write_msg(cval->sess, err_invalid_num.ptr,
 				  err_invalid_num.slen);
 	    return PJ_SUCCESS;
@@ -1822,11 +1822,11 @@
 	if (app_config.no_refersub) {
 	    /* Add Refer-Sub: false in outgoing REFER request */
-	    pjsip_generic_string_hdr_init2(&refer_sub, &STR_REFER_SUB, 
+	    pjsip_generic_string_hdr_init2(&refer_sub, &STR_REFER_SUB,
 					   &STR_FALSE);
 	    pj_list_push_back(&msg_data.hdr_list, &refer_sub);
 	}
 
-	pjsua_call_xfer_replaces(call, dst_call, 
-				 PJSUA_XFER_NO_REQUIRE_REPLACES, 
+	pjsua_call_xfer_replaces(call, dst_call,
+				 PJSUA_XFER_NO_REQUIRE_REPLACES,
 				 &msg_data);
     }
@@ -1835,5 +1835,5 @@
 
 static pj_status_t cmd_redirect_call(pj_cli_cmd_val *cval)
-{  
+{
     if (current_call == PJSUA_INVALID_ID) {
 	PJ_LOG(3,(THIS_FILE, "No current call"));
@@ -1842,5 +1842,5 @@
     if (!pjsua_call_is_active(current_call)) {
 	PJ_LOG(1,(THIS_FILE, "Call %d has gone", current_call));
-    } else {	
+    } else {
 	enum {
 	    ACCEPT_REPLACE, ACCEPT, REJECT, STOP
@@ -1850,6 +1850,6 @@
 	switch (choice) {
 	case ACCEPT_REPLACE:
-	    pjsua_call_process_redirect(current_call, 
-	    				PJSIP_REDIRECT_ACCEPT_REPLACE);	    
+	    pjsua_call_process_redirect(current_call,
+	    				PJSIP_REDIRECT_ACCEPT_REPLACE);
 	    break;
 	case ACCEPT:
@@ -1862,5 +1862,5 @@
 	    pjsua_call_process_redirect(current_call, PJSIP_REDIRECT_STOP);
 	    break;
-	}	
+	}
     }
     return PJ_SUCCESS;
@@ -1878,5 +1878,5 @@
 	PJ_LOG(3,(THIS_FILE, "Media is not established yet!"));
 
-    } else {	
+    } else {
 	int call = current_call;
 	pj_status_t status;
@@ -1888,5 +1888,5 @@
 	    return PJ_SUCCESS;;
 	}
-	
+
 	status = pjsua_call_dial_dtmf(current_call, &cval->argv[1]);
 	if (status != PJ_SUCCESS) {
@@ -1909,5 +1909,5 @@
 
     } else {
-	const pj_str_t SIP_INFO = pj_str("INFO");	
+	const pj_str_t SIP_INFO = pj_str("INFO");
 	int call = current_call;
 	int i;
@@ -1920,5 +1920,5 @@
 	    return PJ_SUCCESS;;
 	}
-	
+
 	for (i=0; i<cval->argv[1].slen; ++i) {
 	    char body[64];
@@ -1927,5 +1927,5 @@
 	    msg_data.content_type = pj_str("application/dtmf-relay");
 
-	    pj_ansi_snprintf(body, 
+	    pj_ansi_snprintf(body,
 			     sizeof(body),
 			     "Signal=%c\n"
@@ -1935,5 +1935,5 @@
 	    msg_data.msg_body = pj_str(body);
 
-	    status = pjsua_call_send_request(current_call, &SIP_INFO, 
+	    status = pjsua_call_send_request(current_call, &SIP_INFO,
 		&msg_data);
 	    if (status != PJ_SUCCESS) {
@@ -1962,21 +1962,21 @@
 	static const pj_str_t err_msg = {"Sorry, need at least one "
 					 "account configured\n", 45};
-	pj_cli_sess_write_msg(cval->sess, err_msg.ptr, err_msg.slen);	
+	pj_cli_sess_write_msg(cval->sess, err_msg.ptr, err_msg.slen);
     } else {
 	char *uri;
 	char dest[64] = {0};
-	pj_str_t tmp = pj_str(dest);	
+	pj_str_t tmp = pj_str(dest);
 	struct input_result result;
 	static const pj_str_t header = {"Send arbitrary request to "
 					"remote host\n", 39};
-	
-	pj_cli_sess_write_msg(cval->sess, header.ptr, header.slen);	
-	
-	pj_strncpy_with_null(&tmp, &cval->argv[2], sizeof(dest));	
+
+	pj_cli_sess_write_msg(cval->sess, header.ptr, header.slen);
+
+	pj_strncpy_with_null(&tmp, &cval->argv[2], sizeof(dest));
 	/* Input destination URI */
 	uri = NULL;
 	get_input_url(tmp.ptr, tmp.slen, cval, &result);
 	if (result.nb_result != PJSUA_APP_NO_NB) {
-	    if (result.nb_result == -1) {		
+	    if (result.nb_result == -1) {
 		static const pj_str_t err_msg = {"Sorry you can't do that!\n",
 						 26};
@@ -1995,5 +1995,5 @@
 	    } else {
 		pjsua_buddy_info binfo;
-		pjsua_buddy_get_info(result.nb_result-1, &binfo);		
+		pjsua_buddy_get_info(result.nb_result-1, &binfo);
 		pj_strncpy_with_null(&tmp, &binfo.uri, sizeof(dest));
 		uri = tmp.ptr;
@@ -2007,5 +2007,5 @@
 	if (uri) {
 	    char method[64] = {0};
-	    pj_str_t tmp_method = pj_str(method);	    
+	    pj_str_t tmp_method = pj_str(method);
 	    pj_strncpy_with_null(&tmp_method, &cval->argv[1], sizeof(method));
 	    tmp = pj_str(uri);
@@ -2016,7 +2016,7 @@
 	    * not go well with the call state, so don't do it
 	    * unless it's for testing.
-	    */	    
+	    */
 	    pjsua_call_send_request(current_call, &cval->argv[1], NULL);
-	}    
+	}
     }
     return PJ_SUCCESS;
@@ -2030,19 +2030,19 @@
 		     "You have %d active call%s\n", i, (i>1?"s":""));
 
-    pj_cli_sess_write_msg(cval->sess, out_str, 
+    pj_cli_sess_write_msg(cval->sess, out_str,
 	pj_ansi_strlen(out_str));
 
     if (current_call != PJSUA_INVALID_ID) {
 	pjsua_call_info ci;
-	if (pjsua_call_get_info(current_call, &ci)==PJ_SUCCESS) {	    
-	    pj_ansi_snprintf(out_str, sizeof(out_str), 
+	if (pjsua_call_get_info(current_call, &ci)==PJ_SUCCESS) {
+	    pj_ansi_snprintf(out_str, sizeof(out_str),
 		   "Current call id=%d to %.*s [%.*s]\n", current_call,
 		   (int)ci.remote_info.slen, ci.remote_info.ptr,
 		   (int)ci.state_text.slen, ci.state_text.ptr);
 
-	    pj_cli_sess_write_msg(cval->sess, out_str, 
+	    pj_cli_sess_write_msg(cval->sess, out_str,
 				  pj_ansi_strlen(out_str));
 	}
-    } 
+    }
     return PJ_SUCCESS;
 }
@@ -2050,5 +2050,5 @@
 /* Call handler */
 pj_status_t cmd_call_handler(pj_cli_cmd_val *cval)
-{    
+{
     pj_status_t status = PJ_SUCCESS;
     pj_cli_cmd_id cmd_id = pj_cli_get_cmd_id(cval->cmd);
@@ -2064,27 +2064,27 @@
 	break;
     case CMD_CALL_ANSWER:
-	status = cmd_answer_call(cval);	
-	break;
-    case CMD_CALL_HANGUP:	
-    case CMD_CALL_HANGUP_ALL:	
+	status = cmd_answer_call(cval);
+	break;
+    case CMD_CALL_HANGUP:
+    case CMD_CALL_HANGUP_ALL:
 	status = cmd_hangup_call(cval, (cmd_id==CMD_CALL_HANGUP_ALL));
 	break;
-    case CMD_CALL_HOLD:	
+    case CMD_CALL_HOLD:
 	status = cmd_hold_call();
 	break;
-    case CMD_CALL_REINVITE:	
+    case CMD_CALL_REINVITE:
 	status = cmd_call_reinvite();
 	break;
-    case CMD_CALL_UPDATE:	
+    case CMD_CALL_UPDATE:
 	status = cmd_call_update();
 	break;
-    case CMD_CALL_NEXT:			
-    case CMD_CALL_PREVIOUS:	
-	status = cmd_next_call(cmd_id==CMD_CALL_NEXT);	
-	break;
-    case CMD_CALL_TRANSFER:	
+    case CMD_CALL_NEXT:
+    case CMD_CALL_PREVIOUS:
+	status = cmd_next_call(cmd_id==CMD_CALL_NEXT);
+	break;
+    case CMD_CALL_TRANSFER:
 	status = cmd_transfer_call(cval);
 	break;
-    case CMD_CALL_TRANSFER_REPLACE:	
+    case CMD_CALL_TRANSFER_REPLACE:
 	status = cmd_transfer_replace_call(cval);
 	break;
@@ -2092,14 +2092,14 @@
 	status = cmd_redirect_call(cval);
 	break;
-    case CMD_CALL_D2833:	
+    case CMD_CALL_D2833:
 	status = cmd_dtmf_2833(cval);
 	break;
-    case CMD_CALL_INFO:	
+    case CMD_CALL_INFO:
 	status = cmd_call_info(cval);
 	break;
-    case CMD_CALL_DUMP_Q:	
+    case CMD_CALL_DUMP_Q:
 	status = cmd_call_quality();
 	break;
-    case CMD_CALL_SEND_ARB:	
+    case CMD_CALL_SEND_ARB:
 	status = cmd_send_arbitrary(cval);
 	break;
@@ -2107,12 +2107,12 @@
 	status = cmd_show_current_call(cval);
 	break;
-    }    
+    }
 
     return status;
 }
 
-#if PJSUA_HAS_VIDEO 
+#if PJSUA_HAS_VIDEO
 static pj_status_t cmd_set_video_enable(pj_bool_t enabled)
-{    
+{
     app_config.vid.vid_cnt = (enabled ? 1 : 0);
     PJ_LOG(3,(THIS_FILE, "Video will be %s in next offer/answer",
@@ -2136,5 +2136,5 @@
     pjsua_acc_config acc_cfg;
     pj_pool_t *pool = pjsua_pool_create("tmp-pjsua", 1000, 1000);
-    
+
     pjsua_acc_get_config(current_acc, pool, &acc_cfg);
     app_config_show_video(current_acc, &acc_cfg);
@@ -2154,9 +2154,9 @@
 
     switch(cmd_id) {
-    case CMD_VIDEO_ACC_AUTORX:	
-    case CMD_VIDEO_ACC_AUTOTX:	
+    case CMD_VIDEO_ACC_AUTORX:
+    case CMD_VIDEO_ACC_AUTOTX:
 	{
 	    int on = (pj_ansi_strnicmp(cval->argv[1].ptr, "On", 2)==0);
-       	
+
 	    if (cmd_id == CMD_VIDEO_ACC_AUTORX)
 		acc_cfg.vid_in_auto_show = on;
@@ -2165,14 +2165,14 @@
 	}
 	break;
-    case CMD_VIDEO_ACC_CAP_ID:		
+    case CMD_VIDEO_ACC_CAP_ID:
     case CMD_VIDEO_ACC_REN_ID:
 	{
-	    int dev = pj_strtol(&cval->argv[1]);	    	    
+	    int dev = pj_strtol(&cval->argv[1]);
 
 	    if (cmd_id == CMD_VIDEO_ACC_CAP_ID)
 		acc_cfg.vid_cap_dev = dev;
-	    else 
-		acc_cfg.vid_rend_dev = dev;		
-	}	
+	    else
+		acc_cfg.vid_rend_dev = dev;
+	}
 	break;
     }
@@ -2190,12 +2190,12 @@
 static pj_status_t cmd_enable_vid_rx(pj_cli_cmd_val *cval)
 {
-    pjsua_call_vid_strm_op_param param;    
-    pjsua_stream_info si;    
+    pjsua_call_vid_strm_op_param param;
+    pjsua_stream_info si;
     pj_status_t status = PJ_SUCCESS;
     pj_bool_t on = (pj_ansi_strnicmp(cval->argv[1].ptr, "On", 2) == 0);
 
-    pjsua_call_vid_strm_op_param_default(&param);    
-
-    param.med_idx = pj_strtol(&cval->argv[2]); 
+    pjsua_call_vid_strm_op_param_default(&param);
+
+    param.med_idx = pj_strtol(&cval->argv[2]);
     if (pjsua_call_get_stream_info(current_call, param.med_idx, &si) ||
 	si.type != PJMEDIA_TYPE_VIDEO)
@@ -2216,23 +2216,23 @@
 static pj_status_t cmd_enable_vid_tx(pj_cli_cmd_val *cval)
 {
-    pjsua_call_vid_strm_op_param param;    
+    pjsua_call_vid_strm_op_param param;
     pj_status_t status = PJ_SUCCESS;
-    pj_bool_t on = (pj_ansi_strnicmp(cval->argv[1].ptr, "On", 2) == 0);    
-    
+    pj_bool_t on = (pj_ansi_strnicmp(cval->argv[1].ptr, "On", 2) == 0);
+
     pjsua_call_vid_strm_op op = on? PJSUA_CALL_VID_STRM_START_TRANSMIT :
 				PJSUA_CALL_VID_STRM_STOP_TRANSMIT;
 
     pjsua_call_vid_strm_op_param_default(&param);
-    
+
     param.med_idx = pj_strtol(&cval->argv[2]);
 
-    status = pjsua_call_set_vid_strm(current_call, op, &param);    
+    status = pjsua_call_set_vid_strm(current_call, op, &param);
     return status;
 }
 
-static pj_status_t cmd_enable_vid_stream(pj_cli_cmd_val *cval, 
+static pj_status_t cmd_enable_vid_stream(pj_cli_cmd_val *cval,
 					   pj_bool_t enable)
-{    
-    pjsua_call_vid_strm_op_param param;    
+{
+    pjsua_call_vid_strm_op_param param;
     pjsua_call_vid_strm_op op = enable? PJSUA_CALL_VID_STRM_CHANGE_DIR :
 				PJSUA_CALL_VID_STRM_REMOVE;
@@ -2242,5 +2242,5 @@
     param.med_idx = cval->argc > 1 ? pj_strtol(&cval->argv[1]) : -1;
     param.dir = PJMEDIA_DIR_ENCODING_DECODING;
-    return pjsua_call_set_vid_strm(current_call, op, &param);    
+    return pjsua_call_set_vid_strm(current_call, op, &param);
 }
 
@@ -2251,5 +2251,5 @@
     pjsua_call_vid_strm_op_param_default(&param);
     param.med_idx = cval->argc > 1? pj_strtol(&cval->argv[1]) : -1;
-    param.cap_dev = cval->argc > 2? pj_strtol(&cval->argv[2]) : 
+    param.cap_dev = cval->argc > 2? pj_strtol(&cval->argv[2]) :
 				    PJMEDIA_VID_DEFAULT_CAPTURE_DEV;
 
@@ -2272,7 +2272,7 @@
 
 static pj_status_t cmd_vid_device_preview(pj_cli_cmd_val *cval)
-{        
-    int dev_id = pj_strtol(&cval->argv[2]);    
-    pj_bool_t on = (pj_ansi_strnicmp(cval->argv[1].ptr, "On", 2) == 0);          
+{
+    int dev_id = pj_strtol(&cval->argv[2]);
+    pj_bool_t on = (pj_ansi_strnicmp(cval->argv[1].ptr, "On", 2) == 0);
 
     if (on) {
@@ -2293,10 +2293,10 @@
 	    pjsua_vid_preview_stop(dev_id);
 	}
-    }    
+    }
     return PJ_SUCCESS;
 }
 
 static pj_status_t cmd_vid_codec_list()
-{    
+{
     pjsua_codec_info ci[PJMEDIA_CODEC_MGR_MAX_CODECS];
     unsigned count = PJ_ARRAY_SIZE(ci);
@@ -2319,5 +2319,5 @@
 	    vfd = pjmedia_format_get_video_format_detail(&cp.enc_fmt,
 		PJ_TRUE);
-	    PJ_LOG(3,(THIS_FILE, "%.*s%.*s %3d %7.2f  %4d/%4d  %dx%d", 
+	    PJ_LOG(3,(THIS_FILE, "%.*s%.*s %3d %7.2f  %4d/%4d  %dx%d",
 		(int)ci[i].codec_id.slen, ci[i].codec_id.ptr,
 		13-(int)ci[i].codec_id.slen, "                ",
@@ -2332,8 +2332,8 @@
 
 static pj_status_t cmd_set_vid_codec_prio(pj_cli_cmd_val *cval)
-{    
+{
     int prio = pj_strtol(&cval->argv[2]);
     pj_status_t status;
-        
+
     status = pjsua_vid_codec_set_priority(&cval->argv[1], (pj_uint8_t)prio);
     if (status != PJ_SUCCESS)
@@ -2344,7 +2344,7 @@
 
 static pj_status_t cmd_set_vid_codec_fps(pj_cli_cmd_val *cval)
-{    
+{
     pjmedia_vid_codec_param cp;
-    int M, N;    
+    int M, N;
     pj_status_t status;
 
@@ -2364,6 +2364,6 @@
 
 static pj_status_t cmd_set_vid_codec_bitrate(pj_cli_cmd_val *cval)
-{    
-    pjmedia_vid_codec_param cp;    
+{
+    pjmedia_vid_codec_param cp;
     int M, N;
     pj_status_t status;
@@ -2385,5 +2385,5 @@
 static pj_status_t cmd_set_vid_codec_size(pj_cli_cmd_val *cval)
 {
-    pjmedia_vid_codec_param cp;    
+    pjmedia_vid_codec_param cp;
     int M, N;
     pj_status_t status;
@@ -2430,5 +2430,5 @@
 
 static pj_status_t cmd_show_vid_win(pj_cli_cmd_val *cval, pj_bool_t show)
-{            
+{
     pjsua_vid_win_id wid = pj_strtol(&cval->argv[1]);
     return pjsua_vid_win_set_show(wid, show);
@@ -2457,7 +2457,7 @@
 /* Video handler */
 static pj_status_t cmd_video_handler(pj_cli_cmd_val *cval)
-{    
+{
     pj_status_t status = PJ_SUCCESS;
-    pj_cli_cmd_id cmd_id = pj_cli_get_cmd_id(cval->cmd);    
+    pj_cli_cmd_id cmd_id = pj_cli_get_cmd_id(cval->cmd);
 
     CHECK_PJSUA_RUNNING();
@@ -2525,5 +2525,5 @@
 	status = cmd_arrange_vid_win();
 	break;
-    case CMD_VIDEO_WIN_SHOW:	
+    case CMD_VIDEO_WIN_SHOW:
     case CMD_VIDEO_WIN_HIDE:
 	status = cmd_show_vid_win(cval, (cmd_id==CMD_VIDEO_WIN_SHOW));
@@ -2535,5 +2535,5 @@
 	status = cmd_resize_vid_win(cval);
 	break;
-    }    
+    }
 
     return status;
@@ -2543,10 +2543,10 @@
 /* Other command handler */
 static pj_status_t cmd_sleep_handler(pj_cli_cmd_val *cval)
-{    
+{
     int delay;
 
     delay = pj_strtoul(&cval->argv[1]);
     if (delay < 0) delay = 0;
-    pj_thread_sleep(delay);    
+    pj_thread_sleep(delay);
 
     return PJ_SUCCESS;
@@ -2559,5 +2559,5 @@
 
     CHECK_PJSUA_RUNNING();
-    
+
     status = pjsua_detect_nat_type();
     if (status != PJ_SUCCESS)
@@ -2578,6 +2578,6 @@
 }
 
-/* 
- * Syntax error handler for parser. 
+/*
+ * Syntax error handler for parser.
  */
 static void on_syntax_error(pj_scanner *scanner)
@@ -2587,7 +2587,7 @@
 }
 
-/* 
+/*
  * This method will parse buffer string info array of argument string
- * @argc On input, maximum array size of argument. On output, number of argument 
+ * @argc On input, maximum array size of argument. On output, number of argument
  * parsed
  * @argv Array of argument string
@@ -2598,5 +2598,5 @@
     pj_scanner scanner;
     unsigned max_argc = *argc;
-    
+
     PJ_USE_EXCEPTION;
 
@@ -2604,5 +2604,5 @@
 	return PJ_SUCCESS;
 
-    pj_scan_init(&scanner, options->ptr, options->slen, PJ_SCAN_AUTOSKIP_WS, 
+    pj_scan_init(&scanner, options->ptr, options->slen, PJ_SCAN_AUTOSKIP_WS,
 		 &on_syntax_error);
     PJ_TRY {
@@ -2610,5 +2610,5 @@
 	while (!pj_scan_is_eof(&scanner) && (max_argc > *argc)) {
 	    pj_str_t str;
-	    
+
 	    pj_scan_get_until_chr(&scanner, " \t\r\n", &str);
 	    argv[*argc] = str;
@@ -2617,5 +2617,5 @@
     }
     PJ_CATCH_ANY {
-	pj_scan_fini(&scanner);	
+	pj_scan_fini(&scanner);
 	return PJ_GET_EXCEPTION();
     }
@@ -2636,5 +2636,5 @@
     pj_cli_quit(cval->sess->fe->cli, cval->sess, PJ_TRUE);
 
-    /** Get the pjsua option **/       
+    /** Get the pjsua option **/
     for (i=1; i < cval->argc; i++) {
 	pj_str_t argvst[MAX_ARGC];
@@ -2659,6 +2659,6 @@
 
 static pj_status_t add_call_command(pj_cli_t *cli)
-{  
-    char* call_command = 
+{
+    char* call_command =
 	"<CMD name='call' id='100' desc='Call related commands'>"
 	"  <CMD name='new' id='1001' desc='Make a new call/INVITE'>"
@@ -2699,5 +2699,5 @@
 	"  <CMD name='transfer_replaces' id='1012' sc='X' "
 	"   desc='Transfer replace call'>"
-	"    <ARG name='call_id' type='choice' id='9911' desc='Call Id'/>"	
+	"    <ARG name='call_id' type='choice' id='9911' desc='Call Id'/>"
 	"  </CMD>"
 	"  <CMD name='redirect' id='1013' sc='R' desc='Redirect call'>"
@@ -2730,5 +2730,5 @@
 
     pj_str_t xml = pj_str(call_command);
-    return pj_cli_add_cmd_from_xml(cli, NULL, 
+    return pj_cli_add_cmd_from_xml(cli, NULL,
 				   &xml, cmd_call_handler,
 				   NULL, get_choice_value);
@@ -2786,6 +2786,6 @@
     pj_str_t xml = pj_str(presence_command);
 
-    return pj_cli_add_cmd_from_xml(cli, NULL, 
-				   &xml, cmd_presence_handler, 
+    return pj_cli_add_cmd_from_xml(cli, NULL,
+				   &xml, cmd_presence_handler,
 				   NULL, get_choice_value);
 }
@@ -2793,5 +2793,5 @@
 static pj_status_t add_account_command(pj_cli_t *cli)
 {
-    char* account_command = 
+    char* account_command =
 	"<CMD name='acc' id='300' desc='Account commands'>"
 	"  <CMD name='add' id='3001' sc='+a' desc='Add new account'>"
@@ -2831,6 +2831,6 @@
 
     pj_str_t xml = pj_str(account_command);
-    return pj_cli_add_cmd_from_xml(cli, NULL, 
-				   &xml, cmd_account_handler, 
+    return pj_cli_add_cmd_from_xml(cli, NULL,
+				   &xml, cmd_account_handler,
 				   NULL, get_choice_value);
 }
@@ -2838,5 +2838,5 @@
 static pj_status_t add_media_command(pj_cli_t *cli)
 {
-    char* media_command = 
+    char* media_command =
 	"<CMD name='audio' id='400' desc='Conference and Media commands'>"
 	"  <CMD name='list' id='4001' sc='cl' desc='Show conference list'/>"
@@ -2866,6 +2866,6 @@
 
     pj_str_t xml = pj_str(media_command);
-    return pj_cli_add_cmd_from_xml(cli, NULL, 
-				   &xml, cmd_media_handler, 
+    return pj_cli_add_cmd_from_xml(cli, NULL,
+				   &xml, cmd_media_handler,
 				   NULL, get_choice_value);
 }
@@ -2873,5 +2873,5 @@
 static pj_status_t add_config_command(pj_cli_t *cli)
 {
-    char* config_command = 
+    char* config_command =
 	"<CMD name='stat' id='500' desc='Status and config commands'>"
 	"  <CMD name='dump_stat' id='5001' sc='ds' desc='Dump status'/>"
@@ -2887,10 +2887,10 @@
 
     pj_str_t xml = pj_str(config_command);
-    return pj_cli_add_cmd_from_xml(cli, NULL, 
+    return pj_cli_add_cmd_from_xml(cli, NULL,
 				   &xml, cmd_config_handler,
 				   NULL, get_choice_value);
 }
 
-#if PJSUA_HAS_VIDEO    
+#if PJSUA_HAS_VIDEO
 static pj_status_t add_video_command(pj_cli_t *cli)
 {
@@ -3032,6 +3032,6 @@
 
     pj_str_t xml = pj_str(video_command);
-    return pj_cli_add_cmd_from_xml(cli, NULL, 
-				   &xml, cmd_video_handler, 
+    return pj_cli_add_cmd_from_xml(cli, NULL,
+				   &xml, cmd_video_handler,
 				   NULL, get_choice_value);
 }
@@ -3060,23 +3060,23 @@
 
     pj_status_t status;
-    pj_str_t sleep_xml = pj_str(sleep_command);    
+    pj_str_t sleep_xml = pj_str(sleep_command);
     pj_str_t network_xml = pj_str(network_command);
     pj_str_t shutdown_xml = pj_str(shutdown_command);
     pj_str_t restart_xml = pj_str(restart_command);
 
-    status = pj_cli_add_cmd_from_xml(cli, NULL, 
-				     &sleep_xml, cmd_sleep_handler, 
+    status = pj_cli_add_cmd_from_xml(cli, NULL,
+				     &sleep_xml, cmd_sleep_handler,
 				     NULL, NULL);
     if (status != PJ_SUCCESS)
 	return status;
 
-    status = pj_cli_add_cmd_from_xml(cli, NULL, 
-				     &network_xml, cmd_network_handler, 
+    status = pj_cli_add_cmd_from_xml(cli, NULL,
+				     &network_xml, cmd_network_handler,
 				     NULL, NULL);
     if (status != PJ_SUCCESS)
 	return status;
 
-    status = pj_cli_add_cmd_from_xml(cli, NULL, 
-				     &shutdown_xml, cmd_quit_handler, 
+    status = pj_cli_add_cmd_from_xml(cli, NULL,
+				     &shutdown_xml, cmd_quit_handler,
 				     NULL, NULL);
 
@@ -3084,6 +3084,6 @@
 	return status;
 
-    status = pj_cli_add_cmd_from_xml(cli, NULL, 
-				     &restart_xml, cmd_restart_handler, 
+    status = pj_cli_add_cmd_from_xml(cli, NULL,
+				     &restart_xml, cmd_restart_handler,
 				     NULL, NULL);
 
@@ -3115,5 +3115,5 @@
 	return status;
 
-#if PJSUA_HAS_VIDEO    
+#if PJSUA_HAS_VIDEO
     status = add_video_command(cli);
     if (status != PJ_SUCCESS)
Index: pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app_config.c
===================================================================
--- pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app_config.c	(revision 4728)
+++ pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app_config.c	(revision 4729)
@@ -1,4 +1,4 @@
 /* $Id$ */
-/* 
+/*
  * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
  * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
@@ -16,5 +16,5 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 #include "pjsua_app_common.h"
@@ -219,5 +219,5 @@
  * Read command arguments from config file.
  */
-static int read_config_file(pj_pool_t *pool, const char *filename, 
+static int read_config_file(pj_pool_t *pool, const char *filename,
 			    int *app_argc, char ***app_argv)
 {
@@ -249,8 +249,8 @@
 	pj_size_t   len;
 	int token_len;
-	
+
 	pj_bzero(line, sizeof(line));
 	if (fgets(line, sizeof(line), fhnd) == NULL) break;
-	
+
 	// Trim ending newlines
 	len = strlen(line);
@@ -268,11 +268,11 @@
 	    if (*p == '\0')		    // are we done yet?
 		break;
-	    
+
 	    if (*p == '"' || *p == '\'') {    // is token a quoted string
 		cDelimiter = *p++;	    // save quote delimiter
 		token = p;
-		
+
 		while (*p != '\0' && *p != cDelimiter) p++;
-		
+
 		if (*p == '\0')		// found end of the line, but,
 		    cDelimiter = '\0';	// didn't find a matching quote
@@ -280,22 +280,22 @@
 	    } else {			// token's not a quoted string
 		token = p;
-		
+
 		while (*p != '\0' && strchr(whitespace, *p) == NULL) p++;
-		
+
 		cDelimiter = *p;
 	    }
-	    
+
 	    *p = '\0';
 	    token_len = (int)(p-token);
-	    
+
 	    if (token_len > 0) {
 		if (*token == '#')
 		    break;  // ignore remainder of line
-		
+
 		argv[argc] = pj_pool_alloc(pool, token_len + 1);
 		pj_memcpy(argv[argc], token, token_len + 1);
 		++argc;
 	    }
-	    
+
 	    *p = cDelimiter;
 	}
@@ -307,5 +307,5 @@
 
     if (argc == MAX_ARGS && (i!=*app_argc || !feof(fhnd))) {
-	PJ_LOG(1,(THIS_FILE, 
+	PJ_LOG(1,(THIS_FILE,
 		  "Too many arguments specified in cmd line/config file"));
 	fflush(stdout);
@@ -323,5 +323,5 @@
 
 /* Parse arguments. */
-static pj_status_t parse_args(int argc, char *argv[], 			      
+static pj_status_t parse_args(int argc, char *argv[],
 			      pj_str_t *uri_to_call)
 {
@@ -329,8 +329,8 @@
     int option_index;
     pjsua_app_config *cfg = &app_config;
-    enum { OPT_CONFIG_FILE=127, OPT_LOG_FILE, OPT_LOG_LEVEL, OPT_APP_LOG_LEVEL, 
+    enum { OPT_CONFIG_FILE=127, OPT_LOG_FILE, OPT_LOG_LEVEL, OPT_APP_LOG_LEVEL,
 	   OPT_LOG_APPEND, OPT_COLOR, OPT_NO_COLOR, OPT_LIGHT_BG, OPT_NO_STDERR,
 	   OPT_HELP, OPT_VERSION, OPT_NULL_AUDIO, OPT_SND_AUTO_CLOSE,
-	   OPT_LOCAL_PORT, OPT_IP_ADDR, OPT_PROXY, OPT_OUTBOUND_PROXY, 
+	   OPT_LOCAL_PORT, OPT_IP_ADDR, OPT_PROXY, OPT_OUTBOUND_PROXY,
 	   OPT_REGISTRAR, OPT_REG_TIMEOUT, OPT_PUBLISH, OPT_ID, OPT_CONTACT,
 	   OPT_BOUND_ADDR, OPT_CONTACT_PARAMS, OPT_CONTACT_URI_PARAMS,
@@ -342,11 +342,11 @@
 	   OPT_AUTO_CONF, OPT_CLOCK_RATE, OPT_SND_CLOCK_RATE, OPT_STEREO,
 	   OPT_USE_ICE, OPT_ICE_REGULAR, OPT_USE_SRTP, OPT_SRTP_SECURE,
-	   OPT_USE_TURN, OPT_ICE_MAX_HOSTS, OPT_ICE_NO_RTCP, OPT_TURN_SRV, 
+	   OPT_USE_TURN, OPT_ICE_MAX_HOSTS, OPT_ICE_NO_RTCP, OPT_TURN_SRV,
 	   OPT_TURN_TCP, OPT_TURN_USER, OPT_TURN_PASSWD,
-	   OPT_PLAY_FILE, OPT_PLAY_TONE, OPT_RTP_PORT, OPT_ADD_CODEC, 
+	   OPT_PLAY_FILE, OPT_PLAY_TONE, OPT_RTP_PORT, OPT_ADD_CODEC,
 	   OPT_ILBC_MODE, OPT_REC_FILE, OPT_AUTO_REC,
 	   OPT_COMPLEXITY, OPT_QUALITY, OPT_PTIME, OPT_NO_VAD,
 	   OPT_RX_DROP_PCT, OPT_TX_DROP_PCT, OPT_EC_TAIL, OPT_EC_OPT,
-	   OPT_NEXT_ACCOUNT, OPT_NEXT_CRED, OPT_MAX_CALLS, 
+	   OPT_NEXT_ACCOUNT, OPT_NEXT_CRED, OPT_MAX_CALLS,
 	   OPT_DURATION, OPT_NO_TCP, OPT_NO_UDP, OPT_THREAD_CNT,
 	   OPT_NOREFERSUB, OPT_ACCEPT_REDIRECT,
@@ -458,7 +458,7 @@
 	{ "thread-cnt",	1, 0, OPT_THREAD_CNT},
 #if defined(PJSIP_HAS_TLS_TRANSPORT) && (PJSIP_HAS_TLS_TRANSPORT != 0)
-	{ "use-tls",	0, 0, OPT_USE_TLS}, 
+	{ "use-tls",	0, 0, OPT_USE_TLS},
 	{ "tls-ca-file",1, 0, OPT_TLS_CA_FILE},
-	{ "tls-cert-file",1,0, OPT_TLS_CERT_FILE}, 
+	{ "tls-cert-file",1,0, OPT_TLS_CERT_FILE},
 	{ "tls-privkey-file",1,0, OPT_TLS_PRIV_FILE},
 	{ "tls-password",1,0, OPT_TLS_PASSWORD},
@@ -504,8 +504,8 @@
     unsigned i;
 
-    /* Run pj_getopt once to see if user specifies config file to read. */ 
+    /* Run pj_getopt once to see if user specifies config file to read. */
     pj_optind = 0;
-    while ((c=pj_getopt_long(argc, argv, "", long_options, 
-			     &option_index)) != -1) 
+    while ((c=pj_getopt_long(argc, argv, "", long_options,
+			     &option_index)) != -1)
     {
 	switch (c) {
@@ -541,5 +541,5 @@
 	    /* Ignore as this has been processed before */
 	    break;
-	
+
 	case OPT_LOG_FILE:
 	    cfg->log_cfg.log_filename = pj_str(pj_optarg);
@@ -549,5 +549,5 @@
 	    c = pj_strtoul(pj_cstr(&tmp, pj_optarg));
 	    if (c < 0 || c > 6) {
-		PJ_LOG(1,(THIS_FILE, 
+		PJ_LOG(1,(THIS_FILE,
 			  "Error: expecting integer value 0-6 "
 			  "for --log-level"));
@@ -560,6 +560,6 @@
 	case OPT_APP_LOG_LEVEL:
 	    cfg->log_cfg.console_level = pj_strtoul(pj_cstr(&tmp, pj_optarg));
-	    if (cfg->log_cfg.console_level < 0 || cfg->log_cfg.console_level > 6) {
-		PJ_LOG(1,(THIS_FILE, 
+	    if (cfg->log_cfg.console_level > 6) {
+		PJ_LOG(1,(THIS_FILE,
 			  "Error: expecting integer value 0-6 "
 			  "for --app-log-level"));
@@ -614,5 +614,5 @@
 		return PJ_EINVAL;
 	    }
-	    cfg->media_cfg.clock_rate = lval; 
+	    cfg->media_cfg.clock_rate = lval;
 	    break;
 
@@ -624,5 +624,5 @@
 		return PJ_EINVAL;
 	    }
-	    cfg->media_cfg.snd_clock_rate = lval; 
+	    cfg->media_cfg.snd_clock_rate = lval;
 	    break;
 
@@ -634,5 +634,5 @@
 	    lval = pj_strtoul(pj_cstr(&tmp, pj_optarg));
 	    if (lval < 0 || lval > 65535) {
-		PJ_LOG(1,(THIS_FILE, 
+		PJ_LOG(1,(THIS_FILE,
 			  "Error: expecting integer value for "
 			  "--local-port"));
@@ -676,5 +676,5 @@
 	case OPT_PROXY:   /* proxy */
 	    if (pjsua_verify_sip_url(pj_optarg) != 0) {
-		PJ_LOG(1,(THIS_FILE, 
+		PJ_LOG(1,(THIS_FILE,
 			  "Error: invalid SIP URL '%s' "
 			  "in proxy argument", pj_optarg));
@@ -686,5 +686,5 @@
 	case OPT_OUTBOUND_PROXY:   /* outbound proxy */
 	    if (pjsua_verify_sip_url(pj_optarg) != 0) {
-		PJ_LOG(1,(THIS_FILE, 
+		PJ_LOG(1,(THIS_FILE,
 			  "Error: invalid SIP URL '%s' "
 			  "in outbound proxy argument", pj_optarg));
@@ -696,5 +696,5 @@
 	case OPT_REGISTRAR:   /* registrar */
 	    if (pjsua_verify_sip_url(pj_optarg) != 0) {
-		PJ_LOG(1,(THIS_FILE, 
+		PJ_LOG(1,(THIS_FILE,
 			  "Error: invalid SIP URL '%s' in "
 			  "registrar argument", pj_optarg));
@@ -707,5 +707,5 @@
 	    cur_acc->reg_timeout = pj_strtoul(pj_cstr(&tmp,pj_optarg));
 	    if (cur_acc->reg_timeout < 1 || cur_acc->reg_timeout > 3600) {
-		PJ_LOG(1,(THIS_FILE, 
+		PJ_LOG(1,(THIS_FILE,
 			  "Error: invalid value for --reg-timeout "
 			  "(expecting 1-3600)"));
@@ -730,5 +730,5 @@
 	    lval = pj_strtoul(pj_cstr(&tmp, pj_optarg));
 	    if (lval < 0 || lval > 3) {
-		PJ_LOG(1,(THIS_FILE, 
+		PJ_LOG(1,(THIS_FILE,
 			  "Error: expecting integer value 0-3 for --use-timer"));
 		return PJ_EINVAL;
@@ -741,5 +741,5 @@
 	    cur_acc->timer_setting.sess_expires = pj_strtoul(pj_cstr(&tmp, pj_optarg));
 	    if (cur_acc->timer_setting.sess_expires < 90) {
-		PJ_LOG(1,(THIS_FILE, 
+		PJ_LOG(1,(THIS_FILE,
 			  "Error: invalid value for --timer-se "
 			  "(expecting higher than 90)"));
@@ -752,5 +752,5 @@
 	    cur_acc->timer_setting.min_se = pj_strtoul(pj_cstr(&tmp, pj_optarg));
 	    if (cur_acc->timer_setting.min_se < 90) {
-		PJ_LOG(1,(THIS_FILE, 
+		PJ_LOG(1,(THIS_FILE,
 			  "Error: invalid value for --timer-min-se "
 			  "(expecting higher than 90)"));
@@ -770,5 +770,5 @@
 	case OPT_ID:   /* id */
 	    if (pjsua_verify_url(pj_optarg) != 0) {
-		PJ_LOG(1,(THIS_FILE, 
+		PJ_LOG(1,(THIS_FILE,
 			  "Error: invalid SIP URL '%s' "
 			  "in local id argument", pj_optarg));
@@ -780,5 +780,5 @@
 	case OPT_CONTACT:   /* contact */
 	    if (pjsua_verify_sip_url(pj_optarg) != 0) {
-		PJ_LOG(1,(THIS_FILE, 
+		PJ_LOG(1,(THIS_FILE,
 			  "Error: invalid SIP URL '%s' "
 			  "in contact argument", pj_optarg));
@@ -822,6 +822,6 @@
 	case OPT_ACCEPT_REDIRECT:
 	    cfg->redir_op = my_atoi(pj_optarg);
-	    if (cfg->redir_op<0 || cfg->redir_op>PJSIP_REDIRECT_STOP) {
-		PJ_LOG(1,(THIS_FILE, 
+	    if (cfg->redir_op>PJSIP_REDIRECT_STOP) {
+		PJ_LOG(1,(THIS_FILE,
 			  "Error: accept-redirect value '%s' ", pj_optarg));
 		return PJ_EINVAL;
@@ -893,5 +893,5 @@
 	case OPT_ADD_BUDDY: /* Add to buddy list. */
 	    if (pjsua_verify_url(pj_optarg) != 0) {
-		PJ_LOG(1,(THIS_FILE, 
+		PJ_LOG(1,(THIS_FILE,
 			  "Error: invalid URL '%s' in "
 			  "--add-buddy option", pj_optarg));
@@ -899,5 +899,5 @@
 	    }
 	    if (cfg->buddy_cnt == PJ_ARRAY_SIZE(cfg->buddy_cfg)) {
-		PJ_LOG(1,(THIS_FILE, 
+		PJ_LOG(1,(THIS_FILE,
 			  "Error: too many buddies in buddy list."));
 		return -1;
@@ -1022,6 +1022,6 @@
 	case OPT_SRTP_SECURE:
 	    app_config.cfg.srtp_secure_signaling = my_atoi(pj_optarg);
-	    if (!pj_isdigit(*pj_optarg) || 
-		app_config.cfg.srtp_secure_signaling > 2) 
+	    if (!pj_isdigit(*pj_optarg) ||
+		app_config.cfg.srtp_secure_signaling > 2)
 	    {
 		PJ_LOG(1,(THIS_FILE, "Invalid value for --srtp-secure option"));
@@ -1039,5 +1039,5 @@
 
 		range = (65535-START_PORT-PJSUA_MAX_CALLS*2);
-		cfg->rtp_cfg.port = START_PORT + 
+		cfg->rtp_cfg.port = START_PORT +
 				    ((pj_rand() % range) & 0xFFFE);
 	    }
@@ -1112,5 +1112,5 @@
 	case OPT_QUALITY:
 	    cfg->media_cfg.quality = my_atoi(pj_optarg);
-	    if (cfg->media_cfg.quality < 0 || cfg->media_cfg.quality > 10) {
+	    if (cfg->media_cfg.quality > 10) {
 		PJ_LOG(1,(THIS_FILE,
 			  "Error: invalid --quality (expecting 0-10"));
@@ -1136,5 +1136,5 @@
 	    }
 	    break;
-	    
+
 	case OPT_TX_DROP_PCT:
 	    cfg->media_cfg.tx_drop_pct = my_atoi(pj_optarg);
@@ -1170,13 +1170,13 @@
 	    cfg->use_tls = PJ_TRUE;
 	    break;
-	    
+
 	case OPT_TLS_CA_FILE:
 	    cfg->udp_cfg.tls_setting.ca_list_file = pj_str(pj_optarg);
 	    break;
-	    
+
 	case OPT_TLS_CERT_FILE:
 	    cfg->udp_cfg.tls_setting.cert_file = pj_str(pj_optarg);
 	    break;
-	    
+
 	case OPT_TLS_PRIV_FILE:
 	    cfg->udp_cfg.tls_setting.privkey_file = pj_str(pj_optarg);
@@ -1222,5 +1222,5 @@
 		    ciphers_cnt = PJ_ARRAY_SIZE(ciphers);
 		    pj_ssl_cipher_get_availables(ciphers, &ciphers_cnt);
-		    
+
 		    PJ_LOG(1,(THIS_FILE, "Cipher \"%s\" is not supported by "
 					 "TLS/SSL backend.", pj_optarg));
@@ -1286,5 +1286,5 @@
 	    cfg->rtp_cfg.qos_type = PJ_QOS_TYPE_VOICE;
 	    /* Directly apply DSCP value to SIP traffic. Say lets
-	     * set it to CS3 (DSCP 011000). Note that this will not 
+	     * set it to CS3 (DSCP 011000). Note that this will not
 	     * work on all platforms.
 	     */
@@ -1337,5 +1337,5 @@
 
 	default:
-	    PJ_LOG(1,(THIS_FILE, 
+	    PJ_LOG(1,(THIS_FILE,
 		      "Argument \"%s\" is not valid. Use --help to see help",
 		      argv[pj_optind-1]));
@@ -1402,5 +1402,5 @@
 	    /* Realm must point to the real domain */
 	    if (*acfg->cred_info[0].realm.ptr=='*') {
-		PJ_LOG(1,(THIS_FILE, 
+		PJ_LOG(1,(THIS_FILE,
 			  "Error: cannot use '*' as realm with IMS"));
 		return PJ_EINVAL;
@@ -1409,5 +1409,5 @@
 	    /* Username for authentication must be in a@b format */
 	    if (strchr(acfg->cred_info[0].username.ptr, '@')==0) {
-		PJ_LOG(1,(THIS_FILE, 
+		PJ_LOG(1,(THIS_FILE,
 			  "Error: Username for authentication must "
 			  "be in user@domain format with IMS"));
@@ -1456,5 +1456,5 @@
     for (i=0; i<PJ_ARRAY_SIZE(cfg->buddy_cfg); ++i)
 	pjsua_buddy_config_default(&cfg->buddy_cfg[i]);
-    
+
     cfg->vid.vcapture_dev = PJMEDIA_VID_DEFAULT_CAPTURE_DEV;
     cfg->vid.vrender_dev = PJMEDIA_VID_DEFAULT_RENDER_DEV;
@@ -1500,5 +1500,5 @@
 	return status;
 
-    if (app_running) {    
+    if (app_running) {
 	app_config.use_cli = use_cli;
 	app_config.cli_cfg.cli_fe = cli_fe;
Index: pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app_legacy.c
===================================================================
--- pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app_legacy.c	(revision 4728)
+++ pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app_legacy.c	(revision 4729)
@@ -1,4 +1,4 @@
 /* $Id$ */
-/* 
+/*
  * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
  * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
@@ -16,5 +16,5 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
@@ -48,8 +48,8 @@
 		continue;
 
-	    printf(" [%2d] <%.*s>  %.*s\n", 
-		    ids[i]+1, 
+	    printf(" [%2d] <%.*s>  %.*s\n",
+		    ids[i]+1,
 		    (int)info.status_text.slen,
-		    info.status_text.ptr, 
+		    info.status_text.ptr,
 		    (int)info.uri.slen,
 		    info.uri.ptr);
@@ -62,5 +62,5 @@
  * Input URL.
  */
-static void ui_input_url(const char *title, char *buf, pj_size_t len, 
+static void ui_input_url(const char *title, char *buf, pj_size_t len,
 			 input_result *result)
 {
@@ -98,7 +98,7 @@
 
     if (pj_isdigit(*buf) || *buf=='-') {
-	
+
 	unsigned i;
-	
+
 	if (*buf=='-')
 	    i = 1;
@@ -115,6 +115,6 @@
 	result->nb_result = my_atoi(buf);
 
-	if (result->nb_result >= 0 && 
-	    result->nb_result <= (int)pjsua_get_buddy_count()) 
+	if (result->nb_result >= 0 &&
+	    result->nb_result <= (int)pjsua_get_buddy_count())
 	{
 	    return;
@@ -155,5 +155,5 @@
     if (!*buf)
 	return PJ_FALSE;
-    
+
     return PJ_TRUE;
 }
@@ -170,5 +170,5 @@
 
     if (!info.has_registration) {
-	pj_ansi_snprintf(buf, sizeof(buf), "%.*s", 
+	pj_ansi_snprintf(buf, sizeof(buf), "%.*s",
 			 (int)info.status_text.slen,
 			 info.status_text.ptr);
@@ -186,5 +186,5 @@
     printf(" %c[%2d] %.*s: %s\n", (acc_id==current_acc?'*':' '),
 	   acc_id,  (int)info.acc_uri.slen, info.acc_uri.ptr, buf);
-    printf("       Online status: %.*s\n", 
+    printf("       Online status: %.*s\n",
 	(int)info.online_status_text.slen,
 	info.online_status_text.ptr);
@@ -209,5 +209,5 @@
 
     print_buddy_list();
-    
+
     //puts("Commands:");
     puts("+=============================================================================+");
@@ -386,5 +386,5 @@
 	                                     PJSUA_CALL_VID_STRM_ADD, NULL);
 	}
-	else if (argc >= 3 && 
+	else if (argc >= 3 &&
 		 (strcmp(argv[2], "disable")==0 || strcmp(argv[2], "enable")==0))
 	{
@@ -514,5 +514,5 @@
 		    vfd = pjmedia_format_get_video_format_detail(&cp.enc_fmt,
 								 PJ_TRUE);
-		    PJ_LOG(3,(THIS_FILE, "%.*s%.*s %3d %7.2f  %4d/%4d  %dx%d", 
+		    PJ_LOG(3,(THIS_FILE, "%.*s%.*s %3d %7.2f  %4d/%4d  %dx%d",
 			      (int)ci[i].codec_id.slen, ci[i].codec_id.ptr,
 			      13-(int)ci[i].codec_id.slen, "                ",
@@ -591,5 +591,5 @@
 /** UI Command **/
 static void ui_make_new_call()
-{    
+{
     char buf[128];
     pjsua_msg_data msg_data;
@@ -598,5 +598,5 @@
 
     printf("(You currently have %d calls)\n", pjsua_call_get_count());
-    
+
     ui_input_url("Make call", buf, sizeof(buf), &result);
     if (result.nb_result != PJSUA_APP_NO_NB) {
@@ -620,5 +620,5 @@
     pjsua_msg_data_init(&msg_data);
     TEST_MULTIPART(&msg_data);
-    pjsua_call_make_call(current_acc, &tmp, &call_opt, NULL, 
+    pjsua_call_make_call(current_acc, &tmp, &call_opt, NULL,
 			 &msg_data, &current_call);
 }
@@ -754,5 +754,5 @@
     }
 
-    if (current_call == -1 || 
+    if (current_call == -1 ||
 	call_info.role != PJSIP_ROLE_UAS ||
 	call_info.state >= PJSIP_INV_STATE_CONNECTING)
@@ -779,5 +779,5 @@
 
 	if (st_code/100 == 3) {
-	    if (!simple_input("Enter URL to be put in Contact", 
+	    if (!simple_input("Enter URL to be put in Contact",
 		contact, sizeof(contact)))
 		return;
@@ -790,5 +790,5 @@
 	/*
 	* Must check again!
-	* Call may have been disconnected while we're waiting for 
+	* Call may have been disconnected while we're waiting for
 	* keyboard input.
 	*/
@@ -800,5 +800,5 @@
 
 	pjsua_call_answer2(current_call, &call_opt, st_code, NULL, &msg_data);
-    }    
+    }
 }
 
@@ -832,6 +832,6 @@
 
 	pjsua_call_get_info(current_call, &call_info);
-	PJ_LOG(3,(THIS_FILE,"Current dialog: %.*s", 
-	    (int)call_info.remote_info.slen, 
+	PJ_LOG(3,(THIS_FILE,"Current dialog: %.*s",
+	    (int)call_info.remote_info.slen,
 	    call_info.remote_info.ptr));
 
@@ -912,5 +912,5 @@
     acc_cfg.cred_info[0].data = pj_str(passwd);
 
-    acc_cfg.rtp_cfg = *rtp_cfg;    
+    acc_cfg.rtp_cfg = *rtp_cfg;
     app_config_init_video(&acc_cfg);
 
@@ -959,5 +959,5 @@
 static void ui_call_hold()
 {
-    if (current_call != -1) {		
+    if (current_call != -1) {
 	pjsua_call_set_hold(current_call, NULL);
     } else {
@@ -974,5 +974,5 @@
 static void ui_send_update()
 {
-    if (current_call != -1) {		
+    if (current_call != -1) {
 	pjsua_call_update2(current_call, &call_opt, NULL);
     } else {
@@ -1037,14 +1037,14 @@
 
     new_prio = atoi(prio);
-    if (new_prio < 0) 
+    if (new_prio < 0)
 	new_prio = 0;
-    else if (new_prio > PJMEDIA_CODEC_PRIO_HIGHEST) 
+    else if (new_prio > PJMEDIA_CODEC_PRIO_HIGHEST)
 	new_prio = PJMEDIA_CODEC_PRIO_HIGHEST;
 
-    status = pjsua_codec_set_priority(pj_cstr(&id, codec), 
+    status = pjsua_codec_set_priority(pj_cstr(&id, codec),
 				      (pj_uint8_t)new_prio);
 #if PJSUA_HAS_VIDEO
     if (status != PJ_SUCCESS) {
-	status = pjsua_vid_codec_set_priority(pj_cstr(&id, codec), 
+	status = pjsua_vid_codec_set_priority(pj_cstr(&id, codec),
 					      (pj_uint8_t)new_prio);
     }
@@ -1106,5 +1106,5 @@
 
 static void ui_call_transfer_replaces(pj_bool_t no_refersub)
-{        
+{
     if (current_call == -1) {
 	PJ_LOG(3,(THIS_FILE, "No current call"));
@@ -1179,11 +1179,11 @@
 	if (no_refersub) {
 	    /* Add Refer-Sub: false in outgoing REFER request */
-	    pjsip_generic_string_hdr_init2(&refer_sub, &STR_REFER_SUB, 
+	    pjsip_generic_string_hdr_init2(&refer_sub, &STR_REFER_SUB,
 					   &STR_FALSE);
 	    pj_list_push_back(&msg_data.hdr_list, &refer_sub);
 	}
 
-	pjsua_call_xfer_replaces(call, dst_call, 
-				 PJSUA_XFER_NO_REQUIRE_REPLACES, 
+	pjsua_call_xfer_replaces(call, dst_call,
+				 PJSUA_XFER_NO_REQUIRE_REPLACES,
 				 &msg_data);
     }
@@ -1202,5 +1202,5 @@
 	char buf[128];
 
-	if (!simple_input("DTMF strings to send (0-9*#A-B)", buf, 
+	if (!simple_input("DTMF strings to send (0-9*#A-B)", buf,
 	    sizeof(buf)))
 	{
@@ -1235,5 +1235,5 @@
 	char buf[128];
 
-	if (!simple_input("DTMF strings to send (0-9*#A-B)", buf, 
+	if (!simple_input("DTMF strings to send (0-9*#A-B)", buf,
 	    sizeof(buf)))
 	{
@@ -1260,5 +1260,5 @@
 	    msg_data.msg_body = pj_str(body);
 
-	    status = pjsua_call_send_request(current_call, &SIP_INFO, 
+	    status = pjsua_call_send_request(current_call, &SIP_INFO,
 		&msg_data);
 	    if (status != PJ_SUCCESS) {
@@ -1302,5 +1302,5 @@
 		return;
 	    }
-	} else {	    
+	} else {
 	    pjsua_buddy_info binfo;
 	    pjsua_buddy_get_info(result.nb_result-1, &binfo);
@@ -1327,5 +1327,5 @@
 	pj_str_t method = pj_str(text);
 	pjsua_call_send_request(current_call, &method, NULL);
-    }	    
+    }
 }
 
@@ -1362,5 +1362,5 @@
 	delay = pj_strtoul(&tmp);
 	if (delay < 0) delay = 0;
-	pj_thread_sleep(delay);		
+	pj_thread_sleep(delay);
     }
 }
@@ -1429,5 +1429,6 @@
     pj_bool_t online_status;
     pjrpid_element elem;
-    int i, choice;
+    int choice;
+    unsigned i;
 
     enum {
@@ -1450,5 +1451,5 @@
     printf("\n"
 	   "Choices:\n");
-    for (i=0; i<PJ_ARRAY_SIZE(opts); ++i) {
+    for (i=0; i<(unsigned)PJ_ARRAY_SIZE(opts); ++i) {
 	printf("  %d  %s\n", opts[i].id+1, opts[i].name);
     }
@@ -1525,10 +1526,10 @@
 	    pj_ansi_strcat(txlist, s);
 	}
-	printf("Port #%02d[%2dKHz/%dms/%d] %20.*s  transmitting to: %s\n", 
-	       info.slot_id, 
+	printf("Port #%02d[%2dKHz/%dms/%d] %20.*s  transmitting to: %s\n",
+	       info.slot_id,
 	       info.clock_rate/1000,
 	       info.samples_per_frame*1000/info.channel_count/info.clock_rate,
 	       info.channel_count,
-	       (int)info.name.slen, 
+	       (int)info.name.slen,
 	       info.name.ptr,
 	       txlist);
@@ -1609,6 +1610,6 @@
 	PJ_LOG(1,(THIS_FILE, "Error: not enough buffer"));
     else
-	PJ_LOG(3,(THIS_FILE, "Dumping configuration (%d bytes):\n%s\n",	
-		  len, settings));	
+	PJ_LOG(3,(THIS_FILE, "Dumping configuration (%d bytes):\n%s\n",
+		  len, settings));
 }
 
@@ -1655,8 +1656,8 @@
 	    PJ_LOG(1,(THIS_FILE, "Call %d has gone", current_call));
 	} else if (menuin[1] == 'a') {
-	    pjsua_call_process_redirect(current_call, 
+	    pjsua_call_process_redirect(current_call,
 		PJSIP_REDIRECT_ACCEPT_REPLACE);
 	} else if (menuin[1] == 'A') {
-	    pjsua_call_process_redirect(current_call, 
+	    pjsua_call_process_redirect(current_call,
 		PJSIP_REDIRECT_ACCEPT);
 	} else if (menuin[1] == 'r') {
@@ -1674,7 +1675,7 @@
  */
 void legacy_main()
-{    
-    char menuin[80];    
-    char buf[128];    
+{
+    char menuin[80];
+    char buf[128];
 
     keystroke_help();
@@ -1686,5 +1687,5 @@
 
 	if (fgets(menuin, sizeof(menuin), stdin) == NULL) {
-	    /* 
+	    /*
 	     * Be friendly to users who redirect commands into
 	     * program, when file ends, resume with kbd.
@@ -1786,5 +1787,5 @@
 	    break;
 
-	case 'v':	    
+	case 'v':
 #if PJSUA_HAS_VIDEO
 	    if (menuin[1]=='i' && menuin[2]=='d' && menuin[3]==' ') {
@@ -1869,5 +1870,5 @@
 	    ui_register(menuin);
 	    break;
-	    
+
 	case 't':
 	    ui_toggle_state();
@@ -1891,5 +1892,5 @@
 
 	case 'V':
-	    /* Adjust audio volume */	    
+	    /* Adjust audio volume */
 	    ui_adjust_volume();
 	    break;
@@ -1897,8 +1898,8 @@
 	case 'd':
 	    if (menuin[1] == 'c') {
-		ui_dump_configuration();	
+		ui_dump_configuration();
 	    } else if (menuin[1] == 'q') {
 		ui_dump_call_quality();
-	    } else {		
+	    } else {
 		ui_app_dump(menuin[1]=='d');
 	    }
@@ -1907,5 +1908,5 @@
 	case 'f':
 	    if (simple_input("Enter output filename", buf, sizeof(buf))) {
-		ui_write_settings();		
+		ui_write_settings();
 	    }
 	    break;
@@ -1916,5 +1917,5 @@
 	    goto on_exit;
 
-	case 'R':	    
+	case 'R':
 	    ui_call_redirect(menuin);
 	    break;
