Index: /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
===================================================================
--- /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c	(revision 6034)
+++ /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c	(revision 6035)
@@ -1064,7 +1064,7 @@
 	if (h->type == PJSIP_H_CONTACT) {
 	    const pjsip_contact_hdr *c = (const pjsip_contact_hdr*)h;
-	    int e = c->expires;
-
-	    if (e < 0) {
+	    unsigned e = c->expires;
+
+	    if (e != PJSIP_EXPIRES_NOT_SPECIFIED) {
 		if (exp)
 		    e = exp->ivalue;
Index: /pjproject/trunk/pjsip-apps/src/samples/footprint.c
===================================================================
--- /pjproject/trunk/pjsip-apps/src/samples/footprint.c	(revision 6034)
+++ /pjproject/trunk/pjsip-apps/src/samples/footprint.c	(revision 6035)
@@ -404,5 +404,5 @@
     pjsip_evsub_get_state(NULL);
     pjsip_evsub_get_state_name(NULL);
-    pjsip_evsub_initiate(NULL, NULL, -1, NULL);
+    pjsip_evsub_initiate(NULL, NULL, PJSIP_EXPIRES_NOT_SPECIFIED, NULL);
     pjsip_evsub_accept(NULL, NULL, 200, NULL);
     pjsip_evsub_notify(NULL, PJSIP_EVSUB_STATE_ACTIVE, NULL, NULL, NULL);
Index: /pjproject/trunk/pjsip-apps/src/samples/sipecho.c
===================================================================
--- /pjproject/trunk/pjsip-apps/src/samples/sipecho.c	(revision 6034)
+++ /pjproject/trunk/pjsip-apps/src/samples/sipecho.c	(revision 6035)
@@ -435,5 +435,5 @@
 	pjsip_hdr hdr_list, *h;
 	pjsip_msg *msg;
-	int expires = -1;
+	unsigned expires = PJSIP_EXPIRES_NOT_SPECIFIED;
 
 	pj_list_init(&hdr_list);
@@ -445,5 +445,5 @@
 	    PJ_LOG(3,(THIS_FILE, " Expires=%d", expires));
 	}
-	if (expires != 0) {
+	if (expires != 0 && expires != PJSIP_EXPIRES_NOT_SPECIFIED) {
 	    h = (pjsip_hdr*)pjsip_msg_find_hdr(msg, PJSIP_H_CONTACT, NULL);
 	    if (h)
Index: /pjproject/trunk/pjsip/include/pjsip-simple/evsub.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsip-simple/evsub.h	(revision 6034)
+++ /pjproject/trunk/pjsip/include/pjsip-simple/evsub.h	(revision 6035)
@@ -364,6 +364,6 @@
  * @param expires	Subscription expiration. If the value is set to zero,
  *			this will request unsubscription. If the value is
- *			negative, default expiration as defined by the package
- *			will be used.
+ *			PJSIP_EXPIRES_NOT_SPECIFIED, default expiration
+ * 			as defined by the package will be used.
  * @param p_tdata	Pointer to receive the request.
  *
@@ -372,5 +372,5 @@
 PJ_DECL(pj_status_t) pjsip_evsub_initiate( pjsip_evsub *sub,
 					   const pjsip_method *method,
-					   pj_int32_t expires,
+					   pj_uint32_t expires,
 					   pjsip_tx_data **p_tdata);
 
Index: /pjproject/trunk/pjsip/include/pjsip-simple/evsub_msg.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsip-simple/evsub_msg.h	(revision 6034)
+++ /pjproject/trunk/pjsip/include/pjsip-simple/evsub_msg.h	(revision 6035)
@@ -89,5 +89,6 @@
     pj_str_t	    sub_state;		/**< Subscription state. */
     pj_str_t	    reason_param;	/**< Optional termination reason. */
-    int		    expires_param;	/**< Expires param, or -1. */
+    unsigned	    expires_param;	/**< Expires param, or
+    					     PJSIP_EXPIRES_NOT_SPECIFIED. */
     int		    retry_after;	/**< Retry after param, or -1. */
     pjsip_param	    other_param;	/**< Other parameters. */
Index: /pjproject/trunk/pjsip/include/pjsip-simple/mwi.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsip-simple/mwi.h	(revision 6034)
+++ /pjproject/trunk/pjsip/include/pjsip-simple/mwi.h	(revision 6035)
@@ -122,5 +122,7 @@
  * @param sub		Client subscription instance.
  * @param expires	Subscription expiration. If the value is set to zero,
- *			this will request unsubscription.
+ *			this will request unsubscription. If the value is
+ *			PJSIP_EXPIRES_NOT_SPECIFIED, default expiration
+ * 			as defined by the package will be used.
  * @param p_tdata	Pointer to receive the request.
  *
@@ -128,5 +130,5 @@
  */
 PJ_DECL(pj_status_t) pjsip_mwi_initiate( pjsip_evsub *sub,
-					 pj_int32_t expires,
+					 pj_uint32_t expires,
 					 pjsip_tx_data **p_tdata);
 
Index: /pjproject/trunk/pjsip/include/pjsip-simple/presence.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsip-simple/presence.h	(revision 6034)
+++ /pjproject/trunk/pjsip/include/pjsip-simple/presence.h	(revision 6035)
@@ -172,5 +172,7 @@
  * @param sub		Client subscription instance.
  * @param expires	Subscription expiration. If the value is set to zero,
- *			this will request unsubscription.
+ *			this will request unsubscription. If the value is
+ *			PJSIP_EXPIRES_NOT_SPECIFIED, default expiration
+ * 			as defined by the package will be used.
  * @param p_tdata	Pointer to receive the request.
  *
@@ -178,5 +180,5 @@
  */
 PJ_DECL(pj_status_t) pjsip_pres_initiate( pjsip_evsub *sub,
-					  pj_int32_t expires,
+					  pj_uint32_t expires,
 					  pjsip_tx_data **p_tdata);
 
Index: /pjproject/trunk/pjsip/include/pjsip-simple/publish.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsip-simple/publish.h	(revision 6034)
+++ /pjproject/trunk/pjsip/include/pjsip-simple/publish.h	(revision 6035)
@@ -98,7 +98,9 @@
     pj_str_t		 reason;    /**< SIP reason phrase received.	    */
     pjsip_rx_data	*rdata;	    /**< The complete received response.    */
-    int			 expiration;/**< Next expiration interval. If the
-					 value is -1, it means the session
-					 will not renew itself.		    */
+    unsigned		 expiration;/**< Next expiration interval. If the
+					 value is
+					 PJSIP_PUBC_EXPIRATION_NOT_SPECIFIED,
+					 it means the session will not renew
+					 itself.		    	    */
 };
 
Index: /pjproject/trunk/pjsip/include/pjsip-ua/sip_regc.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsip-ua/sip_regc.h	(revision 6034)
+++ /pjproject/trunk/pjsip/include/pjsip-ua/sip_regc.h	(revision 6035)
@@ -52,5 +52,5 @@
 
 /** Expiration not specified. */
-#define PJSIP_REGC_EXPIRATION_NOT_SPECIFIED	((pj_uint32_t)0xFFFFFFFFUL)
+#define PJSIP_REGC_EXPIRATION_NOT_SPECIFIED	PJSIP_EXPIRES_NOT_SPECIFIED
 
 /** Buffer to hold all contacts. */
@@ -75,5 +75,7 @@
     pj_str_t		 reason;    /**< SIP reason phrase received.	    */
     pjsip_rx_data	*rdata;	    /**< The complete received response.    */
-    int			 expiration;/**< Next expiration interval.	    */
+    unsigned		 expiration;/**< Next expiration interval,
+    					 PJSIP_REGC_EXPIRATION_NOT_SPECIFIED
+    					 if not specified.	    	    */
     int			 contact_cnt;/**<Number of contacts in response.    */
     pjsip_contact_hdr	*contact[PJSIP_REGC_MAX_CONTACT]; /**< Contacts.    */
@@ -110,6 +112,6 @@
     pj_bool_t	is_busy;    /**< Have pending transaction?		    */
     pj_bool_t	auto_reg;   /**< Will register automatically?		    */
-    int		interval;   /**< Registration interval (seconds).	    */
-    int		next_reg;   /**< Time until next registration (seconds).    */
+    unsigned	interval;   /**< Registration interval (seconds).	    */
+    unsigned	next_reg;   /**< Time until next registration (seconds).    */
     pjsip_transport *transport; /**< Last transport used.		    */
 };
Index: /pjproject/trunk/pjsip/include/pjsip/sip_msg.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsip/sip_msg.h	(revision 6034)
+++ /pjproject/trunk/pjsip/include/pjsip/sip_msg.h	(revision 6035)
@@ -1071,5 +1071,5 @@
     PJSIP_DECL_HDR_MEMBER(struct pjsip_generic_int_hdr);
     /** ivalue */
-    pj_int32_t ivalue;
+    pj_uint32_t ivalue;
 } pjsip_generic_int_hdr;
 
@@ -1088,5 +1088,5 @@
 PJ_DECL(pjsip_generic_int_hdr*) pjsip_generic_int_hdr_create( pj_pool_t *pool,
 						      const pj_str_t *hname,
-						      int hvalue );
+						      unsigned hvalue );
 
 
@@ -1111,5 +1111,5 @@
 							    void *mem,
 							    const pj_str_t *hname,
