Index: /pjproject/trunk/pjlib-util/src/pjlib-util/http_client.c
===================================================================
--- /pjproject/trunk/pjlib-util/src/pjlib-util/http_client.c	(revision 5700)
+++ /pjproject/trunk/pjlib-util/src/pjlib-util/http_client.c	(revision 5701)
@@ -931,7 +931,7 @@
          * officially supported
          */
-        PJ_ASSERT_RETURN(hreq->param.addr_family==PJ_AF_UNSPEC || 
-                         hreq->param.addr_family==PJ_AF_INET || 
-                         hreq->param.addr_family==PJ_AF_INET6, PJ_EAFNOTSUP);
+        PJ_ASSERT_RETURN(hreq->param.addr_family==pj_AF_UNSPEC() || 
+                         hreq->param.addr_family==pj_AF_INET() || 
+                         hreq->param.addr_family==pj_AF_INET6(), PJ_EAFNOTSUP);
         PJ_ASSERT_RETURN(!pj_strcmp2(&hreq->param.version, HTTP_1_0) || 
                          !pj_strcmp2(&hreq->param.version, HTTP_1_1), 
Index: /pjproject/trunk/pjlib/src/pj/string.c
===================================================================
--- /pjproject/trunk/pjlib/src/pj/string.c	(revision 5700)
+++ /pjproject/trunk/pjlib/src/pj/string.c	(revision 5701)
@@ -77,5 +77,5 @@
 
 
-PJ_DECL(pj_ssize_t) pj_strcspn2(const pj_str_t *str, const char *set_char)
+PJ_DEF(pj_ssize_t) pj_strcspn2(const pj_str_t *str, const char *set_char)
 {
     pj_ssize_t i, j;
@@ -115,5 +115,5 @@
 
 
-PJ_DECL(pj_ssize_t) pj_strtok2(const pj_str_t *str, const char *delim,
+PJ_DEF(pj_ssize_t) pj_strtok2(const pj_str_t *str, const char *delim,
 			       pj_str_t *tok, pj_size_t start_idx)
 {
Index: /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app_config.c
===================================================================
--- /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app_config.c	(revision 5700)
+++ /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app_config.c	(revision 5701)
@@ -821,9 +821,8 @@
 	    /* enable compact form - from Ticket #342 */
             {
-		extern pj_bool_t pjsip_use_compact_form;
 		extern pj_bool_t pjsip_include_allow_hdr_in_dlg;
 		extern pj_bool_t pjmedia_add_rtpmap_for_static_pt;
 
-		pjsip_use_compact_form = PJ_TRUE;
+		pjsip_cfg()->endpt.use_compact_form = PJ_TRUE;
 		/* do not transmit Allow header */
 		pjsip_include_allow_hdr_in_dlg = PJ_FALSE;
@@ -1748,5 +1747,4 @@
     pj_str_t cfg;
     char line[128];
-    extern pj_bool_t pjsip_use_compact_form;
 
     PJ_UNUSED_ARG(max);
@@ -2148,5 +2146,5 @@
     }
 
-    if (pjsip_use_compact_form)
+    if (pjsip_cfg()->endpt.use_compact_form)
     {
 	pj_strcat2(&cfg, "--use-compact-form\n");
Index: /pjproject/trunk/pjsip/include/pjsip/sip_config.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsip/sip_config.h	(revision 5700)
+++ /pjproject/trunk/pjsip/include/pjsip/sip_config.h	(revision 5701)
@@ -158,4 +158,17 @@
 	pj_bool_t disable_secure_dlg_check;
 
+	/**
+	 * Encode SIP headers in their short forms to reduce size. By default,
+	 * SIP headers in outgoing messages will be encoded in their full names.
+	 * If this option is enabled, then SIP headers for outgoing messages
+	 * will be encoded in their short forms, to reduce message size. 
+	 * Note that this does not affect the ability of PJSIP to parse incoming
+	 * SIP messages, as the parser always supports parsing both the long
+	 * and short version of the headers.
+	 *
+	 * Default is PJSIP_ENCODE_SHORT_HNAME
+	 */
+	pj_bool_t use_compact_form;
+
     } endpt;
 
@@ -465,16 +478,6 @@
  * and short version of the headers.
  *
- * Note that there is also an undocumented variable defined in sip_msg.c
- * to control whether compact form should be used for encoding SIP
- * headers. The default value of this variable is PJSIP_ENCODE_SHORT_HNAME.
- * To change PJSIP behavior during run-time, application can use the 
- * following construct:
- *
- \verbatim
-   extern pj_bool_t pjsip_use_compact_form;
- 
-   // enable compact form
-   pjsip_use_compact_form = PJ_TRUE;
- \endverbatim
+ * This option can also be controlled at run-time by the
+ * \a use_compact_form setting in pjsip_cfg_t.
  *
  * Default is 0 (no)
Index: /pjproject/trunk/pjsip/src/pjsip-simple/presence_body.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip-simple/presence_body.c	(revision 5700)
+++ /pjproject/trunk/pjsip/src/pjsip-simple/presence_body.c	(revision 5701)
@@ -87,5 +87,5 @@
 	    /* xs:ID must start with letter */
 	    //pj_create_unique_string(pool, &id);
-	    id.ptr = (char*)pj_pool_alloc(pool, PJ_GUID_STRING_LENGTH+2);
+	    id.ptr = (char*)pj_pool_alloc(pool, pj_GUID_STRING_LENGTH()+2);
 	    id.ptr += 2;
 	    pj_generate_unique_string(&id);
Index: /pjproject/trunk/pjsip/src/pjsip-simple/rpid.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip-simple/rpid.c	(revision 5700)
+++ /pjproject/trunk/pjsip/src/pjsip-simple/rpid.c	(revision 5701)
@@ -150,5 +150,5 @@
 	/* xs:ID must start with letter */
 	//pj_create_unique_string(pool, &person_id);
-	person_id.ptr = (char*)pj_pool_alloc(pool, PJ_GUID_STRING_LENGTH+2);
+	person_id.ptr = (char*)pj_pool_alloc(pool, pj_GUID_STRING_LENGTH()+2);
 	person_id.ptr += 2;
 	pj_generate_unique_string(&person_id);
Index: /pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c	(revision 5700)
+++ /pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c	(revision 5701)
@@ -4665,5 +4665,5 @@
     } else if (tsx->role == PJSIP_ROLE_UAS &&
 	       tsx->state == PJSIP_TSX_STATE_TRYING &&
-	       pjsip_method_cmp(&tsx->method, &pjsip_invite_method)==0)
+	       pjsip_method_cmp(&tsx->method, pjsip_get_invite_method())==0)
     {
 	pjsip_rx_data *rdata = e->body.tsx_state.src.rdata;
Index: /pjproject/trunk/pjsip/src/pjsip-ua/sip_timer.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip-ua/sip_timer.c	(revision 5700)
+++ /pjproject/trunk/pjsip/src/pjsip-ua/sip_timer.c	(revision 5701)
@@ -71,7 +71,4 @@
 };
 
-/* External global vars */
-extern pj_bool_t pjsip_use_compact_form;
-
 /* Local functions & vars */
 static void stop_timer(pjsip_inv_session *inv);
@@ -125,5 +122,6 @@
     pj_ssize_t printed;
     const pjsip_parser_const_t *pc = pjsip_parser_const();
-    const pj_str_t *hname = pjsip_use_compact_form? &hdr->sname : &hdr->name;
+    const pj_str_t *hname = pjsip_cfg()->endpt.use_compact_form? 
+			    &hdr->sname : &hdr->name;
 
     /* Print header name and value */
Index: /pjproject/trunk/pjsip/src/pjsip/sip_config.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_config.c	(revision 5700)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_config.c	(revision 5701)
@@ -35,5 +35,6 @@
        PJSIP_REQ_HAS_VIA_ALIAS,
        PJSIP_RESOLVE_HOSTNAME_TO_GET_INTERFACE,
-       0
+       0,
+       PJSIP_ENCODE_SHORT_HNAME
     },
 
Index: /pjproject/trunk/pjsip/src/pjsip/sip_msg.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_msg.c	(revision 5700)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_msg.c	(revision 5701)
@@ -145,6 +145,4 @@
 };
 
