diff options
author | Nanang Izzuddin <nanang@teluu.com> | 2010-03-30 11:13:59 +0000 |
---|---|---|
committer | Nanang Izzuddin <nanang@teluu.com> | 2010-03-30 11:13:59 +0000 |
commit | bfce50ca66e811fa21aec4385ce14ea46ce1f84e (patch) | |
tree | 85cf4edadfa19d5af42dcaaf57b918bef1f2f032 /pjsip/src/pjsip-ua/sip_reg.c | |
parent | facb259a9ea6415daa5a8eb4130d459f194d06eb (diff) |
Ticket #1044:
- Added initial version of automatic re-registration after registration failure and automatic call disconnection after re-registration attempt fails.
- Published auto re-registration setting to pjsua app.
- Updated pjsip_regc_send() to retrieve the transport earlier (was only in tsx_callback()).
- Fixed TCP and TLS transport to prevent transport deletion in transport disconnection callback.
- Fixed wrong keep-alive settings used by TLS transport (was using TCP keep-alive settings).
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3128 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/pjsip-ua/sip_reg.c')
-rw-r--r-- | pjsip/src/pjsip-ua/sip_reg.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/pjsip/src/pjsip-ua/sip_reg.c b/pjsip/src/pjsip-ua/sip_reg.c index 3975028f..5190bb0f 100644 --- a/pjsip/src/pjsip-ua/sip_reg.c +++ b/pjsip/src/pjsip-ua/sip_reg.c @@ -203,6 +203,7 @@ PJ_DEF(pj_status_t) pjsip_regc_get_info( pjsip_regc *regc, info->is_busy = (pj_atomic_get(regc->busy_ctr) || regc->has_tsx); info->auto_reg = regc->auto_reg; info->interval = regc->expires; + info->transport = regc->last_transport; if (regc->has_tsx) info->next_reg = 0; @@ -1202,12 +1203,33 @@ PJ_DEF(pj_status_t) pjsip_regc_send(pjsip_regc *regc, pjsip_tx_data *tdata) else regc->current_op = REGC_REGISTERING; + /* Prevent deletion of tdata, e.g: when something wrong in sending, + * we need tdata to retrieve the transport. + */ + pjsip_tx_data_add_ref(tdata); + status = pjsip_endpt_send_request(regc->endpt, tdata, REGC_TSX_TIMEOUT, regc, &tsx_callback); if (status!=PJ_SUCCESS) { PJ_LOG(4,(THIS_FILE, "Error sending request, status=%d", status)); } + /* Get last transport used and add reference to it */ + if (tdata->tp_info.transport != regc->last_transport) { + if (regc->last_transport) { + pjsip_transport_dec_ref(regc->last_transport); + regc->last_transport = NULL; + } + + if (tdata->tp_info.transport) { + regc->last_transport = tdata->tp_info.transport; + pjsip_transport_add_ref(regc->last_transport); + } + } + + /* Release tdata */ + pjsip_tx_data_dec_ref(tdata); + pj_lock_release(regc->lock); /* Delete the record if user destroy regc during the callback. */ |