-							    int value );
+							    unsigned value );
 
 /* **************************************************************************/
@@ -1350,4 +1350,8 @@
 
 /* **************************************************************************/
+
+/** Expires not specified. */
+#define PJSIP_EXPIRES_NOT_SPECIFIED	((pj_uint32_t)0xFFFFFFFFUL)
+
 /**
  * Contact header.
@@ -1359,9 +1363,14 @@
 {
     PJSIP_DECL_HDR_MEMBER(struct pjsip_contact_hdr);
-    int		    star;	    /**< The contact contains only a '*' character */
-    pjsip_uri	   *uri;	    /**< URI in the contact. */
-    int		    q1000;	    /**< The "q" value times 1000 (to avoid float) */
-    pj_int32_t	    expires;	    /**< Expires parameter, otherwise -1 if not present. */
-    pjsip_param	    other_param;    /**< Other parameters, concatenated in a single string. */
+    int		    star;	    /**< The contact contains only a '*'
+    					 character 			    */
+    pjsip_uri	   *uri;	    /**< URI in the contact. 		    */
+    int		    q1000;	    /**< The "q" value times 1000
+    					 (to avoid float) 		    */
+    pj_uint32_t	    expires;	    /**< Expires parameter, otherwise
+    					 PJSIP_EXPIRES_NOT_SPECIFIED
+    					 if not present. 		    */
+    pjsip_param	    other_param;    /**< Other parameters, concatenated in
+    					 a single string. 		    */
 } pjsip_contact_hdr;
 
