diff options
Diffstat (limited to 'pjsip')
-rw-r--r-- | pjsip/include/pjsua-lib/pjsua.h | 14 | ||||
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_acc.c | 12 |
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); |