summaryrefslogtreecommitdiff
path: root/pjsip
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2013-09-06 10:04:39 +0000
committerNanang Izzuddin <nanang@teluu.com>2013-09-06 10:04:39 +0000
commit65f8e930c65b43912d7db6b728538e371b0ecc41 (patch)
tree4e102139cb80b6a500baec31be69f1f10789249e /pjsip
parenta190a7c679e04645e8c76e8c15729302ed22efa8 (diff)
Fixed #1698: Follow account config in generating contact's secure scheme and deprecate PJSUA_SECURE_SCHEME.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4592 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r--pjsip/include/pjsua-lib/pjsua.h10
-rw-r--r--pjsip/include/pjsua-lib/pjsua_internal.h1
-rw-r--r--pjsip/src/pjsua-lib/pjsua_acc.c13
3 files changed, 11 insertions, 13 deletions
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h
index beb0762e..be5b08e8 100644
--- a/pjsip/include/pjsua-lib/pjsua.h
+++ b/pjsip/include/pjsua-lib/pjsua.h
@@ -2534,16 +2534,6 @@ PJ_DECL(pj_status_t) pjsua_transport_close( pjsua_transport_id id,
/**
- * This macro specifies the URI scheme to use in Contact header
- * when secure transport such as TLS is used. Application can specify
- * either "sip" or "sips".
- */
-#ifndef PJSUA_SECURE_SCHEME
-# define PJSUA_SECURE_SCHEME "sip"
-#endif
-
-
-/**
* Maximum time to wait for unpublication transaction(s) to complete
* during shutdown process, before sending unregistration. The library
* tries to wait for the unpublication (un-PUBLISH) to complete before
diff --git a/pjsip/include/pjsua-lib/pjsua_internal.h b/pjsip/include/pjsua-lib/pjsua_internal.h
index d70506eb..dcf50209 100644
--- a/pjsip/include/pjsua-lib/pjsua_internal.h
+++ b/pjsip/include/pjsua-lib/pjsua_internal.h
@@ -214,6 +214,7 @@ typedef struct pjsua_acc
int index; /**< Index in accounts array. */
pj_str_t display; /**< Display name, if any. */
pj_str_t user_part; /**< User part of local URI. */
+ pj_bool_t is_sips; /**< Local URI uses "sips"? */
pj_str_t contact; /**< Our Contact header. */
pj_str_t reg_contact; /**< Contact header for REGISTER.
It may be different than acc
diff --git a/pjsip/src/pjsua-lib/pjsua_acc.c b/pjsip/src/pjsua-lib/pjsua_acc.c
index 328d41e6..77d9a12c 100644
--- a/pjsip/src/pjsua-lib/pjsua_acc.c
+++ b/pjsip/src/pjsua-lib/pjsua_acc.c
@@ -201,6 +201,7 @@ static pj_status_t initialize_acc(unsigned acc_id)
acc->srv_domain = sip_uri->host;
acc->srv_port = 0;
}
+ acc->is_sips = PJSIP_URI_SCHEME_IS_SIPS(name_addr);
/* Parse registrar URI, if any */
@@ -911,6 +912,7 @@ PJ_DEF(pj_status_t) pjsua_acc_modify( pjsua_acc_id acc_id,
pj_strdup_with_null(acc->pool, &acc->user_part, &id_sip_uri->user);
pj_strdup_with_null(acc->pool, &acc->srv_domain, &id_sip_uri->host);
acc->srv_port = 0;
+ acc->is_sips = PJSIP_URI_SCHEME_IS_SIPS(id_name_addr);
update_reg = PJ_TRUE;
unreg_first = PJ_TRUE;
}
@@ -1704,6 +1706,10 @@ static pj_bool_t acc_check_nat_addr(pjsua_acc *acc,
const char *beginquote, *endquote;
char transport_param[32];
int len;
+ pj_bool_t secure;
+
+ secure = pjsip_transport_get_flag_from_type(tp->key.type) &
+ PJSIP_TRANSPORT_SECURE;
/* Enclose IPv6 address in square brackets */
if (tp->key.type & PJSIP_TRANSPORT_IPV6) {
@@ -1727,7 +1733,8 @@ static pj_bool_t acc_check_nat_addr(pjsua_acc *acc,
tmp = (char*) pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE);
len = pj_ansi_snprintf(tmp, PJSIP_MAX_URL_SIZE,
- "<sip:%.*s%s%s%.*s%s:%d%s%.*s%s>%.*s",
+ "<%s:%.*s%s%s%.*s%s:%d%s%.*s%s>%.*s",
+ ((secure && acc->is_sips)? "sips" : "sip"),
(int)acc->user_part.slen,
acc->user_part.ptr,
(acc->user_part.slen? "@" : ""),
@@ -3079,7 +3086,7 @@ PJ_DEF(pj_status_t) pjsua_acc_create_uac_contact( pj_pool_t *pool,
(int)acc->display.slen,
acc->display.ptr,
(acc->display.slen?"\" " : ""),
- (secure ? PJSUA_SECURE_SCHEME : "sip"),
+ ((secure && acc->is_sips)? "sips" : "sip"),
(int)acc->user_part.slen,
acc->user_part.ptr,
(acc->user_part.slen?"@":""),
@@ -3250,7 +3257,7 @@ PJ_DEF(pj_status_t) pjsua_acc_create_uas_contact( pj_pool_t *pool,
(int)acc->display.slen,
acc->display.ptr,
(acc->display.slen?"\" " : ""),
- (secure ? PJSUA_SECURE_SCHEME : "sip"),
+ ((secure && acc->is_sips)? "sips" : "sip"),
(int)acc->user_part.slen,
acc->user_part.ptr,
(acc->user_part.slen?"@":""),