|
HOME
SIP/media Features
High Performance SIP
Small Footprint SIP
Symbian Port
FAQ
Documentation
Licensing
Download
Development (Trac)
Projects using pjsip
Mailing List
Open Source Links
About: PJLIB, PJLIB-UTIL, PJSIP, and PJMEDIA are created by: Benny Prijono <bennylp pjsip.org>
|
|
Home --> Documentations --> PJSIP Reference
Detailed Description
PJSUA accounts provide identity (or identities) of the user who is currently using the application. In SIP terms, the identity is used as the From header in outgoing requests.
PJSUA-API supports creating and managing multiple accounts. The maximum number of accounts is limited by a compile time constant PJSUA_MAX_ACC.
Account may or may not have client registration associated with it. An account is also associated with route set and some authentication credentials, which are used when sending SIP request messages using the account. An account also has presence's online status, which will be reported to remote peer when they subscribe to the account's presence, or which is published to a presence server if presence publication is enabled for the account.
At least one account MUST be created in the application. If no user association is required, application can create a userless account by calling pjsua_acc_add_local(). A userless account identifies local endpoint instead of a particular user, and it correspond with a particular transport instance.
Also one account must be set as the default account, which is used as the account to use when PJSUA fails to match a request with any other accounts.
When sending outgoing SIP requests (such as making calls or sending instant messages), normally PJSUA requires the application to specify which account to use for the request. If no account is specified, PJSUA may be able to select the account by matching the destination domain name, and fall back to default account when no match is found.
|
Data Structures |
| struct | pjsua_acc_config |
| struct | pjsua_acc_info |
Defines |
| #define | PJSUA_MAX_ACC 8 |
| #define | PJSUA_REG_INTERVAL 300 |
| #define | PJSUA_UNREG_TIMEOUT 4000 |
| #define | PJSUA_PUBLISH_EXPIRATION PJSIP_PUBC_EXPIRATION_NOT_SPECIFIED |
| #define | PJSUA_DEFAULT_ACC_PRIORITY 0 |
| #define | PJSUA_SECURE_SCHEME "sip" |
| #define | PJSUA_UNPUBLISH_MAX_WAIT_TIME_MSEC 2000 |
Functions |
| void | pjsua_acc_config_default (pjsua_acc_config *cfg) |
| void | pjsua_acc_config_dup (pj_pool_t *pool, pjsua_acc_config *dst, const pjsua_acc_config *src) |
| unsigned | pjsua_acc_get_count (void) |
| pj_bool_t | pjsua_acc_is_valid (pjsua_acc_id acc_id) |
| pj_status_t | pjsua_acc_set_default (pjsua_acc_id acc_id) |
| pjsua_acc_id | pjsua_acc_get_default (void) |
| pj_status_t | pjsua_acc_add (const pjsua_acc_config *acc_cfg, pj_bool_t is_default, pjsua_acc_id *p_acc_id) |
| pj_status_t | pjsua_acc_add_local (pjsua_transport_id tid, pj_bool_t is_default, pjsua_acc_id *p_acc_id) |
| pj_status_t | pjsua_acc_set_user_data (pjsua_acc_id acc_id, void *user_data) |
| void * | pjsua_acc_get_user_data (pjsua_acc_id acc_id) |
| pj_status_t | pjsua_acc_del (pjsua_acc_id acc_id) |
| pj_status_t | pjsua_acc_modify (pjsua_acc_id acc_id, const pjsua_acc_config *acc_cfg) |
| pj_status_t | pjsua_acc_set_online_status (pjsua_acc_id acc_id, pj_bool_t is_online) |
| pj_status_t | pjsua_acc_set_online_status2 (pjsua_acc_id acc_id, pj_bool_t is_online, const pjrpid_element *pr) |
| pj_status_t | pjsua_acc_set_registration (pjsua_acc_id acc_id, pj_bool_t renew) |
| pj_status_t | pjsua_acc_get_info (pjsua_acc_id acc_id, pjsua_acc_info *info) |
| pj_status_t | pjsua_enum_accs (pjsua_acc_id ids[], unsigned *count) |
| pj_status_t | pjsua_acc_enum_info (pjsua_acc_info info[], unsigned *count) |
| pjsua_acc_id | pjsua_acc_find_for_outgoing (const pj_str_t *url) |
| pjsua_acc_id | pjsua_acc_find_for_incoming (pjsip_rx_data *rdata) |
| pj_status_t | pjsua_acc_create_request (pjsua_acc_id acc_id, const pjsip_method *method, const pj_str_t *target, pjsip_tx_data **p_tdata) |
| pj_status_t | pjsua_acc_create_uac_contact (pj_pool_t *pool, pj_str_t *contact, pjsua_acc_id acc_id, const pj_str_t *uri) |
| pj_status_t | pjsua_acc_create_uas_contact (pj_pool_t *pool, pj_str_t *contact, pjsua_acc_id acc_id, pjsip_rx_data *rdata) |
| pj_status_t | pjsua_acc_set_transport (pjsua_acc_id acc_id, pjsua_transport_id tp_id) |
Define Documentation
| #define PJSUA_REG_INTERVAL 300 |
Default registration interval.
| #define PJSUA_UNREG_TIMEOUT 4000 |
Default maximum time to wait for account unregistration transactions to complete during library shutdown sequence.
Default: 4000 (4 seconds)
| #define PJSUA_PUBLISH_EXPIRATION PJSIP_PUBC_EXPIRATION_NOT_SPECIFIED |
Default PUBLISH expiration
| #define PJSUA_DEFAULT_ACC_PRIORITY 0 |
Default account priority.
| #define PJSUA_SECURE_SCHEME "sip" |
This macro specifies the URI scheme to use in Contact header when secure transport such as TLS is used. Application can specify either "sip" or "sips".
| #define PJSUA_UNPUBLISH_MAX_WAIT_TIME_MSEC 2000 |
Maximum time to wait for unpublication transaction(s) to complete during shutdown process, before sending unregistration. The library tries to wait for the unpublication (un-PUBLISH) to complete before sending REGISTER request to unregister the account, during library shutdown process. If the value is set too short, it is possible that the unregistration is sent before unpublication completes, causing unpublication request to fail.
Default: 2000 (2 seconds)
Function Documentation
Call this function to initialize account config with default values.
- Parameters:
-
| cfg | The account config to be initialized. |
Duplicate account config.
- Parameters:
-
| pool | Pool to be used for duplicating the config. |
| dst | Destination configuration. |
| src | Source configuration. |
| unsigned pjsua_acc_get_count |
( |
void |
|
) |
|
Get number of current accounts.
- Returns:
- Current number of accounts.
Check if the specified account ID is valid.
- Parameters:
-
| acc_id | Account ID to check. |
- Returns:
- Non-zero if account ID is valid.
Set default account to be used when incoming and outgoing requests doesn't match any accounts.
- Parameters:
-
| acc_id | The account ID to be used as default. |
- Returns:
- PJ_SUCCESS on success.
Get default account to be used when receiving incoming requests (calls), when the destination of the incoming call doesn't match any other accounts.
- Returns:
- The default account ID, or PJSUA_INVALID_ID if no default account is configured.
Add a new account to pjsua. PJSUA must have been initialized (with pjsua_init()) before calling this function. If registration is configured for this account, this function would also start the SIP registration session with the SIP registrar server. This SIP registration session will be maintained internally by the library, and application doesn't need to do anything to maintain the registration session.
- Parameters:
-
| acc_cfg | Account configuration. |
| is_default | If non-zero, this account will be set as the default account. The default account will be used when sending outgoing requests (e.g. making call) when no account is specified, and when receiving incoming requests when the request does not match any accounts. It is recommended that default account is set to local/LAN account. |
| p_acc_id | Pointer to receive account ID of the new account. |
- Returns:
- PJ_SUCCESS on success, or the appropriate error code.
Add a local account. A local account is used to identify local endpoint instead of a specific user, and for this reason, a transport ID is needed to obtain the local address information.
- Parameters:
-
| tid | Transport ID to generate account address. |
| is_default | If non-zero, this account will be set as the default account. The default account will be used when sending outgoing requests (e.g. making call) when no account is specified, and when receiving incoming requests when the request does not match any accounts. It is recommended that default account is set to local/LAN account. |
| p_acc_id | Pointer to receive account ID of the new account. |
- Returns:
- PJ_SUCCESS on success, or the appropriate error code.
Set arbitrary data to be associated with the account.
- Parameters:
-
| acc_id | The account ID. |
| user_data | User/application data. |
- Returns:
- PJ_SUCCESS on success, or the appropriate error code.
Retrieve arbitrary data associated with the account.
- Parameters:
-
- Returns:
- The user data. In the case where the account ID is not valid, NULL is returned.
Delete an account. This will unregister the account from the SIP server, if necessary, and terminate server side presence subscriptions associated with this account.
- Parameters:
-
| acc_id | Id of the account to be deleted. |
- Returns:
- PJ_SUCCESS on success, or the appropriate error code.
Modify account information.
- Parameters:
-
| acc_id | Id of the account to be modified. |
| acc_cfg | New account configuration. |
- Returns:
- PJ_SUCCESS on success, or the appropriate error code.
Modify account's presence status to be advertised to remote/presence subscribers. This would trigger the sending of outgoing NOTIFY request if there are server side presence subscription for this account, and/or outgoing PUBLISH if presence publication is enabled for this account.
- See also:
- pjsua_acc_set_online_status2()
- Parameters:
-
| acc_id | The account ID. |
| is_online | True of false. |
- Returns:
- PJ_SUCCESS on success, or the appropriate error code.
Modify account's presence status to be advertised to remote/presence subscribers. This would trigger the sending of outgoing NOTIFY request if there are server side presence subscription for this account, and/or outgoing PUBLISH if presence publication is enabled for this account.
- See also:
- pjsua_acc_set_online_status()
- Parameters:
-
| acc_id | The account ID. |
| is_online | True of false. |
| pr | Extended information in subset of RPID format which allows setting custom presence text. |
- Returns:
- PJ_SUCCESS on success, or the appropriate error code.
Update registration or perform unregistration. If registration is configured for this account, then initial SIP REGISTER will be sent when the account is added with pjsua_acc_add(). Application normally only need to call this function if it wants to manually update the registration or to unregister from the server.
- Parameters:
-
| acc_id | The account ID. |
| renew | If renew argument is zero, this will start unregistration process. |
- Returns:
- PJ_SUCCESS on success, or the appropriate error code.
Get information about the specified account.
- Parameters:
-
| acc_id | Account identification. |
| info | Pointer to receive account information. |
- Returns:
- PJ_SUCCESS on success, or the appropriate error code.
Enumerate all account currently active in the library. This will fill the array with the account Ids, and application can then query the account information for each id with pjsua_acc_get_info().
- See also:
- pjsua_acc_enum_info().
- Parameters:
-
| ids | Array of account IDs to be initialized. |
| count | In input, specifies the maximum number of elements. On return, it contains the actual number of elements. |
- Returns:
- PJ_SUCCESS on success, or the appropriate error code.
Enumerate account informations.
- Parameters:
-
| info | Array of account infos to be initialized. |
| count | In input, specifies the maximum number of elements. On return, it contains the actual number of elements. |
- Returns:
- PJ_SUCCESS on success, or the appropriate error code.
This is an internal function to find the most appropriate account to used to reach to the specified URL.
- Parameters:
-
| url | The remote URL to reach. |
- Returns:
- Account id.
This is an internal function to find the most appropriate account to be used to handle incoming calls.
- Parameters:
-
| rdata | The incoming request message. |
- Returns:
- Account id.
Create arbitrary requests using the account. Application should only use this function to create auxiliary requests outside dialog, such as OPTIONS, and use the call or presence API to create dialog related requests.
- Parameters:
-
| acc_id | The account ID. |
| method | The SIP method of the request. |
| target | Target URI. |
| p_tdata | Pointer to receive the request. |
- Returns:
- PJ_SUCCESS or the error code.
Create a suitable Contact header value, based on the specified target URI for the specified account.
- Parameters:
-
| pool | Pool to allocate memory for the string. |
| contact | The string where the Contact will be stored. |
| acc_id | Account ID. |
| uri | Destination URI of the request. |
- Returns:
- PJ_SUCCESS on success, other on error.
Create a suitable Contact header value, based on the information in the incoming request.
- Parameters:
-
| pool | Pool to allocate memory for the string. |
| contact | The string where the Contact will be stored. |
| acc_id | Account ID. |
| rdata | Incoming request. |
- Returns:
- PJ_SUCCESS on success, other on error.
Lock/bind this account to a specific transport/listener. Normally application shouldn't need to do this, as transports will be selected automatically by the stack according to the destination.
When account is locked/bound to a specific transport, all outgoing requests from this account will use the specified transport (this includes SIP registration, dialog (call and event subscription), and out-of-dialog requests such as MESSAGE).
Note that transport_id may be specified in pjsua_acc_config too.
- Parameters:
-
| acc_id | The account ID. |
| tp_id | The transport ID. |
- Returns:
- PJ_SUCCESS on success.
PJSIP Open Source, high performance, small footprint, and very very portable SIP stack
Copyright (C) 2006-2008 Teluu Inc.
|
|