Home --> Documentations --> PJSIP Reference
Buddy management, buddy's presence, and instant messaging.
More...
|
void | pjsua_buddy_config_default (pjsua_buddy_config *cfg) |
|
unsigned | pjsua_get_buddy_count (void) |
|
pj_bool_t | pjsua_buddy_is_valid (pjsua_buddy_id buddy_id) |
|
pj_status_t | pjsua_enum_buddies (pjsua_buddy_id ids[], unsigned *count) |
|
pjsua_buddy_id | pjsua_buddy_find (const pj_str_t *uri) |
|
pj_status_t | pjsua_buddy_get_info (pjsua_buddy_id buddy_id, pjsua_buddy_info *info) |
|
pj_status_t | pjsua_buddy_set_user_data (pjsua_buddy_id buddy_id, void *user_data) |
|
void * | pjsua_buddy_get_user_data (pjsua_buddy_id buddy_id) |
|
pj_status_t | pjsua_buddy_add (const pjsua_buddy_config *buddy_cfg, pjsua_buddy_id *p_buddy_id) |
|
pj_status_t | pjsua_buddy_del (pjsua_buddy_id buddy_id) |
|
pj_status_t | pjsua_buddy_subscribe_pres (pjsua_buddy_id buddy_id, pj_bool_t subscribe) |
|
pj_status_t | pjsua_buddy_update_pres (pjsua_buddy_id buddy_id) |
|
pj_status_t | pjsua_pres_notify (pjsua_acc_id acc_id, pjsua_srv_pres *srv_pres, pjsip_evsub_state state, const pj_str_t *state_str, const pj_str_t *reason, pj_bool_t with_body, const pjsua_msg_data *msg_data) |
|
void | pjsua_pres_dump (pj_bool_t verbose) |
|
pj_status_t | pjsua_im_send (pjsua_acc_id acc_id, const pj_str_t *to, const pj_str_t *mime_type, const pj_str_t *content, const pjsua_msg_data *msg_data, void *user_data) |
|
pj_status_t | pjsua_im_typing (pjsua_acc_id acc_id, const pj_str_t *to, pj_bool_t is_typing, const pjsua_msg_data *msg_data) |
|
This section describes PJSUA-APIs related to buddies management, presence management, and instant messaging.
◆ PJSUA_MAX_BUDDIES
#define PJSUA_MAX_BUDDIES 256 |
Max buddies in buddy list.
◆ PJSUA_PRES_TIMER
#define PJSUA_PRES_TIMER 300 |
This specifies how long the library should wait before retrying failed SUBSCRIBE request, and there is no rule to automatically resubscribe (for example, no "retry-after" parameter in Subscription-State header).
This also controls the duration before failed PUBLISH request will be retried.
Default: 300 seconds
◆ pjsua_buddy_status
This enumeration describes basic buddy's online status.
Enumerator |
---|
PJSUA_BUDDY_STATUS_UNKNOWN | Online status is unknown (possibly because no presence subscription has been established).
|
PJSUA_BUDDY_STATUS_ONLINE | Buddy is known to be online.
|
PJSUA_BUDDY_STATUS_OFFLINE | Buddy is offline.
|
◆ pjsua_buddy_config_default()
Set default values to the buddy config.
◆ pjsua_get_buddy_count()
unsigned pjsua_get_buddy_count |
( |
void |
| ) |
|
Get total number of buddies.
- Returns
- Number of buddies.
◆ pjsua_buddy_is_valid()
Check if buddy ID is valid.
- Parameters
-
buddy_id | Buddy ID to check. |
- Returns
- Non-zero if buddy ID is valid.
◆ pjsua_enum_buddies()
Enumerate all buddy IDs in the buddy list. Application then can use pjsua_buddy_get_info() to get the detail information for each buddy id.
- Parameters
-
ids | Array of ids to be initialized. |
count | On input, specifies max elements in the array. On return, it contains actual number of elements that have been initialized. |
- Returns
- PJ_SUCCESS on success, or the appropriate error code.
◆ pjsua_buddy_find()
Find the buddy ID with the specified URI.
- Parameters
-
- Returns
- The buddy ID, or PJSUA_INVALID_ID if not found.
◆ pjsua_buddy_get_info()
Get detailed buddy info.
- Parameters
-
buddy_id | The buddy identification. |
info | Pointer to receive information about buddy. |
- Returns
- PJ_SUCCESS on success, or the appropriate error code.
◆ pjsua_buddy_set_user_data()
Set the user data associated with the buddy object.
- Parameters
-
buddy_id | The buddy identification. |
user_data | Arbitrary application data to be associated with the buddy object. |
- Returns
- PJ_SUCCESS on success, or the appropriate error code.
◆ pjsua_buddy_get_user_data()
Get the user data associated with the budy object.
- Parameters
-
buddy_id | The buddy identification. |
- Returns
- The application data.
◆ pjsua_buddy_add()
Add new buddy to the buddy list. If presence subscription is enabled for this buddy, this function will also start the presence subscription session immediately.
- Parameters
-
buddy_cfg | Buddy configuration. |
p_buddy_id | Pointer to receive buddy ID. |
- Returns
- PJ_SUCCESS on success, or the appropriate error code.
◆ pjsua_buddy_del()
Delete the specified buddy from the buddy list. Any presence subscription to this buddy will be terminated.
- Parameters
-
buddy_id | Buddy identification. |
- Returns
- PJ_SUCCESS on success, or the appropriate error code.
◆ pjsua_buddy_subscribe_pres()
Enable/disable buddy's presence monitoring. Once buddy's presence is subscribed, application will be informed about buddy's presence status changed via on_buddy_state() callback.
- Parameters
-
buddy_id | Buddy identification. |
subscribe | Specify non-zero to activate presence subscription to the specified buddy. |
- Returns
- PJ_SUCCESS on success, or the appropriate error code.
◆ pjsua_buddy_update_pres()
Update the presence information for the buddy. Although the library periodically refreshes the presence subscription for all buddies, some application may want to refresh the buddy's presence subscription immediately, and in this case it can use this function to accomplish this.
Note that the buddy's presence subscription will only be initiated if presence monitoring is enabled for the buddy. See pjsua_buddy_subscribe_pres() for more info. Also if presence subscription for the buddy is already active, this function will not do anything.
Once the presence subscription is activated successfully for the buddy, application will be notified about the buddy's presence status in the on_buddy_state() callback.
- Parameters
-
buddy_id | Buddy identification. |
- Returns
- PJ_SUCCESS on success, or the appropriate error code.
◆ pjsua_pres_notify()
Send NOTIFY to inform account presence status or to terminate server side presence subscription. If application wants to reject the incoming request, it should set the state to PJSIP_EVSUB_STATE_TERMINATED.
- Parameters
-
acc_id | Account ID. |
srv_pres | Server presence subscription instance. |
state | New state to set. |
state_str | Optionally specify the state string name, if state is not "active", "pending", or "terminated". |
reason | If the new state is PJSIP_EVSUB_STATE_TERMINATED, optionally specify the termination reason. |
with_body | If the new state is PJSIP_EVSUB_STATE_TERMINATED, this specifies whether the NOTIFY request should contain message body containing account's presence information. |
msg_data | Optional list of headers to be sent with the NOTIFY request. |
- Returns
- PJ_SUCCESS on success.
◆ pjsua_pres_dump()
Dump presence subscriptions to log.
- Parameters
-
◆ pjsua_im_send()
Send instant messaging outside dialog, using the specified account for route set and authentication.
- Parameters
-
acc_id | Account ID to be used to send the request. |
to | Remote URI. |
mime_type | Optional MIME type. If NULL, then "text/plain" is assumed. |
content | The message content. Can be NULL if msg_data specifies body and/or multipart. |
msg_data | Optional list of headers etc to be included in outgoing request. The body descriptor in the msg_data is ignored if parameter 'content' is set. |
user_data | Optional user data, which will be given back when the IM callback is called. |
- Returns
- PJ_SUCCESS on success, or the appropriate error code.
◆ pjsua_im_typing()
Send typing indication outside dialog.
- Parameters
-
acc_id | Account ID to be used to send the request. |
to | Remote URI. |
is_typing | If non-zero, it tells remote person that local person is currently composing an IM. |
msg_data | Optional list of headers etc to be added to outgoing request. |
- Returns
- PJ_SUCCESS on success, or the appropriate error code.
◆ pjsip_message_method
The MESSAGE method (defined in pjsua_im.c)
◆ pjsip_info_method
The INFO method (defined in pjsua_call.c)
PJSIP Open Source, high performance, small footprint, and very very portable SIP stack
Copyright (C) 2006-2008 Teluu Inc.
|