@@ -1442,5 +1451,5 @@
  */
 PJ_DECL(pjsip_expires_hdr*) pjsip_expires_hdr_create( pj_pool_t *pool,
-						      int value);
+						      unsigned value);
 
 /**
@@ -1461,5 +1470,5 @@
 PJ_DECL(pjsip_expires_hdr*) pjsip_expires_hdr_init( pj_pool_t *pool,
 						    void *mem,
-						    int value );
+						    unsigned value );
 
 
@@ -1565,5 +1574,5 @@
  */
 PJ_DECL(pjsip_max_fwd_hdr*) 
-pjsip_max_fwd_hdr_create(pj_pool_t *pool, int value);
+pjsip_max_fwd_hdr_create(pj_pool_t *pool, unsigned value);
 
 
@@ -1584,5 +1593,5 @@
  */
 PJ_DECL(pjsip_max_fwd_hdr*) 
-pjsip_max_fwd_hdr_init( pj_pool_t *pool, void *mem, int value );
+pjsip_max_fwd_hdr_init( pj_pool_t *pool, void *mem, unsigned value );
 
 
@@ -1602,5 +1611,5 @@
  */
 PJ_DECL(pjsip_min_expires_hdr*) pjsip_min_expires_hdr_create(pj_pool_t *pool,
-							     int value);
+							     unsigned value);
 
 
@@ -1622,5 +1631,5 @@
 PJ_DECL(pjsip_min_expires_hdr*) pjsip_min_expires_hdr_init( pj_pool_t *pool,
 							    void *mem,
-							    int value );
+							    unsigned value );
 
 
Index: /pjproject/trunk/pjsip/include/pjsip/sip_parser.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsip/sip_parser.h	(revision 6034)
+++ /pjproject/trunk/pjsip/include/pjsip/sip_parser.h	(revision 6035)
@@ -53,5 +53,5 @@
 #define PJSIP_MAX_Q1000		    PJ_MAXINT32 / 1000
 #define PJSIP_MIN_EXPIRES	    0
-#define PJSIP_MAX_EXPIRES	    PJ_MAXINT32
+#define PJSIP_MAX_EXPIRES	    ((pj_uint32_t)0xFFFFFFFFUL)
 #define PJSIP_MIN_CSEQ		    0
 #define PJSIP_MAX_CSEQ		    PJ_MAXINT32
Index: /pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h	(revision 6034)
+++ /pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h	(revision 6035)
@@ -4177,7 +4177,8 @@
 
     /**
-     * An up to date expiration interval for account registration session.
-     */
-    int			expires;
+     * An up to date expiration interval for account registration session,
+     * PJSIP_EXPIRES_NOT_SPECIFIED if the account doesn't have reg session.
+     */
+    unsigned		expires;
 
     /**
Index: /pjproject/trunk/pjsip/include/pjsua-lib/pjsua_internal.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsua-lib/pjsua_internal.h	(revision 6034)
+++ /pjproject/trunk/pjsip/include/pjsua-lib/pjsua_internal.h	(revision 6035)
@@ -219,5 +219,7 @@
     int		     acc_id;	    /**< Account ID.			    */
     pjsip_dialog    *dlg;	    /**< Dialog.			    */
