diff options
-rw-r--r-- | pjsip-apps/src/pjsua/pjsua_app.c | 5 | ||||
-rw-r--r-- | pjsip/include/pjsua-lib/pjsua.h | 5 | ||||
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_pres.c | 3 |
3 files changed, 11 insertions, 2 deletions
diff --git a/pjsip-apps/src/pjsua/pjsua_app.c b/pjsip-apps/src/pjsua/pjsua_app.c index 8be930f7..4f534f90 100644 --- a/pjsip-apps/src/pjsua/pjsua_app.c +++ b/pjsip-apps/src/pjsua/pjsua_app.c @@ -2533,11 +2533,12 @@ static void on_buddy_state(pjsua_buddy_id buddy_id) pjsua_buddy_info info; pjsua_buddy_get_info(buddy_id, &info); - PJ_LOG(3,(THIS_FILE, "%.*s status is %.*s", + PJ_LOG(3,(THIS_FILE, "%.*s status is %.*s (subscription state is %s)", (int)info.uri.slen, info.uri.ptr, (int)info.status_text.slen, - info.status_text.ptr)); + info.status_text.ptr, + info.sub_state_name)); } diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h index 8744e9a8..1ea6f9e4 100644 --- a/pjsip/include/pjsua-lib/pjsua.h +++ b/pjsip/include/pjsua-lib/pjsua.h @@ -2896,6 +2896,11 @@ typedef struct pjsua_buddy_info pjsip_evsub_state sub_state; /** + * String representation of subscription state. + */ + const char *sub_state_name; + + /** * Specifies the last presence subscription terminatino reason. If * presence subscription is currently active, the value will be empty. */ diff --git a/pjsip/src/pjsua-lib/pjsua_pres.c b/pjsip/src/pjsua-lib/pjsua_pres.c index 797fb84c..b9c11ae4 100644 --- a/pjsip/src/pjsua-lib/pjsua_pres.c +++ b/pjsip/src/pjsua-lib/pjsua_pres.c @@ -195,6 +195,7 @@ PJ_DEF(pj_status_t) pjsua_buddy_get_info( pjsua_buddy_id buddy_id, /* subscription state and termination reason */ if (buddy->sub) { info->sub_state = pjsip_evsub_get_state(buddy->sub); + info->sub_state_name = pjsip_evsub_get_state_name(buddy->sub); if (info->sub_state == PJSIP_EVSUB_STATE_TERMINATED && total < sizeof(info->buf_)) { @@ -207,11 +208,13 @@ PJ_DEF(pj_status_t) pjsua_buddy_get_info( pjsua_buddy_id buddy_id, info->sub_term_reason = pj_str(""); } } else if (total < sizeof(info->buf_)) { + info->sub_state_name = "NULL"; info->sub_term_reason.ptr = info->buf_ + total; pj_strncpy(&info->sub_term_reason, &buddy->term_reason, sizeof(info->buf_) - total); total += info->sub_term_reason.slen; } else { + info->sub_state_name = "NULL"; info->sub_term_reason = pj_str(""); } |