Index: pjproject/trunk/pjsip-apps/src/swig/symbols.i
===================================================================
--- pjproject/trunk/pjsip-apps/src/swig/symbols.i	(revision 5492)
+++ pjproject/trunk/pjsip-apps/src/swig/symbols.i	(revision 5493)
@@ -164,5 +164,5 @@
 typedef enum pjsua_vid_req_keyframe_method {PJSUA_VID_REQ_KEYFRAME_SIP_INFO = 1, PJSUA_VID_REQ_KEYFRAME_RTCP_PLI = 2} pjsua_vid_req_keyframe_method;
 
-typedef enum pjsua_call_flag {PJSUA_CALL_UNHOLD = 1, PJSUA_CALL_UPDATE_CONTACT = 2, PJSUA_CALL_INCLUDE_DISABLED_MEDIA = 4, PJSUA_CALL_NO_SDP_OFFER = 8, PJSUA_CALL_REINIT_MEDIA = 16} pjsua_call_flag;
+typedef enum pjsua_call_flag {PJSUA_CALL_UNHOLD = 1, PJSUA_CALL_UPDATE_CONTACT = 2, PJSUA_CALL_INCLUDE_DISABLED_MEDIA = 4, PJSUA_CALL_NO_SDP_OFFER = 8, PJSUA_CALL_REINIT_MEDIA = 16, PJSUA_CALL_UPDATE_VIA = 32} pjsua_call_flag;
 
 typedef enum pjsua_create_media_transport_flag {PJSUA_MED_TP_CLOSE_MEMBER = 1} pjsua_create_media_transport_flag;
Index: pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
===================================================================
--- pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h	(revision 5492)
+++ pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h	(revision 5493)
@@ -4298,5 +4298,15 @@
      * reverted.
      */
-    PJSUA_CALL_REINIT_MEDIA = 16
+    PJSUA_CALL_REINIT_MEDIA = 16,
+    
+    /**
+     * Update the local invite session's Via with the via address from
+     * the account. This flag is only valid for #pjsua_call_set_hold2(),
+     * #pjsua_call_reinvite() and #pjsua_call_update(). Similar to
+     * the flag PJSUA_CALL_UPDATE_CONTACT above, this flag is useful
+     * in IP address change situation, after the local account's Via has
+     * been updated (typically with re-registration).
+     */
+    PJSUA_CALL_UPDATE_VIA = 32
 
 } pjsua_call_flag;
Index: pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c	(revision 5492)
+++ pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c	(revision 5493)
@@ -570,5 +570,6 @@
 {
     opt->flag &= ~(PJSUA_CALL_UNHOLD | PJSUA_CALL_UPDATE_CONTACT |
-		   PJSUA_CALL_NO_SDP_OFFER | PJSUA_CALL_REINIT_MEDIA);
+		   PJSUA_CALL_NO_SDP_OFFER | PJSUA_CALL_REINIT_MEDIA |
+		   PJSUA_CALL_UPDATE_VIA);
 }
 
@@ -637,4 +638,25 @@
 
     return PJ_SUCCESS;
+}
+
+static void dlg_set_via(pjsip_dialog *dlg, pjsua_acc *acc)
+{
+    if (acc->cfg.allow_via_rewrite && acc->via_addr.host.slen > 0) {
+        pjsip_dlg_set_via_sent_by(dlg, &acc->via_addr, acc->via_tp);
+    } else if (!pjsua_sip_acc_is_using_stun(acc->index)) {
+   	/* Choose local interface to use in Via if acc is not using
+   	 * STUN. See https://trac.pjsip.org/repos/ticket/1804
+   	 */
+   	pjsip_host_port via_addr;
+   	const void *via_tp;
+
+   	if (pjsua_acc_get_uac_addr(acc->index, dlg->pool, &acc->cfg.id,
+   				   &via_addr, NULL, NULL,
+   				   &via_tp) == PJ_SUCCESS)
+   	{
+   	    pjsip_dlg_set_via_sent_by(dlg, &via_addr,
+   	                              (pjsip_transport*)via_tp);
+   	}
+    }
 }
 
@@ -778,21 +800,5 @@
     pjsip_dlg_inc_lock(dlg);
 
-    if (acc->cfg.allow_via_rewrite && acc->via_addr.host.slen > 0) {
-        pjsip_dlg_set_via_sent_by(dlg, &acc->via_addr, acc->via_tp);
-    } else if (!pjsua_sip_acc_is_using_stun(acc_id)) {
-   	/* Choose local interface to use in Via if acc is not using
-   	 * STUN. See https://trac.pjsip.org/repos/ticket/1804
-   	 */
-   	pjsip_host_port via_addr;
-   	const void *via_tp;
-
-   	if (pjsua_acc_get_uac_addr(acc_id, dlg->pool, &acc->cfg.id,
-   				   &via_addr, NULL, NULL,
-   				   &via_tp) == PJ_SUCCESS)
-   	{
-   	    pjsip_dlg_set_via_sent_by(dlg, &via_addr,
-   	                              (pjsip_transport*)via_tp);
-   	}
-    }
+    dlg_set_via(dlg, acc);
 
     /* Calculate call's secure level */
@@ -2500,4 +2506,10 @@
     }
 
+    if ((options & PJSUA_CALL_UPDATE_VIA) &&
+	pjsua_acc_is_valid(call->acc_id))
+    {
+    	dlg_set_via(call->inv->dlg, &pjsua_var.acc[call->acc_id]);
+    }
+
     /* Create re-INVITE with new offer */
     status = pjsip_inv_reinvite( call->inv, new_contact, sdp, &tdata);
@@ -2621,4 +2633,10 @@
     }
 
+    if ((call->opt.flag & PJSUA_CALL_UPDATE_VIA) &&
+	pjsua_acc_is_valid(call->acc_id))
+    {
+    	dlg_set_via(call->inv->dlg, &pjsua_var.acc[call->acc_id]);
+    }
+
     /* Create re-INVITE with new offer */
     status = pjsip_inv_reinvite( call->inv, new_contact, sdp, &tdata);
@@ -2728,4 +2746,10 @@
     {
 	new_contact = &pjsua_var.acc[call->acc_id].contact;
+    }
+
+    if ((call->opt.flag & PJSUA_CALL_UPDATE_VIA) &&
+	pjsua_acc_is_valid(call->acc_id))
+    {
+	dlg_set_via(call->inv->dlg, &pjsua_var.acc[call->acc_id]);
     }
 