-    int		     expires;	    /**< "expires" value in the request.    */
+    unsigned	     expires;	    /**< "expires" value in the request,
+    					 PJSIP_EXPIRES_NOT_SPECIFIED
+    					 if not present.    		    */
 };
 
Index: /pjproject/trunk/pjsip/include/pjsua2/account.hpp
===================================================================
--- /pjproject/trunk/pjsip/include/pjsua2/account.hpp	(revision 6034)
+++ /pjproject/trunk/pjsip/include/pjsua2/account.hpp	(revision 6035)
@@ -1282,5 +1282,5 @@
      * An up to date expiration interval for account registration session.
      */
-    int			regExpiresSec;
+    unsigned		regExpiresSec;
 
     /**
@@ -1374,5 +1374,5 @@
      * Next expiration interval.
      */
-    int			expiration;
+    unsigned		expiration;
 };
 
Index: /pjproject/trunk/pjsip/src/pjsip-simple/evsub.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip-simple/evsub.c	(revision 6034)
+++ /pjproject/trunk/pjsip/src/pjsip-simple/evsub.c	(revision 6035)
@@ -500,5 +500,5 @@
  */
 static void set_timer( pjsip_evsub *sub, int timer_id,
-		       pj_int32_t seconds)
+		       pj_uint32_t seconds)
 {
     if (sub->timer.id != TIMER_TYPE_NONE) {
@@ -510,5 +510,6 @@
     }
 
-    if (timer_id != TIMER_TYPE_NONE && seconds > 0) {
+    if (timer_id != TIMER_TYPE_NONE && seconds != PJSIP_EXPIRES_NOT_SPECIFIED)
+    {
 	pj_time_val timeout;
 
@@ -1069,5 +1070,5 @@
 PJ_DEF(pj_status_t) pjsip_evsub_initiate( pjsip_evsub *sub,
 					  const pjsip_method *method,
-					  pj_int32_t expires,
+					  pj_uint32_t expires,
 					  pjsip_tx_data **p_tdata)
 {
@@ -1097,5 +1098,5 @@
 
     /* Update and add expires header: */
-    if (expires >= 0)
+    if (expires != PJSIP_EXPIRES_NOT_SPECIFIED)
 	sub->expires->ivalue = expires;
     pjsip_msg_add_hdr( tdata->msg, (pjsip_hdr*)
@@ -1997,9 +1998,9 @@
 	 */
 	if (sub->expires->ivalue != 0 &&
-	    sub_state->expires_param >= 0 &&
+	    sub_state->expires_param != PJSIP_EXPIRES_NOT_SPECIFIED &&
 	    (pj_stricmp(&sub_state->sub_state, &STR_ACTIVE)==0 ||
 	     pj_stricmp(&sub_state->sub_state, &STR_PENDING)==0))
 	{
-	    int next_refresh = sub_state->expires_param;
+	    unsigned next_refresh = sub_state->expires_param;
 	    unsigned timeout;
 
@@ -2100,5 +2101,5 @@
 	    evpkg = find_pkg(&event_hdr->event_type);
 	    if (evpkg) {
-		if (expires->ivalue < (pj_int32_t)evpkg->pkg_expires)
+		if (expires->ivalue < evpkg->pkg_expires)
 		    sub->expires->ivalue = expires->ivalue;
 		else
Index: /pjproject/trunk/pjsip/src/pjsip-simple/evsub_msg.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip-simple/evsub_msg.c	(revision 6034)
+++ /pjproject/trunk/pjsip/src/pjsip-simple/evsub_msg.c	(revision 6035)
@@ -150,5 +150,5 @@
     hdr->name = hdr->sname = sub_state;
     hdr->vptr = &sub_state_hdr_vptr;
-    hdr->expires_param = -1;
+    hdr->expires_param = PJSIP_EXPIRES_NOT_SPECIFIED;
     hdr->retry_after = -1;
     pj_list_init(hdr);
@@ -172,5 +172,5 @@
     copy_advance_pair_escape(p, ";reason=", 8, hdr->reason_param,
 			     pc->pjsip_TOKEN_SPEC);
-    if (hdr->expires_param >= 0) {
+    if (hdr->expires_param != PJSIP_EXPIRES_NOT_SPECIFIED) {
 	pj_memcpy(p, ";expires=", 9);
 	p += 9;
@@ -275,4 +275,6 @@
 	} else if (pj_stricmp(&pname, &expires) == 0) {
 	    hdr->expires_param = pj_strtoul(&pvalue);
+	    if (hdr->expires_param == PJSIP_EXPIRES_NOT_SPECIFIED)
+	    	hdr->expires_param--;
 
 	} else if (pj_stricmp(&pname, &retry_after) == 0) {
Index: /pjproject/trunk/pjsip/src/pjsip-simple/mwi.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip-simple/mwi.c	(revision 6034)
+++ /pjproject/trunk/pjsip/src/pjsip-simple/mwi.c	(revision 6035)
@@ -304,5 +304,5 @@
  */
 PJ_DEF(pj_status_t) pjsip_mwi_initiate( pjsip_evsub *sub,
-					pj_int32_t expires,
+					pj_uint32_t expires,
 					pjsip_tx_data **p_tdata)
 {
@@ -567,5 +567,5 @@
 	pjsip_tx_data *tdata;
 
-	status = pjsip_mwi_initiate(sub, -1, &tdata);
+	status = pjsip_mwi_initiate(sub, PJSIP_EXPIRES_NOT_SPECIFIED, &tdata);
 	if (status == PJ_SUCCESS)
 	    pjsip_mwi_send_request(sub, tdata);
Index: /pjproject/trunk/pjsip/src/pjsip-simple/presence.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip-simple/presence.c	(revision 6034)
+++ /pjproject/trunk/pjsip/src/pjsip-simple/presence.c	(revision 6035)
@@ -348,5 +348,5 @@
  */
 PJ_DEF(pj_status_t) pjsip_pres_initiate( pjsip_evsub *sub,
-					 pj_int32_t expires,
+					 pj_uint32_t expires,
 					 pjsip_tx_data **p_tdata)
 {
@@ -910,5 +910,6 @@
 	pjsip_tx_data *tdata;
 
-	status = pjsip_pres_initiate(sub, -1, &tdata);
+	status = pjsip_pres_initiate(sub, PJSIP_EXPIRES_NOT_SPECIFIED,
+				     &tdata);
 	if (status == PJ_SUCCESS)
 	    pjsip_pres_send_request(sub, tdata);
Index: /pjproject/trunk/pjsip/src/pjsip-simple/publishc.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip-simple/publishc.c	(revision 6034)
+++ /pjproject/trunk/pjsip/src/pjsip-simple/publishc.c	(revision 6035)
@@ -533,5 +533,5 @@
 static void call_callback(pjsip_publishc *pubc, pj_status_t status, 
 			  int st_code, const pj_str_t *reason,
-			  pjsip_rx_data *rdata, pj_int32_t expiration)
+			  pjsip_rx_data *rdata, pj_uint32_t expiration)
 {
     struct pjsip_publishc_cbparam cbparam;
@@ -563,5 +563,6 @@
 	char errmsg[PJ_ERR_MSG_SIZE];
 	pj_str_t reason = pj_strerror(status, errmsg, sizeof(errmsg));
-	call_callback(pubc, status, 400, &reason, NULL, -1);
+	call_callback(pubc, status, 400, &reason, NULL,
+		      PJSIP_PUBC_EXPIRATION_NOT_SPECIFIED);
 	return;
     }
@@ -605,5 +606,5 @@
 	    call_callback(pubc, status, tsx->status_code, 
 			  &rdata->msg_info.msg->line.status.reason,
-			  rdata, -1);
+			  rdata, PJSIP_PUBC_EXPIRATION_NOT_SPECIFIED);
 	} else {
     	    status = pjsip_publishc_send(pubc, tdata);
@@ -612,5 +613,5 @@
     } else {
 	pjsip_rx_data *rdata;
-	pj_int32_t expiration = 0xFFFF;
+	pj_uint32_t expiration = PJSIP_PUBC_EXPIRATION_NOT_SPECIFIED;
 
 	if (tsx->status_code/100 == 2) {
@@ -639,5 +640,7 @@
 		expiration = expires->ivalue;
 	    
-	    if (pubc->auto_refresh && expiration!=0 && expiration!=0xFFFF) {
+	    if (pubc->auto_refresh && expiration!=0 &&
+	    	expiration!=PJSIP_PUBC_EXPIRATION_NOT_SPECIFIED)
+	    {
 		pj_time_val delay = { 0, 0};
 
@@ -672,5 +675,5 @@
 
 	/* Call callback. */
-	if (expiration == 0xFFFF) expiration = -1;
+	// if (expiration == 0xFFFF) expiration = -1;
 
 	/* Temporarily increment pending_tsx to prevent callback from
Index: /pjproject/trunk/pjsip/src/pjsip-ua/sip_reg.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip-ua/sip_reg.c	(revision 6034)
+++ /pjproject/trunk/pjsip/src/pjsip-ua/sip_reg.c	(revision 6035)
@@ -46,5 +46,5 @@
 #define REGC_TSX_TIMEOUT	33000
 
-enum { NOEXP = 0x1FFFFFFF };
+enum { NOEXP = PJSIP_REGC_EXPIRATION_NOT_SPECIFIED };
 
 static const pj_str_t XUID_PARAM_NAME = { "x-uid", 5 };
@@ -740,5 +740,5 @@
                           pj_status_t status, int st_code, 
 			  const pj_str_t *reason,
-			  pjsip_rx_data *rdata, pj_int32_t expiration,
+			  pjsip_rx_data *rdata, pj_uint32_t expiration,
 			  int contact_cnt, pjsip_contact_hdr *contact[],
 			  pj_bool_t is_unreg)
@@ -751,6 +751,6 @@
     cbparam->rdata = rdata;
     cbparam->contact_cnt = contact_cnt;
-    cbparam->expiration = (expiration >= 0? expiration:
-          		   regc->expires_requested);
+    cbparam->expiration = (expiration != PJSIP_REGC_EXPIRATION_NOT_SPECIFIED?
+    			   expiration: regc->expires_requested);
     cbparam->is_unreg = is_unreg;
     if (contact_cnt) {
@@ -762,5 +762,5 @@
 static void call_callback(pjsip_regc *regc, pj_status_t status, int st_code, 
 			  const pj_str_t *reason,
-			  pjsip_rx_data *rdata, pj_int32_t expiration,
+			  pjsip_rx_data *rdata, pj_uint32_t expiration,
 			  int contact_cnt, pjsip_contact_hdr *contact[],
 			  pj_bool_t is_unreg)
@@ -799,5 +799,5 @@
 	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, NOEXP, 0, NULL,
 		      PJ_FALSE);
     }
@@ -809,7 +809,7 @@
 }
 
-static void schedule_registration ( pjsip_regc *regc, pj_int32_t expiration )
-{
-    if (regc->auto_reg && expiration > 0) {
+static void schedule_registration ( pjsip_regc *regc, pj_uint32_t expiration )
+{
+    if (regc->auto_reg && expiration > 0 && expiration != NOEXP) {
         pj_time_val delay = { 0, 0};
 
@@ -893,11 +893,11 @@
 
 
-static pj_int32_t calculate_response_expiration(const pjsip_regc *regc,
-					        const pjsip_rx_data *rdata,
-						unsigned *contact_cnt,
-						unsigned max_contact,
-						pjsip_contact_hdr *contacts[])
-{
-    pj_int32_t expiration = NOEXP;
+static pj_uint32_t calculate_response_expiration(const pjsip_regc *regc,
+					         const pjsip_rx_data *rdata,
+						 unsigned *contact_cnt,
+						 unsigned max_contact,
+						 pjsip_contact_hdr *contacts[])
+{
+    pj_uint32_t expiration = NOEXP;
     const pjsip_msg *msg = rdata->msg_info.msg;
     const pjsip_hdr *hdr;
@@ -983,6 +983,6 @@
 			has_our_contact = PJ_TRUE;
 
-			if (contacts[i]->expires >= 0 && 
-			    contacts[i]->expires < expiration) 
+			if (contacts[i]->expires != PJSIP_EXPIRES_NOT_SPECIFIED
+			    && contacts[i]->expires < expiration) 
 			{
 			    /* Get the lowest expiration time. */
@@ -1038,5 +1038,5 @@
 
 	    if (*contact_cnt == our_contact_cnt && *contact_cnt &&
-		contacts[0]->expires >= 0) 
+		contacts[0]->expires != PJSIP_EXPIRES_NOT_SPECIFIED) 
 	    {
 		expiration = contacts[0]->expires;
@@ -1098,5 +1098,5 @@
                      (event->body.tsx_state.type==PJSIP_EVENT_RX_MSG) ? 
 	              event->body.tsx_state.src.rdata : NULL,
-                     -1, 0, NULL, PJ_FALSE);
+                     NOEXP, 0, NULL, PJ_FALSE);
 
         /* Call regc tsx callback before handling any response */
@@ -1118,5 +1118,5 @@
                     pjsip_contact_hdr *next = h->next;
 
-                    if (h->expires == -1) {
+                    if (h->expires == PJSIP_EXPIRES_NOT_SPECIFIED) {
                         pj_list_erase(h);
                     }
@@ -1206,5 +1206,5 @@
 		call_callback(regc, status, tsx->status_code, 
 			      &rdata->msg_info.msg->line.status.reason,
-			      rdata, -1, 0, NULL, is_unreg);
+			      rdata, NOEXP, 0, NULL, is_unreg);
 		pj_lock_acquire(regc->lock);
 	    }
@@ -1233,5 +1233,5 @@
 	pjsip_min_expires_hdr *me_hdr;
 	pjsip_tx_data *tdata;
-	pj_int32_t min_exp;
+	pj_uint32_t min_exp;
 
 	/* reset current op */
@@ -1295,5 +1295,5 @@
 		call_callback(regc, status, tsx->status_code,
 			      &rdata->msg_info.msg->line.status.reason,
-			      rdata, -1, 0, NULL, PJ_FALSE);
+			      rdata, NOEXP, 0, NULL, PJ_FALSE);
 		pj_lock_acquire(regc->lock);
 	    }
@@ -1307,5 +1307,5 @@
     if (!handled) {
 	pjsip_rx_data *rdata;
-	pj_int32_t expiration = NOEXP;
+	pj_uint32_t expiration = NOEXP;
 	unsigned contact_cnt = 0;
 	pjsip_contact_hdr *contact[PJSIP_REGC_MAX_CONTACT];
@@ -1331,5 +1331,5 @@
 
 	/* Update registration */
-	if (expiration==NOEXP) expiration=-1;
+	// if (expiration==NOEXP) expiration=-1;
 	regc->expires = expiration;
 
Index: /pjproject/trunk/pjsip/src/pjsip-ua/sip_xfer.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip-ua/sip_xfer.c	(revision 6034)
+++ /pjproject/trunk/pjsip/src/pjsip-ua/sip_xfer.c	(revision 6035)
@@ -310,6 +310,6 @@
 
     /* Create basic REFER request */
-    status = pjsip_evsub_initiate(sub, pjsip_get_refer_method(), -1, 
-				  &tdata);
+    status = pjsip_evsub_initiate(sub, pjsip_get_refer_method(),
+    				  PJSIP_EXPIRES_NOT_SPECIFIED, &tdata);
     if (status != PJ_SUCCESS)
 	goto on_return;
Index: /pjproject/trunk/pjsip/src/pjsip/sip_msg.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_msg.c	(revision 6034)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_msg.c	(revision 6035)
@@ -814,5 +814,5 @@
 							    void *mem,
 							    const pj_str_t *hnames,
-							    int value)
+							    unsigned value)
 {
     pjsip_generic_int_hdr *hdr = (pjsip_generic_int_hdr*) mem;
@@ -829,5 +829,5 @@
 PJ_DEF(pjsip_generic_int_hdr*) pjsip_generic_int_hdr_create( pj_pool_t *pool,
 						     const pj_str_t *hnames,
-						     int value)
+						     unsigned value)
 {
     void *mem = pj_pool_alloc(pool, sizeof(pjsip_generic_int_hdr));
@@ -1196,5 +1196,5 @@
     pj_bzero(mem, sizeof(pjsip_contact_hdr));
     init_hdr(hdr, PJSIP_H_CONTACT, &contact_hdr_vptr);
-    hdr->expires = -1;
+    hdr->expires = PJSIP_EXPIRES_NOT_SPECIFIED;
     pj_list_init(&hdr->other_param);
     return hdr;
@@ -1264,5 +1264,5 @@
 	}
 
-	if (hdr->expires >= 0) {
+	if (hdr->expires != PJSIP_EXPIRES_NOT_SPECIFIED) {
 	    if (buf+23 >= endbuf)
 		return -1;
@@ -1423,5 +1423,5 @@
 PJ_DEF(pjsip_expires_hdr*) pjsip_expires_hdr_init( pj_pool_t *pool,
 						   void *mem,
-						   int value)
+						   unsigned value)
 {
     pjsip_expires_hdr *hdr = (pjsip_expires_hdr*) mem;
@@ -1436,5 +1436,5 @@
 
 PJ_DEF(pjsip_expires_hdr*) pjsip_expires_hdr_create( pj_pool_t *pool,
-						     int value )
+						     unsigned value )
 {
     void *mem = pj_pool_alloc(pool, sizeof(pjsip_expires_hdr));
@@ -1586,5 +1586,5 @@
 PJ_DEF(pjsip_max_fwd_hdr*) pjsip_max_fwd_hdr_init( pj_pool_t *pool,
 						   void *mem,
-						   int value)
+						   unsigned value)
 {
     pjsip_max_fwd_hdr *hdr = (pjsip_max_fwd_hdr*) mem;
@@ -1599,5 +1599,5 @@
 
 PJ_DEF(pjsip_max_fwd_hdr*) pjsip_max_fwd_hdr_create(pj_pool_t *pool,
-						    int value)
+						    unsigned value)
 {
     void *mem = pj_pool_alloc(pool, sizeof(pjsip_max_fwd_hdr));
@@ -1612,5 +1612,5 @@
 PJ_DEF(pjsip_min_expires_hdr*) pjsip_min_expires_hdr_init( pj_pool_t *pool,
 							   void *mem,
-							   int value )
+							   unsigned value )
 {
     pjsip_min_expires_hdr *hdr = (pjsip_min_expires_hdr*) mem;
@@ -1624,5 +1624,5 @@
 
 PJ_DEF(pjsip_min_expires_hdr*) pjsip_min_expires_hdr_create(pj_pool_t *pool,
-							    int value )
+							    unsigned value )
 {
     void *mem = pj_pool_alloc(pool, sizeof(pjsip_min_expires_hdr));
Index: /pjproject/trunk/pjsip/src/pjsip/sip_parser.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_parser.c	(revision 6034)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_parser.c	(revision 6035)
@@ -1886,6 +1886,11 @@
                    pvalue.slen) 
         {
-	    strtoi_validate(&pvalue, PJSIP_MIN_EXPIRES, PJSIP_MAX_EXPIRES,
-                            &hdr->expires);
+            hdr->expires = pj_strtoul(&pvalue);
+            if (hdr->expires == PJSIP_EXPIRES_NOT_SPECIFIED)
+        	hdr->expires--;
+            if (hdr->expires > PJSIP_MAX_EXPIRES)
+            	hdr->expires = PJSIP_MAX_EXPIRES;
+            if (hdr->expires < PJSIP_MIN_EXPIRES)
+            	hdr->expires = PJSIP_MIN_EXPIRES;
 	} else {
 	    pjsip_param *p = PJ_POOL_ALLOC_T(pool, pjsip_param);
Index: /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c	(revision 6034)
+++ /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c	(revision 6035)
@@ -2877,5 +2877,5 @@
 	info->expires = regc_info.next_reg;
     } else {
-	info->expires = -1;
+	info->expires = PJSIP_EXPIRES_NOT_SPECIFIED;
     }
 
Index: /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_pres.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_pres.c	(revision 6034)
+++ /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_pres.c	(revision 6035)
@@ -980,5 +980,5 @@
 	uapres->expires = expires_hdr->ivalue;
     else
-	uapres->expires = -1;
+	uapres->expires = PJSIP_EXPIRES_NOT_SPECIFIED;
 
     st_code = (pjsip_status_code)200;
@@ -1908,5 +1908,6 @@
     pjsip_evsub_set_mod_data(buddy->sub, pjsua_var.mod.id, buddy);
 
-    status = pjsip_pres_initiate(buddy->sub, -1, &tdata);
+    status = pjsip_pres_initiate(buddy->sub, PJSIP_EXPIRES_NOT_SPECIFIED,
+    				 &tdata);
     if (status != PJ_SUCCESS) {
 	if (buddy->dlg) pjsip_dlg_dec_lock(buddy->dlg);
Index: /pjproject/trunk/pjsip/src/test/regc_test.c
===================================================================
--- /pjproject/trunk/pjsip/src/test/regc_test.c	(revision 6034)
+++ /pjproject/trunk/pjsip/src/test/regc_test.c	(revision 6035)
@@ -217,5 +217,5 @@
     int		code;
     pj_bool_t	have_reg;
-    int		expiration;
+    unsigned	expiration;
     unsigned	contact_cnt;
     pj_bool_t	auth;
@@ -228,6 +228,6 @@
 
     /* Additional results */
-    int		interval;
-    int		next_reg;
+    unsigned	interval;
+    unsigned	next_reg;
 };
 
@@ -251,6 +251,7 @@
 	return;
 
-    client->have_reg = info.auto_reg && info.interval>0 &&
-		       param->expiration>0;
+    client->have_reg = info.auto_reg &&
+    		       info.interval != PJSIP_EXPIRES_NOT_SPECIFIED &&
+		       param->expiration != PJSIP_EXPIRES_NOT_SPECIFIED;
     client->expiration = param->expiration;
     client->contact_cnt = param->contact_cnt;
