summaryrefslogtreecommitdiff
path: root/pjsip
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2009-08-04 14:36:17 +0000
committerNanang Izzuddin <nanang@teluu.com>2009-08-04 14:36:17 +0000
commit78b3a41d1e054c7cd2f29ff66b3aef258ab87010 (patch)
treeec81d53b019eec13aafcbdf79345f2a266d33f3d /pjsip
parent09ac78ac7c6694d8551de50d6ca135e95e4921da (diff)
Ticket #930:
- Changed semantic of pjsua_acc_config.contact_params, it is now used for specifying Contact header parameters (it was used for specifying Contact URI parameters). - Added a new field pjsua_acc_config.contact_uri_params, for specifying Contact URI parameters. - Added fields pjsua_acc_config.contact_params and pjsua_acc_config.contact_uri_params into python pjsua. - Updated/added option in pjsua app to specify Contact header parameters and Contact URI parameters. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2852 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r--pjsip/include/pjsua-lib/pjsua.h14
-rw-r--r--pjsip/src/pjsua-lib/pjsua_acc.c12
2 files changed, 22 insertions, 4 deletions
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h
index 1ea6f9e4..023acb6b 100644
--- a/pjsip/include/pjsua-lib/pjsua.h
+++ b/pjsip/include/pjsua-lib/pjsua.h
@@ -1666,7 +1666,7 @@ typedef struct pjsua_acc_config
pj_str_t force_contact;
/**
- * Additional URI parameters that will be appended in the Contact header
+ * Additional parameters that will be appended in the Contact header
* for this account. This will affect the Contact header in all SIP
* messages sent on behalf of this account, including but not limited to
* REGISTER, INVITE, and SUBCRIBE requests or responses.
@@ -1678,6 +1678,18 @@ typedef struct pjsua_acc_config
pj_str_t contact_params;
/**
+ * Additional URI parameters that will be appended in the Contact URI
+ * for this account. This will affect the Contact URI in all SIP
+ * messages sent on behalf of this account, including but not limited to
+ * REGISTER, INVITE, and SUBCRIBE requests or responses.
+ *
+ * The parameters should be preceeded by semicolon, and all strings must
+ * be properly escaped. Example:
+ * ";my-param=X;another-param=Hi%20there"
+ */
+ pj_str_t contact_uri_params;
+
+ /**
* Specify whether support for reliable provisional response (100rel and
* PRACK) should be required for all sessions of this account.
*
diff --git a/pjsip/src/pjsua-lib/pjsua_acc.c b/pjsip/src/pjsua-lib/pjsua_acc.c
index 5bfa5f04..05cedf49 100644
--- a/pjsip/src/pjsua-lib/pjsua_acc.c
+++ b/pjsip/src/pjsua-lib/pjsua_acc.c
@@ -712,7 +712,7 @@ 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;transport=%s%.*s>",
+ "<sip:%.*s%s%s%.*s%s:%d;transport=%s%.*s>%.*s",
(int)acc->user_part.slen,
acc->user_part.ptr,
(acc->user_part.slen? "@" : ""),
@@ -722,6 +722,8 @@ static pj_bool_t acc_check_nat_addr(pjsua_acc *acc,
endquote,
rport,
tp->type_name,
+ (int)acc->cfg.contact_uri_params.slen,
+ acc->cfg.contact_uri_params.ptr,
(int)acc->cfg.contact_params.slen,
acc->cfg.contact_params.ptr);
if (len < 1) {
@@ -1698,7 +1700,7 @@ PJ_DEF(pj_status_t) pjsua_acc_create_uac_contact( pj_pool_t *pool,
/* Create the contact header */
contact->ptr = (char*)pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE);
contact->slen = pj_ansi_snprintf(contact->ptr, PJSIP_MAX_URL_SIZE,
- "%.*s%s<%s:%.*s%s%s%.*s%s:%d%s%.*s>",
+ "%.*s%s<%s:%.*s%s%s%.*s%s:%d%s%.*s>%.*s",
(int)acc->display.slen,
acc->display.ptr,
(acc->display.slen?" " : ""),
@@ -1712,6 +1714,8 @@ PJ_DEF(pj_status_t) pjsua_acc_create_uac_contact( pj_pool_t *pool,
endquote,
local_port,
transport_param,
+ (int)acc->cfg.contact_uri_params.slen,
+ acc->cfg.contact_uri_params.ptr,
(int)acc->cfg.contact_params.slen,
acc->cfg.contact_params.ptr);
@@ -1850,7 +1854,7 @@ PJ_DEF(pj_status_t) pjsua_acc_create_uas_contact( pj_pool_t *pool,
/* Create the contact header */
contact->ptr = (char*) pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE);
contact->slen = pj_ansi_snprintf(contact->ptr, PJSIP_MAX_URL_SIZE,
- "%.*s%s<%s:%.*s%s%s%.*s%s:%d%s%.*s>",
+ "%.*s%s<%s:%.*s%s%s%.*s%s:%d%s%.*s>%.*s",
(int)acc->display.slen,
acc->display.ptr,
(acc->display.slen?" " : ""),
@@ -1864,6 +1868,8 @@ PJ_DEF(pj_status_t) pjsua_acc_create_uas_contact( pj_pool_t *pool,
endquote,
local_port,
transport_param,
+ (int)acc->cfg.contact_uri_params.slen,
+ acc->cfg.contact_uri_params.ptr,
(int)acc->cfg.contact_params.slen,
acc->cfg.contact_params.ptr);