summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2010-11-16 06:01:38 +0000
committerBenny Prijono <bennylp@teluu.com>2010-11-16 06:01:38 +0000
commit47f92e3cced096366b347bfaaef5460564358034 (patch)
tree0070582f980f91bb3274e66d94b27a1f7f0ea337
parente27b2a2975a378643ff03e36176be3c378b9bc19 (diff)
re #1020 (SIP outbound): remove sip.instance and reg-id parameters from the Contact when re-registering if the server does not support SIP outbound
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3367 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjsip/src/pjsua-lib/pjsua_acc.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_acc.c b/pjsip/src/pjsua-lib/pjsua_acc.c
index f7629877..b434bb7c 100644
--- a/pjsip/src/pjsua-lib/pjsua_acc.c
+++ b/pjsip/src/pjsua-lib/pjsua_acc.c
@@ -25,9 +25,10 @@
enum
{
- OUTBOUND_NONE,
- OUTBOUND_WANTED,
- OUTBOUND_ACTIVE
+ OUTBOUND_UNKNOWN, // status unknown
+ OUTBOUND_WANTED, // initiated in registration
+ OUTBOUND_ACTIVE, // got positive response from server
+ OUTBOUND_NA // not wanted or got negative response from server
};
@@ -1032,6 +1033,10 @@ static void update_regc_contact(pjsua_acc *acc)
if (!acc_cfg->use_rfc5626)
goto done;
+ /* Check if outbound has been requested and rejected */
+ if (acc->rfc5626_status == OUTBOUND_NA)
+ goto done;
+
if (pj_stristr(&acc->contact, &tcp_param)==NULL &&
pj_stristr(&acc->contact, &tls_param)==NULL)
{
@@ -1050,7 +1055,7 @@ done:
* is set to the same as acc->contact.
*/
acc->reg_contact = acc->contact;
- acc->rfc5626_status = OUTBOUND_NONE;
+ acc->rfc5626_status = OUTBOUND_NA;
} else {
/* Need to use outbound, append the contact with +sip.instance and
* reg-id parameters.
@@ -1558,13 +1563,13 @@ static void update_rfc5626_status(pjsua_acc *acc, pjsip_rx_data *rdata)
const pj_str_t STR_OUTBOUND = {"outbound", 8};
unsigned i;
- if (acc->rfc5626_status == OUTBOUND_NONE) {
+ if (acc->rfc5626_status == OUTBOUND_UNKNOWN) {
goto on_return;
}
hreq = rdata->msg_info.require;
if (!hreq) {
- acc->rfc5626_status = OUTBOUND_NONE;
+ acc->rfc5626_status = OUTBOUND_NA;
goto on_return;
}
@@ -1576,9 +1581,12 @@ static void update_rfc5626_status(pjsua_acc *acc, pjsip_rx_data *rdata)
}
/* Server does not support outbound */
- acc->rfc5626_status = OUTBOUND_NONE;
+ acc->rfc5626_status = OUTBOUND_NA;
on_return:
+ if (acc->rfc5626_status != OUTBOUND_ACTIVE) {
+ acc->reg_contact = acc->contact;
+ }
PJ_LOG(4,(THIS_FILE, "SIP outbound status for acc %d is %s",
acc->index, (acc->rfc5626_status==OUTBOUND_ACTIVE?
"active": "not active")));