diff options
author | Benny Prijono <bennylp@teluu.com> | 2011-09-18 14:59:56 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2011-09-18 14:59:56 +0000 |
commit | b451470330fc334519bc30a240737bdc22ba9c21 (patch) | |
tree | cfbf7e759fb6dc90aacd89e27c22370de797eb60 /pjsip/src/pjsua-lib/pjsua_acc.c | |
parent | 8656f9c3676f6be0ad9c1f2603389ffab2dca8d2 (diff) |
Modified the libraries to use the new log indentation feature re #1372
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3753 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/pjsua-lib/pjsua_acc.c')
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_acc.c | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_acc.c b/pjsip/src/pjsua-lib/pjsua_acc.c index 57f4093a..9bcd1ddd 100644 --- a/pjsip/src/pjsua-lib/pjsua_acc.c +++ b/pjsip/src/pjsua-lib/pjsua_acc.c @@ -374,8 +374,9 @@ PJ_DEF(pj_status_t) pjsua_acc_add( const pjsua_acc_config *cfg, { pjsua_acc *acc; unsigned i, id; - pj_status_t status; + pj_status_t status = PJ_SUCCESS; + PJ_ASSERT_RETURN(cfg, PJ_EINVAL); PJ_ASSERT_RETURN(pjsua_var.acc_cnt < PJ_ARRAY_SIZE(pjsua_var.acc), PJ_ETOOMANY); @@ -384,11 +385,16 @@ PJ_DEF(pj_status_t) pjsua_acc_add( const pjsua_acc_config *cfg, /* Verify media count */ #if !defined(PJMEDIA_HAS_VIDEO) || (PJMEDIA_HAS_VIDEO == 0) + /* Enable PJMEDIA_HAS_VIDEO in your config_site.h! */ PJ_ASSERT_RETURN(cfg->max_video_cnt == 0, PJ_EINVAL); #endif PJ_ASSERT_RETURN(cfg->max_audio_cnt + cfg->max_video_cnt <= PJSUA_MAX_CALL_MEDIA, PJ_ETOOMANY); + PJ_LOG(4,(THIS_FILE, "Adding account: id=%.*s", + (int)cfg->id.slen, cfg->id.ptr)); + pj_log_push_indent(); + PJSUA_LOCK(); /* Find empty account id. */ @@ -433,8 +439,11 @@ PJ_DEF(pj_status_t) pjsua_acc_add( const pjsua_acc_config *cfg, /* Check the route URI's and force loose route if required */ for (i=0; i<acc->cfg.proxy_cnt; ++i) { status = normalize_route_uri(acc->pool, &acc->cfg.proxy[i]); - if (status != PJ_SUCCESS) + if (status != PJ_SUCCESS) { + PJSUA_UNLOCK(); + pj_log_pop_indent(); return status; + } } status = initialize_acc(id); @@ -443,6 +452,7 @@ PJ_DEF(pj_status_t) pjsua_acc_add( const pjsua_acc_config *cfg, pj_pool_release(acc->pool); acc->pool = NULL; PJSUA_UNLOCK(); + pj_log_pop_indent(); return status; } @@ -468,6 +478,7 @@ PJ_DEF(pj_status_t) pjsua_acc_add( const pjsua_acc_config *cfg, pjsua_start_mwi(&pjsua_var.acc[id]); } + pj_log_pop_indent(); return PJ_SUCCESS; } @@ -574,6 +585,9 @@ PJ_DEF(pj_status_t) pjsua_acc_del(pjsua_acc_id acc_id) PJ_EINVAL); PJ_ASSERT_RETURN(pjsua_var.acc[acc_id].valid, PJ_EINVALIDOP); + PJ_LOG(4,(THIS_FILE, "Deleting account %d..", acc_id)); + pj_log_push_indent(); + PJSUA_LOCK(); /* Cancel any re-registration timer */ @@ -624,6 +638,7 @@ PJ_DEF(pj_status_t) pjsua_acc_del(pjsua_acc_id acc_id) PJ_LOG(4,(THIS_FILE, "Account id %d deleted", acc_id)); + pj_log_pop_indent(); return PJ_SUCCESS; } @@ -655,6 +670,8 @@ PJ_DEF(pj_status_t) pjsua_acc_modify( pjsua_acc_id acc_id, PJ_ASSERT_RETURN(cfg->max_audio_cnt + cfg->max_video_cnt <= PJSUA_MAX_CALL_MEDIA, PJ_ETOOMANY); + PJ_LOG(4,(THIS_FILE, "Modifying accunt %d", acc_id)); + pj_log_push_indent(); PJSUA_LOCK(); @@ -1040,6 +1057,7 @@ PJ_DEF(pj_status_t) pjsua_acc_modify( pjsua_acc_id acc_id, on_return: PJSUA_UNLOCK(); + pj_log_pop_indent(); return status; } @@ -1055,9 +1073,15 @@ PJ_DEF(pj_status_t) pjsua_acc_set_online_status( pjsua_acc_id acc_id, PJ_EINVAL); PJ_ASSERT_RETURN(pjsua_var.acc[acc_id].valid, PJ_EINVALIDOP); + PJ_LOG(4,(THIS_FILE, "Acc %d: setting online status to %d..", + acc_id, is_online)); + pj_log_push_indent(); + pjsua_var.acc[acc_id].online_status = is_online; pj_bzero(&pjsua_var.acc[acc_id].rpid, sizeof(pjrpid_element)); pjsua_pres_update_acc(acc_id, PJ_FALSE); + + pj_log_pop_indent(); return PJ_SUCCESS; } @@ -1073,12 +1097,18 @@ PJ_DEF(pj_status_t) pjsua_acc_set_online_status2( pjsua_acc_id acc_id, PJ_EINVAL); PJ_ASSERT_RETURN(pjsua_var.acc[acc_id].valid, PJ_EINVALIDOP); + PJ_LOG(4,(THIS_FILE, "Acc %d: setting online status to %d..", + acc_id, is_online)); + pj_log_push_indent(); + PJSUA_LOCK(); pjsua_var.acc[acc_id].online_status = is_online; pjrpid_element_dup(pjsua_var.acc[acc_id].pool, &pjsua_var.acc[acc_id].rpid, pr); PJSUA_UNLOCK(); pjsua_pres_update_acc(acc_id, PJ_TRUE); + pj_log_pop_indent(); + return PJ_SUCCESS; } @@ -1664,6 +1694,7 @@ static void regc_cb(struct pjsip_regc_cbparam *param) if (param->regc != acc->regc) return; + pj_log_push_indent(); PJSUA_LOCK(); /* @@ -1715,6 +1746,7 @@ static void regc_cb(struct pjsip_regc_cbparam *param) /* Check NAT bound address */ if (acc_check_nat_addr(acc, param)) { PJSUA_UNLOCK(); + pj_log_pop_indent(); return; } @@ -1777,6 +1809,7 @@ static void regc_cb(struct pjsip_regc_cbparam *param) } PJSUA_UNLOCK(); + pj_log_pop_indent(); } @@ -1964,6 +1997,10 @@ PJ_DEF(pj_status_t) pjsua_acc_set_registration( pjsua_acc_id acc_id, PJ_EINVAL); PJ_ASSERT_RETURN(pjsua_var.acc[acc_id].valid, PJ_EINVALIDOP); + PJ_LOG(4,(THIS_FILE, "Acc %d: setting %sregistration..", + acc_id, (renew? "" : "un"))); + pj_log_push_indent(); + PJSUA_LOCK(); /* Cancel any re-registration timer */ @@ -2039,12 +2076,13 @@ PJ_DEF(pj_status_t) pjsua_acc_set_registration( pjsua_acc_id acc_id, pjsua_perror(THIS_FILE, "Unable to create/send REGISTER", status); } else { - PJ_LOG(3,(THIS_FILE, "%s sent", + PJ_LOG(4,(THIS_FILE, "Acc %d: %s sent", acc_id, (renew? "Registration" : "Unregistration"))); } on_return: PJSUA_UNLOCK(); + pj_log_pop_indent(); return status; } @@ -2790,6 +2828,10 @@ void pjsua_acc_on_tp_state_changed(pjsip_transport *tp, if (state != PJSIP_TP_STATE_DISCONNECTED) return; + PJ_LOG(4,(THIS_FILE, "Disconnected notification for transport %s", + tp->obj_name)); + pj_log_push_indent(); + /* Shutdown this transport, to make sure that the transport manager * will create a new transport for reconnection. */ @@ -2817,4 +2859,5 @@ void pjsua_acc_on_tp_state_changed(pjsip_transport *tp, } PJSUA_UNLOCK(); + pj_log_pop_indent(); } |