Skip to content

Commit

Permalink
Extend descriptions and apply code style formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksandr-Goodicus committed Jan 4, 2024
1 parent fb9c136 commit 2be883a
Show file tree
Hide file tree
Showing 9 changed files with 165 additions and 149 deletions.
6 changes: 3 additions & 3 deletions pjsip-apps/src/pjsua/pjsua_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ static void on_buddy_state(pjsua_buddy_id buddy_id)


/*
* Handler on buddy blf state changed.
* Handler on buddy "busy lamp field" state changed.
*/
static void on_buddy_blf_state(pjsua_buddy_id buddy_id)
{
Expand Down Expand Up @@ -745,8 +745,8 @@ static void on_buddy_evsub_state(pjsua_buddy_id buddy_id,
}

static void on_buddy_evsub_blf_state(pjsua_buddy_id buddy_id,
pjsip_evsub *sub,
pjsip_event *event)
pjsip_evsub *sub,
pjsip_event *event)
{
char event_info[80];

Expand Down
3 changes: 2 additions & 1 deletion pjsip-apps/src/pjsua/pjsua_app_legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,8 @@ static void ui_add_buddy()

static void ui_add_buddy_blf()
{
char buf[128];
const int buffer_size = 128;
char buf[buffer_size];
pjsua_buddy_config buddy_cfg;
pjsua_buddy_id buddy_id;
pj_status_t status;
Expand Down
104 changes: 59 additions & 45 deletions pjsip/include/pjsip-simple/blf.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

/**
* @file blf.h
* @brief SIP Extension for blf (RFC 4235)
* @brief SIP Extension for "busy lamp field" (blf) (RFC 4235)
*/
#include <pjsip-simple/evsub.h>
#include <pjsip-simple/dialog-info.h>
Expand All @@ -29,9 +29,9 @@ PJ_BEGIN_DECL


/**
* @defgroup PJSIP_SIMPLE_BLF SIP Extension for BLF (RFC 4235)
* @defgroup PJSIP_SIMPLE_BLF SIP Extension for "busy lamp field" (blf) (RFC 4235)
* @ingroup PJSIP_SIMPLE
* @brief Support for SIP Extension for BLF (RFC 4235)
* @brief Support for SIP Extension for "busy lamp field" (blf) (RFC 4235)
* @{
*
* This module contains the implementation of SIP Presence Extension as
Expand All @@ -42,7 +42,7 @@ PJ_BEGIN_DECL


/**
* Initialize the blf module and register it as endpoint module and
* Initialize the "busy lamp field" module and register it as endpoint module and
* package to the event subscription module.
*
* @param endpt The endpoint instance.
Expand All @@ -53,7 +53,7 @@ PJ_BEGIN_DECL
* and the event subscription module.
*/
PJ_DECL(pj_status_t) pjsip_blf_init_module(pjsip_endpoint *endpt,
pjsip_module *mod_evsub);
pjsip_module *mod_evsub);


/**
Expand All @@ -65,36 +65,37 @@ PJ_DECL(pjsip_module*) pjsip_blf_instance(void);


/**
* Maximum blf status info.
* Maximum "busy lamp field" status info items which can handled by application.
*
*/
#define PJSIP_BLF_STATUS_MAX_INFO 8


/**
* This structure describes blf status of a presentity.
* This structure describes "busy lamp field" status of a presentity.
*/
struct pjsip_blf_status
{
unsigned info_cnt; /**< Number of info in the status. */
struct {

pj_str_t dialog_info_state; /**< Dialog-Info state */
pj_str_t dialog_info_entity; /**< Dialog-Info entity */
pj_str_t dialog_call_id; /**< Dialog's call_id */
pj_str_t dialog_remote_tag; /**< Dialog's remote-tag */
pj_str_t dialog_local_tag; /**< Dialog's local-tag */
pj_str_t dialog_direction; /**< Dialog's direction */
pj_str_t dialog_id; /**< Dialog's id */
pj_str_t dialog_state; /**< Dialog state */
pj_str_t dialog_duration; /**< Dialog duration */

pj_xml_node *dialog_node; /**< Pointer to tuple XML node of
parsed dialog-info body received from
remote agent. Only valid for
client subscription. If the
last received NOTIFY request
does not contain any dialog-info body,
this valud will be set to NULL */
pj_str_t dialog_info_entity; /**< Dialog-Info entity */
pj_str_t dialog_call_id; /**< Dialog's call_id */
pj_str_t dialog_remote_tag; /**< Dialog's remote-tag */
pj_str_t dialog_local_tag; /**< Dialog's local-tag */
pj_str_t dialog_direction; /**< Dialog's direction */
pj_str_t dialog_id; /**< Dialog's id */
pj_str_t dialog_state; /**< Dialog state */
pj_str_t dialog_duration; /**< Dialog duration */

pj_xml_node *dialog_node; /**< Pointer to tuple XML node of
parsed dialog-info body received from
remote agent. Only valid for
client subscription. If the
last received NOTIFY request
does not contain any dialog-info body,
this valid will be set to NULL */
pj_str_t local_identity;
pj_str_t local_identity_display;
pj_str_t local_target_uri;
Expand All @@ -117,7 +118,7 @@ typedef struct pjsip_blf_status pjsip_blf_status;


/**
* Create blf client subscription session.
* Create "busy lamp field" client subscription session.
*
* @param dlg The underlying dialog to use.
* @param user_cb Pointer to callbacks to receive presence subscription
Expand All @@ -129,10 +130,10 @@ typedef struct pjsip_blf_status pjsip_blf_status;
*
* @return PJ_SUCCESS on success.
*/
PJ_DECL(pj_status_t) pjsip_blf_create_uac( pjsip_dialog *dlg,
const pjsip_evsub_blf_user *user_cb,
unsigned options,
pjsip_evsub **p_evsub );
PJ_DECL(pj_status_t) pjsip_blf_create_uac(pjsip_dialog *dlg,
const pjsip_evsub_blf_user *user_cb,
unsigned options,
pjsip_evsub **p_evsub );


/**
Expand All @@ -147,8 +148,8 @@ PJ_DECL(pj_status_t) pjsip_blf_create_uac( pjsip_dialog *dlg,
*
* @return PJ_SUCCESS if subscription session has been destroyed.
*/
PJ_DECL(pj_status_t) pjsip_blf_terminate( pjsip_evsub *sub,
pj_bool_t notify );
PJ_DECL(pj_status_t) pjsip_blf_terminate(pjsip_evsub *sub,
pj_bool_t notify );



Expand All @@ -163,9 +164,9 @@ PJ_DECL(pj_status_t) pjsip_blf_terminate( pjsip_evsub *sub,
*
* @return PJ_SUCCESS on success.
*/
PJ_DECL(pj_status_t) pjsip_blf_initiate( pjsip_evsub *sub,
pj_int32_t expires,
pjsip_tx_data **p_tdata);
PJ_DECL(pj_status_t) pjsip_blf_initiate(pjsip_evsub *sub,
pj_int32_t expires,
pjsip_tx_data **p_tdata);


/**
Expand All @@ -177,8 +178,8 @@ PJ_DECL(pj_status_t) pjsip_blf_initiate( pjsip_evsub *sub,
*
* @return PJ_SUCCESS on success.
*/
PJ_DECL(pj_status_t) pjsip_blf_add_header( pjsip_evsub *sub,
const pjsip_hdr *hdr_list );
PJ_DECL(pj_status_t) pjsip_blf_add_header(pjsip_evsub *sub,
const pjsip_hdr *hdr_list);


/**
Expand All @@ -192,10 +193,10 @@ PJ_DECL(pj_status_t) pjsip_blf_add_header( pjsip_evsub *sub,
*
* @return PJ_SUCCESS on success.
*/
PJ_DECL(pj_status_t) pjsip_blf_accept( pjsip_evsub *sub,
pjsip_rx_data *rdata,
int st_code,
const pjsip_hdr *hdr_list );
PJ_DECL(pj_status_t) pjsip_blf_accept(pjsip_evsub *sub,
pjsip_rx_data *rdata,
int st_code,
const pjsip_hdr *hdr_list );

/**
* Send request message that was previously created with initiate(), notify(),
Expand All @@ -208,8 +209,8 @@ PJ_DECL(pj_status_t) pjsip_blf_accept( pjsip_evsub *sub,
*
* @return PJ_SUCCESS on success.
*/
PJ_DECL(pj_status_t) pjsip_blf_send_request( pjsip_evsub *sub,
pjsip_tx_data *tdata );
PJ_DECL(pj_status_t) pjsip_blf_send_request(pjsip_evsub *sub,
pjsip_tx_data *tdata);


/**
Expand All @@ -221,8 +222,8 @@ PJ_DECL(pj_status_t) pjsip_blf_send_request( pjsip_evsub *sub,
*
* @return PJ_SUCCESS on success.
*/
PJ_DECL(pj_status_t) pjsip_blf_get_status( pjsip_evsub *sub,
pjsip_blf_status *status );
PJ_DECL(pj_status_t) pjsip_blf_get_status(pjsip_evsub *sub,
pjsip_blf_status *status);


/**
Expand All @@ -238,9 +239,22 @@ PJ_DECL(pj_status_t) pjsip_blf_get_status( pjsip_evsub *sub,
* @see pjsip_pres_parse_pidf2()
*/
PJ_DECL(pj_status_t) pjsip_blf_parse_dialog_info(pjsip_rx_data *rdata,
pj_pool_t *pool,
pjsip_blf_status *blf_status);
pj_pool_t *pool,
pjsip_blf_status *blf_status);


/**
* This is a utility function to parse PIDF body into PJSIP presence status.
*
* @param rdata The incoming SIP message containing the PIDF body.
* @param pool Pool to allocate memory to copy the strings into
* the presence status structure.
* @param status The presence status to be initialized.
*
* @return PJ_SUCCESS on success.
*
* @see pjsip_pres_parse_pidf2()
*/
PJ_DECL(pj_status_t) pjsip_blf_parse_dialog_info2(char *body, unsigned body_len,
pj_pool_t *pool,
pjsip_blf_status *blf_status);
Expand Down
10 changes: 5 additions & 5 deletions pjsip/include/pjsip-simple/evsub.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,11 @@ struct pjsip_evsub_blf_user
* the response.
*/
void (*on_rx_notify)(pjsip_evsub *sub,
pjsip_rx_data *rdata,
int *p_st_code,
pj_str_t **p_st_text,
pjsip_hdr *res_hdr,
pjsip_msg_body **p_body);
pjsip_rx_data *rdata,
int *p_st_code,
pj_str_t **p_st_text,
pjsip_hdr *res_hdr,
pjsip_msg_body **p_body);

/**
* This callback is called when it is time for the client to refresh
Expand Down
44 changes: 22 additions & 22 deletions pjsip/include/pjsua-lib/pjsua.h
Original file line number Diff line number Diff line change
Expand Up @@ -6556,50 +6556,50 @@ typedef struct pjsua_buddy_blf_info
*/
pj_str_t uri;

/* BLF Dialog-Info id */
/* "busy lamp field" Dialog-Info id */
pj_str_t dialog_id;

/* BLF Dialog-Info state */
/* "busy lamp field" Dialog-Info state */
pj_str_t dialog_info_state;

/* BLF Dialog-Info entity */
/* "busy lamp field" Dialog-Info entity */
pj_str_t dialog_info_entity;

/* BLF Dialog call_id */
/* "busy lamp field" Dialog call_id */
pj_str_t dialog_call_id;

/* BLF Dialog remote_tag */
/* "busy lamp field" Dialog remote_tag */
pj_str_t dialog_remote_tag;

/* BLF Dialog local_tag */
/* "busy lamp field" Dialog local_tag */
pj_str_t dialog_local_tag;

/* BLF Dialog direction */
/* "busy lamp field" Dialog direction */
pj_str_t dialog_direction;

/* BLF dialog state */
/* "busy lamp field" dialog state */
pj_str_t dialog_state;

/* BLF dialog duration */
/* "busy lamp field" dialog duration */
pj_str_t dialog_duration;

/* BLF local identity */
/* "busy lamp field" local identity */
pj_str_t local_identity;

/* BLF local identity_display */
/* "busy lamp field" local identity_display */
pj_str_t local_identity_display;

/* BLF local target uri */
/* "busy lamp field" local target uri */
pj_str_t local_target_uri;


/* BLF remote identity */
/* "busy lamp field" remote identity */
pj_str_t remote_identity;

/* BLF remote identity_display */
/* "busy lamp field" remote identity_display */
pj_str_t remote_identity_display;

/* BLF remote target uri */
/* "busy lamp field" remote target uri */
pj_str_t remote_target_uri;


Expand Down Expand Up @@ -6749,9 +6749,9 @@ PJ_DECL(pj_status_t) pjsua_buddy_add(const pjsua_buddy_config *buddy_cfg,


/**
* Add new buddy to the buddy list. If "busy lamp field" subscription is
* enabled for this buddy, this function will also start the blf subscription
* session immediately.
* Add new buddy to the buddy list. If "busy lamp field" (blf) subscription is
* enabled for this buddy, this function will also start the "busy lamp field"
* subscription session immediately.
*
* @param buddy_cfg Buddy configuration.
* @param p_buddy_id Pointer to receive buddy ID.
Expand Down Expand Up @@ -6800,8 +6800,8 @@ PJ_DECL(pj_status_t) pjsua_buddy_subscribe_pres(pjsua_buddy_id buddy_id,


/**
* Enable/disable buddy's "busy lamp field" monitoring. Once buddy's blf is
* subscribed, application will be informed about buddy's blf status
* Enable/disable buddy's "busy lamp field" monitoring. Once buddy's "busy lamp field"
* is subscribed, application will be informed about buddy's "busy lamp field" status
* changed via \a on_buddy_blf_state() callback.
*
* @param buddy_id Buddy identification.
Expand Down Expand Up @@ -6838,7 +6838,7 @@ PJ_DECL(pj_status_t) pjsua_buddy_update_pres(pjsua_buddy_id buddy_id);


/**
* Update the "busy lamp field" information for the buddy. Although the library
* Update the "busy lamp field" (blf) information for the buddy. Although the library
* periodically refreshes the blf subscription for all buddies, some
* application may want to refresh the buddy's blf subscription
* immediately, and in this case it can use this function to accomplish
Expand All @@ -6850,7 +6850,7 @@ PJ_DECL(pj_status_t) pjsua_buddy_update_pres(pjsua_buddy_id buddy_id);
* for the buddy is already active, this function will not do anything.
*
* Once the blf subscription is activated successfully for the buddy,
* application will be notified about the buddy's blf status in the
* application will be notified about the buddy's "busy lamp field" status in the
* on_buddy_blf_state() callback.
*
* @param buddy_id Buddy identification.
Expand Down
2 changes: 1 addition & 1 deletion pjsip/include/pjsua-lib/pjsua_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ typedef struct pjsua_buddy
unsigned term_code; /**< Subscription termination code */
pj_str_t term_reason;/**< Subscription termination reason */
pjsip_pres_status status; /**< Buddy presence status. */
pjsip_blf_status blf_status;/**< Buddy blf status. */
pjsip_blf_status blf_status;/**< Buddy "busy lamp field" status.*/
pj_timer_entry timer; /**< Resubscription timer */
} pjsua_buddy;

Expand Down
Loading

0 comments on commit 2be883a

Please sign in to comment.