diff options
author | Benny Prijono <bennylp@teluu.com> | 2014-08-18 09:09:18 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2014-08-18 09:09:18 +0000 |
commit | 84f301467161a490a4df3ebb3664a4a67c3056e2 (patch) | |
tree | 4d83e1b9d3b8163f9538aed6acf9a2e9079e0201 /pjsip | |
parent | c38c8101be49bb4cb9cf95815f0c2ce955876c3b (diff) |
More re #1677:
- renamed the option to contact_use_src_port
- added the missing pjsua2 API implementation
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4889 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r-- | pjsip/include/pjsua-lib/pjsua.h | 2 | ||||
-rw-r--r-- | pjsip/include/pjsua2/account.hpp | 13 | ||||
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_acc.c | 2 | ||||
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_core.c | 2 | ||||
-rw-r--r-- | pjsip/src/pjsua2/account.cpp | 4 |
5 files changed, 20 insertions, 3 deletions
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h index d83b05f8..0787d416 100644 --- a/pjsip/include/pjsua-lib/pjsua.h +++ b/pjsip/include/pjsua-lib/pjsua.h @@ -3065,7 +3065,7 @@ typedef struct pjsua_acc_config * * Default: PJ_TRUE (yes). */ - pj_bool_t contact_rewrite_use_src_port; + pj_bool_t contact_use_src_port; /** * This option is used to overwrite the "sent-by" field of the Via header diff --git a/pjsip/include/pjsua2/account.hpp b/pjsip/include/pjsua2/account.hpp index 2a7199f2..6452ad52 100644 --- a/pjsip/include/pjsua2/account.hpp +++ b/pjsip/include/pjsua2/account.hpp @@ -561,6 +561,19 @@ struct AccountNatConfig : public PersistentObject int contactRewriteMethod; /** + * Specify if source TCP port should be used as the initial Contact + * address if TCP/TLS transport is used. Note that this feature will + * be automatically turned off when nameserver is configured because + * it may yield different destination address due to DNS SRV resolution. + * Also some platforms are unable to report the local address of the + * TCP socket when it is still connecting. In these cases, this + * feature will also be turned off. + * + * Default: 1 (yes). + */ + int contactUseSrcPort; + + /** * This option is used to overwrite the "sent-by" field of the Via header * for outgoing messages with the same interface address as the one in * the REGISTER request, as long as the request uses the same transport diff --git a/pjsip/src/pjsua-lib/pjsua_acc.c b/pjsip/src/pjsua-lib/pjsua_acc.c index dbdb698c..996335fa 100644 --- a/pjsip/src/pjsua-lib/pjsua_acc.c +++ b/pjsip/src/pjsua-lib/pjsua_acc.c @@ -3043,7 +3043,7 @@ pj_status_t pjsua_acc_get_uac_addr(pjsua_acc_id acc_id, addr->port = tfla2_prm.ret_port; /* For TCP/TLS, acc may request to specify source port */ - if (acc->cfg.contact_rewrite_use_src_port) { + if (acc->cfg.contact_use_src_port) { pjsip_host_info dinfo; pjsip_transport *tp = NULL; pj_addrinfo ai; diff --git a/pjsip/src/pjsua-lib/pjsua_core.c b/pjsip/src/pjsua-lib/pjsua_core.c index 056ff888..c9aa1a45 100644 --- a/pjsip/src/pjsua-lib/pjsua_core.c +++ b/pjsip/src/pjsua-lib/pjsua_core.c @@ -289,7 +289,7 @@ PJ_DEF(void) pjsua_acc_config_default(pjsua_acc_config *cfg) cfg->srtp_optional_dup_offer = pjsua_var.ua_cfg.srtp_optional_dup_offer; cfg->reg_retry_interval = PJSUA_REG_RETRY_INTERVAL; cfg->contact_rewrite_method = PJSUA_CONTACT_REWRITE_METHOD; - cfg->contact_rewrite_use_src_port = PJ_TRUE; + cfg->contact_use_src_port = PJ_TRUE; cfg->use_rfc5626 = PJ_TRUE; cfg->reg_use_proxy = PJSUA_REG_USE_OUTBOUND_PROXY | PJSUA_REG_USE_ACC_PROXY; diff --git a/pjsip/src/pjsua2/account.cpp b/pjsip/src/pjsua2/account.cpp index 247c4a4a..52178451 100644 --- a/pjsip/src/pjsua2/account.cpp +++ b/pjsip/src/pjsua2/account.cpp @@ -202,6 +202,7 @@ void AccountNatConfig::readObject(const ContainerNode &node) throw(Error) NODE_READ_STRING ( this_node, sipOutboundRegId); NODE_READ_UNSIGNED( this_node, udpKaIntervalSec); NODE_READ_STRING ( this_node, udpKaData); + NODE_READ_INT ( this_node, contactUseSrcPort); } void AccountNatConfig::writeObject(ContainerNode &node) const throw(Error) @@ -232,6 +233,7 @@ void AccountNatConfig::writeObject(ContainerNode &node) const throw(Error) NODE_WRITE_STRING ( this_node, sipOutboundRegId); NODE_WRITE_UNSIGNED( this_node, udpKaIntervalSec); NODE_WRITE_STRING ( this_node, udpKaData); + NODE_WRITE_INT ( this_node, contactUseSrcPort); } /////////////////////////////////////////////////////////////////////////////// @@ -397,6 +399,7 @@ void AccountConfig::toPj(pjsua_acc_config &ret) const ret.allow_contact_rewrite = natConfig.contactRewriteUse; ret.contact_rewrite_method = natConfig.contactRewriteMethod; + ret.contact_use_src_port = natConfig.contactUseSrcPort; ret.allow_via_rewrite = natConfig.viaRewriteUse; ret.allow_sdp_nat_rewrite = natConfig.sdpNatRewriteUse; ret.use_rfc5626 = natConfig.sipOutboundUse; @@ -558,6 +561,7 @@ void AccountConfig::fromPj(const pjsua_acc_config &prm, } natConfig.contactRewriteUse = prm.allow_contact_rewrite; natConfig.contactRewriteMethod = prm.contact_rewrite_method; + natConfig.contactUseSrcPort = prm.contact_use_src_port; natConfig.viaRewriteUse = prm.allow_via_rewrite; natConfig.sdpNatRewriteUse = prm.allow_sdp_nat_rewrite; natConfig.sipOutboundUse = prm.use_rfc5626; |