Modification based on comments

This commit is contained in:
Riza Sulistyo 2023-09-18 13:48:44 +07:00
parent e74e036ae5
commit b4565c3374
4 changed files with 20 additions and 16 deletions

View File

@ -1081,7 +1081,8 @@ typedef struct pjsua_call_setting
/**
* This will contain the information of the callback \a on_rejected_incoming_call.
* This will contain the information passed from the callback
* \a pjsua_on_rejected_incoming_call_cb.
*/
typedef struct pjsua_on_rejected_incoming_call_param {
/**
@ -1126,7 +1127,7 @@ typedef struct pjsua_on_rejected_incoming_call_param {
*
*/
typedef void (*pjsua_on_rejected_incoming_call_cb)(
const pjsua_on_rejected_incoming_call_param *param);
const pjsua_on_rejected_incoming_call_param *param);
/**
@ -2018,7 +2019,8 @@ typedef struct pjsua_callback
/**
* This callback is called when an incoming call is rejected.
* In addition to being declined explicitly using the #pjsua_call_answer() method,
* In addition to being declined explicitly using the
* #pjsua_call_answer()/#pjsua_call_answer2() method,
* the library may also automatically reject the incoming call due
* to different scenarios, e.g:
* - no available call slot.

View File

@ -454,12 +454,12 @@ struct OnRejectedIncomingCallParam
/**
* Rejection code.
*/
int stCode;
int statusCode;
/**
* Rejection text.
*/
std::string stText;
std::string reason;
/**
* The original INVITE message.
@ -1930,11 +1930,18 @@ public:
virtual pj_status_t onCredAuth(OnCredAuthParam &prm);
/**
* Callback when an incoming call is rejected.
* This callback is called when an incoming call is rejected.
* In addition to being declined explicitly using the Call::answer()
* method, the library may also automatically reject the incoming call
* due to different scenarios, e.g:
* - no available call slot.
* - no available account to handle the call.
* - when an incoming INVITE is received with, for instance, a message
* containing invalid SDP.
*
* @param prm Callback parameters.
*/
virtual void onRejectedIncomingCall(OnRejectedIncomingCallParam& prm)
virtual void onRejectedIncomingCall(OnRejectedIncomingCallParam &prm)
{ PJ_UNUSED_ARG(prm); }
private:

View File

@ -1456,10 +1456,7 @@ on_incoming_call_med_tp_complete(pjsua_call_id call_id,
static void rejected_incoming_call_cb(pjsip_rx_data *rdata, int st_code,
pj_str_t *st_text)
{
/* Call on_rejected_incoming_call() only if to-tag is not set. */
if ((rdata->msg_info.to->tag.slen == 0) &&
pjsua_var.ua_cfg.cb.on_rejected_incoming_call)
{
if (pjsua_var.ua_cfg.cb.on_rejected_incoming_call) {
pjsip_from_hdr *from_hdr;
pjsip_to_hdr *to_hdr;
pjsip_sip_uri *uri;
@ -1519,8 +1516,7 @@ pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata)
pjmedia_sdp_session *offer=NULL;
pj_bool_t should_dec_dlg = PJ_FALSE;
pjsip_tpselector tp_sel;
char reason_buf[32] = {0};
pj_str_t st_reason;
pj_str_t st_reason = pj_str("");
int st_code = 200;
pj_status_t status;
@ -1547,7 +1543,6 @@ pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata)
PJSUA_LOCK();
st_reason = pj_str(reason_buf);
/* Find free call slot. */
call_id = alloc_call_id();

View File

@ -2695,8 +2695,8 @@ void Endpoint::on_rejected_incoming_call(
OnRejectedIncomingCallParam prm;
prm.localInfo = pj2Str(param->local_info);
prm.remoteInfo = pj2Str(param->remote_info);
prm.stCode = param->st_code;
prm.stText = pj2Str(param->st_text);
prm.statusCode = param->st_code;
prm.reason = pj2Str(param->st_text);
prm.rdata.fromPj(*param->rdata);
Endpoint::instance().onRejectedIncomingCall(prm);