Index: /pjproject/trunk/pjsip/include/pjsip/sip_auth_msg.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsip/sip_auth_msg.h	(revision 5882)
+++ /pjproject/trunk/pjsip/include/pjsip/sip_auth_msg.h	(revision 5883)
@@ -90,4 +90,21 @@
 
 /**
+ * This structure describe credential used in Authorization and
+ * Proxy-Authorization header for OAuth authentication scheme.
+ */
+struct pjsip_oauth_credential
+{
+    pj_str_t    realm;          /**< Realm of the credential    */
+    pjsip_param other_param;    /**< Other parameters.          */
+    pj_str_t    username;       /**< Username parameter.        */
+    pj_str_t    token;          /**< Token parameter.           */
+};
+
+/**
+ * @see pjsip_oauth_credential
+ */
+typedef struct pjsip_oauth_credential pjsip_oauth_credential;
+
+/**
  * This structure describes SIP Authorization header (and also SIP
  * Proxy-Authorization header).
@@ -107,4 +124,5 @@
 	pjsip_digest_credential digest;	/**< Digest credentials.    */
 	pjsip_pgp_credential	pgp;	/**< PGP credentials.	    */
+	pjsip_oauth_credential  oauth;  /**< OAuth credentials.     */
     } credential;
 };
Index: /pjproject/trunk/pjsip/include/pjsip/sip_auth_parser.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsip/sip_auth_parser.h	(revision 5882)
+++ /pjproject/trunk/pjsip/include/pjsip/sip_auth_parser.h	(revision 5883)
@@ -65,4 +65,5 @@
 			pjsip_DIGEST_STR,   /**< "digest" string const.	    */
 			pjsip_PGP_STR,	    /**< "pgp" string const.	    */
+			pjsip_BEARER_STR,   /**< "bearer" string const.     */
 			pjsip_MD5_STR,	    /**< "md5" string const.	    */
 			pjsip_AUTH_STR;	    /**< "auth" string const.	    */
Index: /pjproject/trunk/pjsip/src/pjsip/sip_auth_client.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_auth_client.c	(revision 5882)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_auth_client.c	(revision 5883)
@@ -960,11 +960,20 @@
 		hs = pjsip_authorization_hdr_create(tdata->pool);
 		pj_strdup(tdata->pool, &hs->scheme, &c->scheme);
-		pj_strdup(tdata->pool, &hs->credential.digest.username,
-			  &c->username);
-		pj_strdup(tdata->pool, &hs->credential.digest.realm,
-			  &c->realm);
-		pj_strdup(tdata->pool, &hs->credential.digest.uri, &uri);
-		pj_strdup(tdata->pool, &hs->credential.digest.algorithm,
-			  &sess->pref.algorithm);
+		if (pj_stricmp(&c->scheme, &pjsip_BEARER_STR)==0) {
+			pj_strdup(tdata->pool, &hs->credential.oauth.username,
+                                  &c->username);
+                        pj_strdup(tdata->pool, &hs->credential.oauth.realm,
+                                  &c->realm);
+                        pj_strdup(tdata->pool, &hs->credential.oauth.token,
+                                  &c->data);
+		} else { //if (pj_stricmp(&c->scheme, &pjsip_DIGEST_STR)==0)
+			pj_strdup(tdata->pool, &hs->credential.digest.username,
+				  &c->username);
+			pj_strdup(tdata->pool, &hs->credential.digest.realm,
+				  &c->realm);
+			pj_strdup(tdata->pool,&hs->credential.digest.uri, &uri);
+			pj_strdup(tdata->pool, &hs->credential.digest.algorithm,
+			  	  &sess->pref.algorithm);
+		}
 
 		pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)hs);
Index: /pjproject/trunk/pjsip/src/pjsip/sip_auth_msg.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_auth_msg.c	(revision 5882)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_auth_msg.c	(revision 5883)
@@ -104,4 +104,21 @@
 }
 
+static int print_oauth_credential(pjsip_oauth_credential *cred, char *buf,
+				  pj_size_t size)
+{
+    pj_ssize_t printed;
+    char *startbuf = buf;
+    char *endbuf = buf + size;
+
+    copy_advance_pair_quote_cond_always(buf, "token=", 6, cred->token,
+    					'"', '"');
+    copy_advance_pair_quote_cond_always(buf, ", username=", 11, cred->username,
+    					'"', '"');
+    copy_advance_pair_quote_cond_always(buf, ", realm=", 8, cred->realm,
+    					'"', '"');
+
+    return (int) (buf-startbuf);
+}
+
 static int pjsip_authorization_hdr_print( pjsip_authorization_hdr *hdr,
 					  char *buf, pj_size_t size)
@@ -126,4 +143,9 @@
 	printed = print_pgp_credential(&hdr->credential.pgp, buf, endbuf - buf);
     } 
+    else if (pj_stricmp(&hdr->scheme, &pjsip_BEARER_STR) == 0)
+    {
+        printed = print_oauth_credential(&hdr->credential.oauth, buf,
+        				 endbuf - buf);
+    }
     else {
 	pj_assert(0);
Index: /pjproject/trunk/pjsip/src/pjsip/sip_auth_parser.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_auth_parser.c	(revision 5882)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_auth_parser.c	(revision 5883)
@@ -60,4 +60,5 @@
 		pjsip_PGP_STR =		    { "PGP", 3 },
 		pjsip_QUOTED_PGP_STR =	    { "\"PGP\"", 5 },
+		pjsip_BEARER_STR =          { "Bearer", 6 },
 		pjsip_MD5_STR =		    { "md5", 3 },
 		pjsip_QUOTED_MD5_STR =	    { "\"md5\"", 5},
