Index: /pjproject/trunk/pjsip/include/pjsip-ua/sip_regc.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsip-ua/sip_regc.h	(revision 5355)
+++ /pjproject/trunk/pjsip/include/pjsip-ua/sip_regc.h	(revision 5356)
@@ -78,4 +78,5 @@
     int			 contact_cnt;/**<Number of contacts in response.    */
     pjsip_contact_hdr	*contact[PJSIP_REGC_MAX_CONTACT]; /**< Contacts.    */
+    pj_bool_t		 is_unreg;  /**< Expire header, if any, set to zero?*/
 };
 
Index: /pjproject/trunk/pjsip/src/pjsip-ua/sip_reg.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip-ua/sip_reg.c	(revision 5355)
+++ /pjproject/trunk/pjsip/src/pjsip-ua/sip_reg.c	(revision 5356)
@@ -747,5 +747,6 @@
 			  const pj_str_t *reason,
 			  pjsip_rx_data *rdata, pj_int32_t expiration,
-			  int contact_cnt, pjsip_contact_hdr *contact[])
+			  int contact_cnt, pjsip_contact_hdr *contact[],
+			  pj_bool_t is_unreg)
 {
     cbparam->regc = regc;
@@ -758,4 +759,5 @@
     cbparam->expiration = (expiration >= 0? expiration:
           		   regc->expires_requested);
+    cbparam->is_unreg = is_unreg;
     if (contact_cnt) {
 	pj_memcpy( cbparam->contact, contact, 
@@ -767,5 +769,6 @@
 			  const pj_str_t *reason,
 			  pjsip_rx_data *rdata, pj_int32_t expiration,
-			  int contact_cnt, pjsip_contact_hdr *contact[])
+			  int contact_cnt, pjsip_contact_hdr *contact[],
+			  pj_bool_t is_unreg)
 {
     struct pjsip_regc_cbparam cbparam;
@@ -775,5 +778,5 @@
 
     cbparam_init(&cbparam, regc, status, st_code, reason, rdata, expiration,
-                 contact_cnt, contact);
+                 contact_cnt, contact, is_unreg);
     (*regc->cb)(&cbparam);
 }
@@ -802,5 +805,6 @@
 	char errmsg[PJ_ERR_MSG_SIZE];
 	pj_str_t reason = pj_strerror(status, errmsg, sizeof(errmsg));
-	call_callback(regc, status, 400, &reason, NULL, -1, 0, NULL);
+	call_callback(regc, status, 400, &reason, NULL, -1, 0, NULL,
+		      PJ_FALSE);
     }
 
@@ -1100,5 +1104,5 @@
                      (event->body.tsx_state.type==PJSIP_EVENT_RX_MSG) ? 
 	              event->body.tsx_state.src.rdata : NULL,
-                     -1, 0, NULL);
+                     -1, 0, NULL, PJ_FALSE);
 
         /* Call regc tsx callback before handling any response */
@@ -1139,6 +1143,8 @@
 	pjsip_rx_data *rdata = event->body.tsx_state.src.rdata;
 	pjsip_tx_data *tdata;
+	pj_bool_t is_unreg;
 
 	/* reset current op */
+	is_unreg = (regc->current_op == REGC_UNREGISTERING);
 	regc->current_op = REGC_IDLE;
 
@@ -1206,5 +1212,5 @@
 		call_callback(regc, status, tsx->status_code, 
 			      &rdata->msg_info.msg->line.status.reason,
-			      rdata, -1, 0, NULL);
+			      rdata, -1, 0, NULL, is_unreg);
 		pj_lock_acquire(regc->lock);
 	    }
@@ -1295,5 +1301,5 @@
 		call_callback(regc, status, tsx->status_code,
 			      &rdata->msg_info.msg->line.status.reason,
-			      rdata, -1, 0, NULL);
+			      rdata, -1, 0, NULL, PJ_FALSE);
 		pj_lock_acquire(regc->lock);
 	    }
@@ -1310,4 +1316,5 @@
 	unsigned contact_cnt = 0;
 	pjsip_contact_hdr *contact[PJSIP_REGC_MAX_CONTACT];
+	pj_bool_t is_unreg;
 
 	if (tsx->status_code/100 == 2) {
@@ -1334,4 +1341,5 @@
 
 	/* Mark operation as complete */
+	is_unreg = (regc->current_op == REGC_UNREGISTERING);
 	regc->current_op = REGC_IDLE;
 
@@ -1345,5 +1353,5 @@
 			: &tsx->status_text),
 		      rdata, expiration, 
-		      contact_cnt, contact);
+		      contact_cnt, contact, is_unreg);
 	pj_lock_acquire(regc->lock);
     }
Index: /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c	(revision 5355)
+++ /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c	(revision 5356)
@@ -2305,5 +2305,5 @@
 	reg_info.cbparam = param;
 	reg_info.regc = param->regc;
-	reg_info.renew = (rinfo.interval != 0);
+	reg_info.renew = !param->is_unreg;
 	(*pjsua_var.ua_cfg.cb.on_reg_state2)(acc->index, &reg_info);
     }