-pj_bool_t pjsip_use_compact_form = PJSIP_ENCODE_SHORT_HNAME;
-
 static pj_str_t status_phrase[710];
 static int print_media_type(char *buf, unsigned len,
@@ -404,5 +402,5 @@
     pj_str_t clen_hdr =  { "Content-Length: ", 16};
 
-    if (pjsip_use_compact_form) {
+    if (pjsip_cfg()->endpt.use_compact_form) {
 	clen_hdr.ptr = "l: ";
 	clen_hdr.slen = 3;
@@ -487,5 +485,5 @@
 	    const pjsip_media_type *media = &msg->body->content_type;
 
-	    if (pjsip_use_compact_form) {
+	    if (pjsip_cfg()->endpt.use_compact_form) {
 		ctype_hdr.ptr = "c: ";
 		ctype_hdr.slen = 3;
@@ -750,5 +748,6 @@
 {
     char *p = buf;
-    const pj_str_t *hname = pjsip_use_compact_form? &hdr->sname : &hdr->name;
+    const pj_str_t *hname = pjsip_cfg()->endpt.use_compact_form? 
+			    &hdr->sname : &hdr->name;
     
     if ((pj_ssize_t)size < hname->slen + hdr->hvalue.slen + 5)
@@ -833,5 +832,6 @@
 {
     char *p = buf;
-    const pj_str_t *hname = pjsip_use_compact_form? &hdr->sname : &hdr->name;
+    const pj_str_t *hname = pjsip_cfg()->endpt.use_compact_form? 
+			    &hdr->sname : &hdr->name;
 
     if ((pj_ssize_t)size < hname->slen + 15)
@@ -909,5 +909,6 @@
 {
     char *p = buf, *endbuf = buf+size;
-    const pj_str_t *hname = pjsip_use_compact_form? &hdr->sname : &hdr->name;
+    const pj_str_t *hname = pjsip_cfg()->endpt.use_compact_form? 
+			    &hdr->sname : &hdr->name;
 
     copy_advance(p, (*hname));
@@ -1058,5 +1059,6 @@
     char *p = buf;
     int len;
-    const pj_str_t *hname = pjsip_use_compact_form? &hdr->sname : &hdr->name;
+    const pj_str_t *hname = pjsip_cfg()->endpt.use_compact_form? 
+			    &hdr->sname : &hdr->name;
 
     if ((pj_ssize_t)size < hname->slen + 14)
@@ -1201,5 +1203,6 @@
 				    pj_size_t size)
 {
-    const pj_str_t *hname = pjsip_use_compact_form? &hdr->sname : &hdr->name;
+    const pj_str_t *hname = pjsip_cfg()->endpt.use_compact_form? 
+			    &hdr->sname : &hdr->name;
     const pjsip_parser_const_t *pc = pjsip_parser_const();
 
@@ -1375,5 +1378,6 @@
     char *p = buf;
     int len;
-    const pj_str_t *hname = pjsip_use_compact_form? &hdr->sname : &hdr->name;
+    const pj_str_t *hname = pjsip_cfg()->endpt.use_compact_form? 
+			    &hdr->sname : &hdr->name;
 
     if ((pj_ssize_t)size < hname->slen + 
@@ -1515,5 +1519,6 @@
     char *startbuf = buf;
     char *endbuf = buf + size;
-    const pj_str_t *hname = pjsip_use_compact_form? &hdr->sname : &hdr->name;
+    const pj_str_t *hname = pjsip_cfg()->endpt.use_compact_form? 
+			    &hdr->sname : &hdr->name;
     const pjsip_parser_const_t *pc = pjsip_parser_const();
 
@@ -1985,5 +1990,6 @@
     char *endbuf = buf + size;
     pj_str_t sip_ver = { "SIP/2.0/", 8 };
-    const pj_str_t *hname = pjsip_use_compact_form? &hdr->sname : &hdr->name;
+    const pj_str_t *hname = pjsip_cfg()->endpt.use_compact_form? 
+			    &hdr->sname : &hdr->name;
     const pjsip_parser_const_t *pc = pjsip_parser_const();
 
Index: /pjproject/trunk/pjsip/src/pjsip/sip_multipart.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_multipart.c	(revision 5700)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_multipart.c	(revision 5701)
@@ -39,6 +39,4 @@
 #endif
 
-extern pj_bool_t pjsip_use_compact_form;
-
 /* Type of "data" in multipart pjsip_msg_body */
 struct multipart_data
@@ -106,5 +104,5 @@
 	    const pjsip_media_type *media = &part->body->content_type;
 
-	    if (pjsip_use_compact_form) {
+	    if (pjsip_cfg()->endpt.use_compact_form) {
 		ctype_hdr.ptr = "c: ";
 		ctype_hdr.slen = 3;
Index: /pjproject/trunk/pjsip/src/pjsip/sip_transport.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_transport.c	(revision 5700)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_transport.c	(revision 5701)
@@ -1424,5 +1424,5 @@
     pj_status_t status = -1;
 
-    af = (tp_type & PJSIP_TRANSPORT_IPV6)? PJ_AF_INET6 : PJ_AF_INET;
+    af = (tp_type & PJSIP_TRANSPORT_IPV6)? pj_AF_INET6() : pj_AF_INET();
 
     if (pjsip_cfg()->endpt.resolve_hostname_to_get_interface) {
Index: /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c	(revision 5700)
+++ /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c	(revision 5701)
@@ -3873,5 +3873,5 @@
 
 	/* Disconnect the call */
-	status = pjsip_dlg_create_request(forked_dlg, &pjsip_bye_method,
+	status = pjsip_dlg_create_request(forked_dlg, pjsip_get_bye_method(),
 					  -1, &bye);
 	if (status == PJ_SUCCESS) {
@@ -4499,5 +4499,5 @@
 	    pjsip_tx_data *tdata;
 
-	    status = pjsip_evsub_initiate(sub, &pjsip_subscribe_method,
+	    status = pjsip_evsub_initiate(sub, pjsip_get_subscribe_method(),
 					  0, &tdata);
 	    if (status == PJ_SUCCESS)
@@ -4892,5 +4892,5 @@
 	}
     } else if (tsx->role == PJSIP_ROLE_UAC &&
-               pjsip_method_cmp(&tsx->method, &pjsip_invite_method)==0 &&
+               pjsip_method_cmp(&tsx->method, pjsip_get_invite_method())==0 &&
                tsx->state >= PJSIP_TSX_STATE_COMPLETED &&
 	       e->body.tsx_state.prev_state < PJSIP_TSX_STATE_COMPLETED &&
Index: /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_pres.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_pres.c	(revision 5700)
+++ /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_pres.c	(revision 5701)
@@ -1578,5 +1578,5 @@
 		const pjsip_transaction *tsx = event->body.tsx_state.tsx;
 		if (pjsip_method_cmp(&tsx->method, 
-				     &pjsip_subscribe_method)==0)
+				     pjsip_get_subscribe_method())==0)
 		{
 		    buddy->term_code = tsx->status_code;
@@ -1597,5 +1597,5 @@
 		    }
 		} else if (pjsip_method_cmp(&tsx->method,
-					    &pjsip_notify_method)==0)
+					    pjsip_get_notify_method())==0)
 		{
 		    if (pj_stricmp2(&buddy->term_reason, "deactivated")==0 ||
@@ -2276,5 +2276,6 @@
     pjsip_event_hdr *eh;
 
-    if (pjsip_method_cmp(&msg->line.req.method, &pjsip_notify_method)!=0) {
+    if (pjsip_method_cmp(&msg->line.req.method, pjsip_get_notify_method())!=0) 
+    {
 	/* Only interested with NOTIFY request */
 	return PJ_FALSE;
