diff options
author | Benny Prijono <bennylp@teluu.com> | 2011-09-15 10:09:44 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2011-09-15 10:09:44 +0000 |
commit | 7deb406208055b1044977a5f7efa8630d69f32f9 (patch) | |
tree | ab0ced4233d91831d78ff00ce4e517dd2f05eb91 /pjsip | |
parent | 22eb7f24a0f86a681d2735e9f5705fe7c99bf752 (diff) |
Fixed #1369: Local state is set to HOLD even if hold operation fails
git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/1.x@3749 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r-- | pjsip/include/pjsua-lib/pjsua_internal.h | 1 | ||||
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_call.c | 17 |
2 files changed, 18 insertions, 0 deletions
diff --git a/pjsip/include/pjsua-lib/pjsua_internal.h b/pjsip/include/pjsua-lib/pjsua_internal.h index 92c9dce1..a7aed985 100644 --- a/pjsip/include/pjsua-lib/pjsua_internal.h +++ b/pjsip/include/pjsua-lib/pjsua_internal.h @@ -63,6 +63,7 @@ typedef struct pjsua_call int secure_level;/**< Signaling security level. */ pjsua_call_hold_type call_hold_type; /**< How to do call hold. */ pj_bool_t local_hold;/**< Flag for call-hold by local. */ + void *hold_msg; /**< Outgoing hold tx_data. */ pjsua_call_media_status media_st;/**< Media state. */ pjmedia_dir media_dir; /**< Media direction. */ pjmedia_session *session; /**< The media session. */ diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c index bbbd7860..acfcd359 100644 --- a/pjsip/src/pjsua-lib/pjsua_call.c +++ b/pjsip/src/pjsua-lib/pjsua_call.c @@ -1653,10 +1653,14 @@ PJ_DEF(pj_status_t) pjsua_call_set_hold(pjsua_call_id call_id, /* Add additional headers etc */ pjsua_process_msg_data( tdata, msg_data); + /* Record the tx_data to keep track the operation */ + call->hold_msg = (void*) tdata; + /* Send the request */ status = pjsip_inv_send_msg( call->inv, tdata); if (status != PJ_SUCCESS) { pjsua_perror(THIS_FILE, "Unable to send re-INVITE", status); + call->hold_msg = NULL; pjsip_dlg_dec_lock(dlg); return status; } @@ -4389,9 +4393,22 @@ static void pjsua_call_on_tsx_state_changed(pjsip_inv_session *inv, &tsx->status_text); } } + } else if (tsx->role == PJSIP_ROLE_UAC && + tsx->last_tx == (pjsip_tx_data*)call->hold_msg && + tsx->state >= PJSIP_TSX_STATE_COMPLETED) + { + /* Monitor the status of call hold request */ + call->hold_msg = NULL; + if (tsx->status_code/100 != 2) { + /* Outgoing call hold failed */ + call->local_hold = PJ_FALSE; + PJ_LOG(3,(THIS_FILE, "Error putting call %d on hold (reason=%d)", + call->index, tsx->status_code)); + } } + PJSUA_UNLOCK(); } |