From 5d2066e0c3368cce23090e842c407a35bc351a83 Mon Sep 17 00:00:00 2001 From: Liong Sauw Ming Date: Mon, 31 Oct 2011 10:31:23 +0000 Subject: Re #1395: Backport of PJSIP 1.x branch into PJSIP 2.0 trunk * Backport of r3833:r3877 git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3878 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip/src/pjsip-ua/sip_inv.c | 20 ++++++++++++++------ pjsip/src/pjsip/sip_auth_client.c | 4 ++-- pjsip/src/pjsua-lib/pjsua_acc.c | 10 ++++++++++ pjsip/src/pjsua-lib/pjsua_core.c | 8 ++++++-- 4 files changed, 32 insertions(+), 10 deletions(-) (limited to 'pjsip') diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c index 46153c9f..8c2c92d0 100644 --- a/pjsip/src/pjsip-ua/sip_inv.c +++ b/pjsip/src/pjsip-ua/sip_inv.c @@ -455,17 +455,25 @@ static pj_bool_t mod_inv_on_rx_request(pjsip_rx_data *rdata) */ if (method->id == PJSIP_ACK_METHOD && inv) { + /* Ignore if we don't have INVITE in progress */ + if (!inv->invite_tsx) { + return PJ_TRUE; + } + /* Ignore ACK if pending INVITE transaction has not finished. */ - if (inv->invite_tsx && - inv->invite_tsx->state < PJSIP_TSX_STATE_COMPLETED) - { + if (inv->invite_tsx->state < PJSIP_TSX_STATE_COMPLETED) { + return PJ_TRUE; + } + + /* Ignore ACK with different CSeq + * https://trac.pjsip.org/repos/ticket/1391 + */ + if (rdata->msg_info.cseq->cseq != inv->invite_tsx->cseq) { return PJ_TRUE; } /* Terminate INVITE transaction, if it's still present. */ - if (inv->invite_tsx && - inv->invite_tsx->state <= PJSIP_TSX_STATE_COMPLETED) - { + if (inv->invite_tsx->state <= PJSIP_TSX_STATE_COMPLETED) { /* Before we terminate INVITE transaction, process the SDP * in the ACK request, if any. * Only do this when invite state is not already disconnected diff --git a/pjsip/src/pjsip/sip_auth_client.c b/pjsip/src/pjsip/sip_auth_client.c index 58ce2c20..8684cc9b 100644 --- a/pjsip/src/pjsip/sip_auth_client.c +++ b/pjsip/src/pjsip/sip_auth_client.c @@ -278,8 +278,8 @@ static pj_status_t respond_digest( pj_pool_t *pool, /* Check algorithm is supported. We support MD5 and AKAv1-MD5. */ if (chal->algorithm.slen==0 || - (pj_stricmp(&chal->algorithm, &pjsip_MD5_STR) || - pj_stricmp(&chal->algorithm, &pjsip_AKAv1_MD5_STR))) + (pj_stricmp(&chal->algorithm, &pjsip_MD5_STR)==0 || + pj_stricmp(&chal->algorithm, &pjsip_AKAv1_MD5_STR)==0)) { ; } diff --git a/pjsip/src/pjsua-lib/pjsua_acc.c b/pjsip/src/pjsua-lib/pjsua_acc.c index bd8096a3..24df6e01 100644 --- a/pjsip/src/pjsua-lib/pjsua_acc.c +++ b/pjsip/src/pjsua-lib/pjsua_acc.c @@ -895,6 +895,12 @@ PJ_DEF(pj_status_t) pjsua_acc_modify( pjsua_acc_id acc_id, acc->cfg.use_stream_ka = cfg->use_stream_ka; #endif + /* Use of proxy */ + if (acc->cfg.reg_use_proxy != cfg->reg_use_proxy) { + acc->cfg.reg_use_proxy = cfg->reg_use_proxy; + update_reg = PJ_TRUE; + } + /* Global outbound proxy */ if (global_route_crc != acc->global_route_crc) { unsigned i, rcnt; @@ -1005,6 +1011,7 @@ PJ_DEF(pj_status_t) pjsua_acc_modify( pjsua_acc_id acc_id, acc->cfg.reg_retry_interval = cfg->reg_retry_interval; acc->cfg.reg_first_retry_interval = cfg->reg_first_retry_interval; acc->cfg.drop_calls_on_reg_fail = cfg->drop_calls_on_reg_fail; + acc->cfg.register_on_acc_add = cfg->register_on_acc_add; if (acc->cfg.reg_delay_before_refresh != cfg->reg_delay_before_refresh) { acc->cfg.reg_delay_before_refresh = cfg->reg_delay_before_refresh; pjsip_regc_set_delay_before_refresh(acc->regc, @@ -1068,6 +1075,9 @@ PJ_DEF(pj_status_t) pjsua_acc_modify( pjsua_acc_id acc_id, acc->cfg.vid_cap_dev = cfg->vid_cap_dev; acc->cfg.vid_rend_dev = cfg->vid_rend_dev; + /* Call hold type */ + acc->cfg.call_hold_type = cfg->call_hold_type; + on_return: PJSUA_UNLOCK(); pj_log_pop_indent(); diff --git a/pjsip/src/pjsua-lib/pjsua_core.c b/pjsip/src/pjsua-lib/pjsua_core.c index 52054226..6a80380c 100644 --- a/pjsip/src/pjsua-lib/pjsua_core.c +++ b/pjsip/src/pjsua-lib/pjsua_core.c @@ -1321,8 +1321,12 @@ pj_status_t resolve_stun_server(pj_bool_t wait) * result. */ if (wait) { - while (pjsua_var.stun_status == PJ_EPENDING) - pjsua_handle_events(10); + while (pjsua_var.stun_status == PJ_EPENDING) { + if (pjsua_var.thread[0] == NULL) + pjsua_handle_events(10); + else + pj_thread_sleep(10); + } } } -- cgit v1.2.3