Ignore:
Timestamp:
Jan 4, 2007 10:45:08 PM (17 years ago)
Author:
bennylp
Message:

Just updated and improved the doxygen documentations all over the place

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h

    r865 r875  
    116116 \code 
    117117 
     118 #include <pjsua-lib/pjsua.h> 
     119 
     120 #define THIS_FILE  __FILE__ 
     121 
     122 static pj_status_t app_init(void) 
     123 { 
    118124    pjsua_config         ua_cfg; 
    119125    pjsua_logging_config log_cfg; 
    120126    pjsua_media_config   media_cfg; 
     127    pj_status_t status; 
     128 
     129    // Must create pjsua before anything else! 
     130    status = pjsua_create(); 
     131    if (status != PJ_SUCCESS) { 
     132        pjsua_perror(THIS_FILE, "Error initializing pjsua", status); 
     133        return status; 
     134    } 
    121135 
    122136    // Initialize configs with default settings. 
     
    141155          return status; 
    142156    } 
    143     .. 
    144  
     157    . 
     158    ... 
     159 } 
    145160 \endcode 
    146161 * 
     
    170185 * may add, modify, or delete accounts, buddies, or change media settings 
    171186 * during run-time. 
     187 * 
     188 * Sample code: 
     189 \code 
     190 static pj_status_t app_run(void) 
     191 { 
     192    pj_status_t status; 
     193 
     194    // Start pjsua 
     195    status = pjsua_start(); 
     196    if (status != PJ_SUCCESS) { 
     197        pjsua_destroy(); 
     198        pjsua_perror(THIS_FILE, "Error starting pjsua", status); 
     199        return status; 
     200    } 
     201 
     202    // Run application loop 
     203    while (1) { 
     204        char choice[10]; 
     205         
     206        printf("Select menu: "); 
     207        fgets(choice, sizeof(choice), stdin); 
     208        ... 
     209    } 
     210 } 
     211 \endcode 
    172212 */ 
    173213 
     
    205245 
    206246/** 
    207  * Logging configuration. 
     247 * Logging configuration, which can be (optionally) specified when calling 
     248 * #pjsua_init(). Application must call #pjsua_logging_config_default() to 
     249 * initialize this structure with the default values. 
    208250 */ 
    209251typedef struct pjsua_logging_config 
     
    279321 
    280322/** 
    281  * Application callbacks. 
     323 * This structure describes application callback to receive various event 
     324 * notification from PJSUA-API. All of these callbacks are OPTIONAL,  
     325 * although definitely application would want to implement some of 
     326 * the important callbacks (such as \a on_incoming_call). 
    282327 */ 
    283328typedef struct pjsua_callback 
     
    322367 
    323368    /** 
    324      * Notify application on call being transfered. 
     369     * Notify application on call being transfered (i.e. REFER is received). 
    325370     * Application can decide to accept/reject transfer request 
    326371     * by setting the code (default is 200). When this callback 
     
    471516 
    472517/** 
    473  * PJSUA settings. 
     518 * This structure describes the settings to control the API and 
     519 * user agent behavior, and can be specified when calling #pjsua_init(). 
     520 * Before setting the values, application must call #pjsua_config_default() 
     521 * to initialize this structure with the default values. 
    474522 */ 
    475523typedef struct pjsua_config 
     
    477525 
    478526    /**  
    479      * Maximum calls to support (default: 4)  
     527     * Maximum calls to support (default: 4). The value specified here 
     528     * must be smaller than the compile time maximum settings  
     529     * PJSUA_MAX_CALLS, which by default is 32. To increase this  
     530     * limit, the library must be recompiled with new PJSUA_MAX_CALLS 
     531     * value. 
    480532     */ 
    481533    unsigned        max_calls; 
     
    504556 
    505557    /** 
    506      * Number of outbound proxies in the array. 
     558     * Number of outbound proxies in the \a outbound_proxy array. 
    507559     */ 
    508560    unsigned        outbound_proxy_cnt; 
     
    524576    /**  
    525577     * Array of credentials. These credentials will be used by all accounts, 
    526      * and can be used to authenticate against outbound proxies. 
     578     * and can be used to authenticate against outbound proxies. If the 
     579     * credential is specific to the account, then application should set 
     580     * the credential in the pjsua_acc_config rather than the credential 
     581     * here. 
    527582     */ 
    528583    pjsip_cred_info cred_info[PJSUA_ACC_MAX_PROXIES]; 
    529584 
    530585    /** 
    531      * Application callback. 
     586     * Application callback to receive various event notifications from 
     587     * the library. 
    532588     */ 
    533589    pjsua_callback  cb; 
    534590 
    535591    /** 
    536      * User agent string (default empty) 
     592     * Optional user agent string (default empty). If it's empty, no 
     593     * User-Agent header will be sent with outgoing requests. 
    537594     */ 
    538595    pj_str_t        user_agent; 
     
    597654/** 
    598655 * This structure describes additional information to be sent with 
    599  * outgoing SIP message. 
     656 * outgoing SIP message. It can (optionally) be specified for example 
     657 * with #pjsua_call_make_call(), #pjsua_call_answer(), #pjsua_call_hangup(), 
     658 * #pjsua_call_set_hold(), #pjsua_call_send_im(), and many more. 
     659 * 
     660 * Application MUST call #pjsua_msg_data_init() to initialize this 
     661 * structure before setting its values. 
    600662 */ 
    601663typedef struct pjsua_msg_data 
     
    648710 * specified. 
    649711 * 
     712 * Note that #pjsua_create() MUST be called before calling this function. 
     713 * 
    650714 * @param ua_cfg        User agent configuration. 
    651715 * @param log_cfg       Optional logging configuration. 
     
    664728 * additional  
    665729 * 
     730 * Application may call this function anytime after #pjsua_init(). 
     731 * 
    666732 * @return              PJ_SUCCESS on success, or the appropriate error code. 
    667733 */ 
     
    670736 
    671737/** 
    672  * Destroy pjsua. This function must be called once PJSUA is created. To 
    673  * make it easier for application, application may call this function 
    674  * several times with no danger. 
     738 * Destroy pjsua. Application is recommended to perform graceful shutdown 
     739 * before calling this function (such as unregister the account from the SIP  
     740 * server, terminate presense subscription, and hangup active calls), however, 
     741 * this function will do all of these if it finds there are active sessions 
     742 * that need to be terminated. This function will approximately block for 
     743 * one second to wait for replies from remote. 
     744 * 
     745 * Application.may safely call this function more than once if it doesn't 
     746 * keep track of it's state. 
    675747 * 
    676748 * @return              PJ_SUCCESS on success, or the appropriate error code. 
     
    682754 * Poll pjsua for events, and if necessary block the caller thread for 
    683755 * the specified maximum interval (in miliseconds). 
     756 * 
     757 * Application doesn't normally need to call this function if it has 
     758 * configured worker thread (\a thread_cnt field) in pjsua_config structure, 
     759 * because polling then will be done by these worker threads instead. 
    684760 * 
    685761 * @param msec_timeout  Maximum time to wait, in miliseconds. 
     
    693769 
    694770/** 
    695  * Create memory pool. 
     771 * Create memory pool to be used by the application. Once application 
     772 * finished using the pool, it must be released with pj_pool_release(). 
    696773 * 
    697774 * @param name          Optional pool name. 
     
    719796 * Internal function to get SIP endpoint instance of pjsua, which is 
    720797 * needed for example to register module, create transports, etc. 
    721  * Probably is only valid after #pjsua_init() is called. 
     798 * Only valid after #pjsua_init() is called. 
    722799 *  
    723800 * @return              SIP endpoint instance. 
     
    735812/** 
    736813 * Internal function to get PJSUA pool factory. 
    737  * Only valid after #pjsua_init() is called. 
     814 * Only valid after #pjsua_create() is called. 
    738815 * 
    739816 * @return              Pool factory currently used by PJSUA. 
     
    749826 
    750827/** 
    751  * Verify that valid SIP url is given. 
     828 * This is a utility function to verify that valid SIP url is given. If the 
     829 * URL is valid, PJ_SUCCESS will be returned. 
    752830 * 
    753831 * @param c_url         The URL, as NULL terminated string. 
     
    759837 
    760838/** 
    761  * Display error message for the specified error code. 
     839 * This is a utility function to display error message for the specified  
     840 * error code. The error message will be sent to the log. 
    762841 * 
    763842 * @param sender        The log sender field. 
     
    796875 
    797876/** 
    798  * STUN configuration. 
     877 * This structure describes STUN configuration for SIP and media transport, 
     878 * and is embedded inside pjsua_transport_config structure. 
    799879 */ 
    800880typedef struct pjsua_stun_config 
     
    841921/** 
    842922 * Transport configuration for creating transports for both SIP 
    843  * and media. 
     923 * and media. Before setting some values to this structure, application 
     924 * MUST call #pjsua_transport_config_default() to initialize its 
     925 * values with default settings. 
    844926 */ 
    845927typedef struct pjsua_transport_config 
     
    888970 
    889971    /** 
    890      * TLS settings. 
     972     * This specifies TLS settings for TLS transport. It is only be used 
     973     * when this transport config is being used to create a SIP TLS 
     974     * transport. 
    891975     */ 
    892976    pjsip_tls_setting   tls_setting; 
     
    903987{ 
    904988    pj_bzero(cfg, sizeof(*cfg)); 
     989    pjsua_stun_config_default(&cfg->stun_config); 
    905990    pjsip_tls_setting_default(&cfg->tls_setting); 
    906991} 
     
    908993 
    909994/** 
    910  * Normalize STUN config. 
     995 * This is a utility function to normalize STUN config. It's only 
     996 * used internally by the library. 
     997 * 
     998 * @param cfg       The STUN config to be initialized. 
    911999 */ 
    9121000PJ_INLINE(void) pjsua_normalize_stun_config( pjsua_stun_config *cfg ) 
     
    9581046 
    9591047/** 
    960  * Transport info. 
     1048 * This structure describes transport information returned by 
     1049 * #pjsua_transport_get_info() function. 
    9611050 */ 
    9621051typedef struct pjsua_transport_info 
     
    10121101 
    10131102/** 
    1014  * Create SIP transport. 
     1103 * Create and start a new SIP transport according to the specified 
     1104 * settings. 
    10151105 * 
    10161106 * @param type          Transport type. 
     
    10791169 * Close the transport. If transport is forcefully closed, it will be 
    10801170 * immediately closed, and any pending transactions that are using the 
    1081  * transport may not terminate properly. Otherwise, the system will wait 
    1082  * until all transactions are closed while preventing new users from 
    1083  * using the transport, and will close the transport when it is safe to 
    1084  * do so. 
     1171 * transport may not terminate properly (it may even crash). Otherwise,  
     1172 * the system will wait until all transactions are closed while preventing  
     1173 * new users from using the transport, and will close the transport when  
     1174 * it is safe to do so. 
    10851175 * 
    10861176 * @param id            Transport ID. 
     
    11691259 
    11701260/** 
    1171  * Account configuration. 
     1261 * This structure describes account configuration to be specified when 
     1262 * adding a new account with #pjsua_acc_add(). Application MUST initialize 
     1263 * this structure first by calling #pjsua_acc_config_default(). 
    11721264 */ 
    11731265typedef struct pjsua_acc_config 
     
    11981290 
    11991291    /** 
    1200      * Publish presence? 
     1292     * If this flag is set, the presence information of this account will 
     1293     * be PUBLISH-ed to the server where the account belongs. 
    12011294     */ 
    12021295    pj_bool_t       publish_enabled; 
     
    12231316     * These proxies will be put in the route set for this account, with  
    12241317     * maintaining the orders (the first proxy in the array will be visited 
    1225      * first). 
     1318     * first). If global outbound proxies are configured in pjsua_config, 
     1319     * then these account proxies will be placed after the global outbound 
     1320     * proxies in the routeset. 
    12261321     */ 
    12271322    pj_str_t        proxy[PJSUA_ACC_MAX_PROXIES]; 
     
    13521447 
    13531448/** 
    1354  * Get default account. 
     1449 * Get default account to be used when receiving incoming requests (calls), 
     1450 * when the destination of the incoming call doesn't match any other 
     1451 * accounts. 
    13551452 * 
    13561453 * @return              The default account ID, or PJSUA_INVALID_ID if no 
     
    13621459/** 
    13631460 * Add a new account to pjsua. PJSUA must have been initialized (with 
    1364  * #pjsua_init()) before calling this function. 
     1461 * #pjsua_init()) before calling this function. If registration is configured 
     1462 * for this account, this function would also start the SIP registration 
     1463 * session with the SIP registrar server. This SIP registration session 
     1464 * will be maintained internally by the library, and application doesn't 
     1465 * need to do anything to maintain the registration session. 
     1466 * 
    13651467 * 
    13661468 * @param cfg           Account configuration. 
     
    14011503 
    14021504/** 
    1403  * Delete account. 
     1505 * Delete an account. This will unregister the account from the SIP server, 
     1506 * if necessary, and terminate server side presence subscriptions associated 
     1507 * with this account. 
    14041508 * 
    14051509 * @param acc_id        Id of the account to be deleted. 
     
    14241528/** 
    14251529 * Modify account's presence status to be advertised to remote/presence 
    1426  * subscribers. 
     1530 * subscribers. This would trigger the sending of outgoing NOTIFY request 
     1531 * if there are server side presence subscription for this account. 
    14271532 * 
    14281533 * @param acc_id        The account ID. 
     
    14361541 
    14371542/** 
    1438  * Update registration or perform unregistration.  
     1543 * Update registration or perform unregistration. If registration is 
     1544 * configured for this account, then initial SIP REGISTER will be sent 
     1545 * when the account is added with #pjsua_acc_add(). Application normally 
     1546 * only need to call this function if it wants to manually update the 
     1547 * registration or to unregister from the server. 
    14391548 * 
    14401549 * @param acc_id        The account ID. 
     
    14491558 
    14501559/** 
    1451  * Get account information. 
     1560 * Get information about the specified account. 
    14521561 * 
    14531562 * @param acc_id        Account identification. 
     
    14611570 
    14621571/** 
    1463  * Enum accounts all account ids. 
     1572 * Enumerate all account currently active in the library. This will fill 
     1573 * the array with the account Ids, and application can then query the 
     1574 * account information for each id with #pjsua_acc_get_info(). 
     1575 * 
     1576 * @see pjsua_acc_enum_info(). 
    14641577 * 
    14651578 * @param ids           Array of account IDs to be initialized. 
     
    14741587 
    14751588/** 
    1476  * Enum accounts info. 
     1589 * Enumerate account informations. 
    14771590 * 
    14781591 * @param info          Array of account infos to be initialized. 
     
    15621675 
    15631676/** 
    1564  * Max simultaneous calls. 
     1677 * Maximum simultaneous calls. 
    15651678 */ 
    15661679#ifndef PJSUA_MAX_CALLS 
     
    15711684 
    15721685/** 
    1573  * Call media status. 
     1686 * This enumeration specifies the media status of a call, and it's part 
     1687 * of pjsua_call_info structure. 
    15741688 */ 
    15751689typedef enum pjsua_call_media_status 
    15761690{ 
     1691    /** Call currently has no media */ 
    15771692    PJSUA_CALL_MEDIA_NONE, 
     1693 
     1694    /** The media is active */ 
    15781695    PJSUA_CALL_MEDIA_ACTIVE, 
     1696 
     1697    /** The media is currently put on hold by local endpoint */ 
    15791698    PJSUA_CALL_MEDIA_LOCAL_HOLD, 
     1699 
     1700    /** The media is currently put on hold by remote endpoint */ 
    15801701    PJSUA_CALL_MEDIA_REMOTE_HOLD, 
     1702 
    15811703} pjsua_call_media_status; 
    15821704 
    15831705 
    15841706/** 
    1585  * Call info. 
     1707 * This structure describes the information and current status of a call. 
    15861708 */ 
    15871709typedef struct pjsua_call_info 
     
    16691791 
    16701792/** 
    1671  * Enumerate all active calls. 
     1793 * Enumerate all active calls. Application may then query the information and 
     1794 * state of each call by calling #pjsua_call_get_info(). 
    16721795 * 
    16731796 * @param ids           Array of account IDs to be initialized. 
     
    17481871 
    17491872/** 
    1750  * Attach application specific data to the call. 
     1873 * Attach application specific data to the call. Application can then 
     1874 * inspect this data by calling #pjsua_call_get_user_data(). 
    17511875 * 
    17521876 * @param call_id       Call identification. 
     
    17601884 
    17611885/** 
    1762  * Get user data attached to the call. 
     1886 * Get user data attached to the call, which has been previously set with 
     1887 * #pjsua_call_set_user_data(). 
    17631888 * 
    17641889 * @param call_id       Call identification. 
     
    17701895 
    17711896/** 
    1772  * Send response to incoming INVITE request. 
     1897 * Send response to incoming INVITE request. Depending on the status 
     1898 * code specified as parameter, this function may send provisional 
     1899 * response, establish the call, or terminate the call. 
    17731900 * 
    17741901 * @param call_id       Incoming call identification. 
     
    17881915/** 
    17891916 * Hangup call by using method that is appropriate according to the 
    1790  * call state. 
     1917 * call state. This function is different than answering the call with 
     1918 * 3xx-6xx response (with #pjsua_call_answer()), in that this function 
     1919 * will hangup the call regardless of the state and role of the call, 
     1920 * while #pjsua_call_answer() only works with incoming calls on EARLY 
     1921 * state. 
    17911922 * 
    17921923 * @param call_id       Call identification. 
     
    18081939 
    18091940/** 
    1810  * Put the specified call on hold. 
     1941 * Put the specified call on hold. This will send re-INVITE with the 
     1942 * appropriate SDP to inform remote that the call is being put on hold. 
     1943 * The final status of the request itself will be reported on the 
     1944 * \a on_call_media_state() callback, which inform the application that 
     1945 * the media state of the call has changed. 
    18111946 * 
    18121947 * @param call_id       Call identification. 
     
    18211956 
    18221957/** 
    1823  * Send re-INVITE (to release hold). 
     1958 * Send re-INVITE to release hold. 
     1959 * The final status of the request itself will be reported on the 
     1960 * \a on_call_media_state() callback, which inform the application that 
     1961 * the media state of the call has changed. 
    18241962 * 
    18251963 * @param call_id       Call identification. 
     
    18401978 * REFER request to instruct remote call party to initiate a new INVITE 
    18411979 * session to the specified destination/target. 
     1980 * 
     1981 * If application is interested to monitor the successfulness and  
     1982 * the progress of the transfer request, it can implement  
     1983 * \a on_call_transfer_status() callback which will report the progress 
     1984 * of the call transfer request. 
    18421985 * 
    18431986 * @param call_id       The call id to be transfered. 
     
    19302073 
    19312074/** 
    1932  * Terminate all calls. 
     2075 * Terminate all calls. This will initiate #pjsua_call_hangup() for all 
     2076 * currently active calls.  
    19332077 */ 
    19342078PJ_DECL(void) pjsua_call_hangup_all(void); 
     
    19782122 
    19792123/** 
    1980  * Buddy configuration. 
     2124 * This structure describes buddy configuration when adding a buddy to 
     2125 * the buddy list with #pjsua_buddy_add(). Application MUST initialize 
     2126 * the structure with #pjsua_buddy_config_default() to initialize this 
     2127 * structure with default configuration. 
    19812128 */ 
    19822129typedef struct pjsua_buddy_config 
     
    19962143 
    19972144/** 
    1998  * Buddy's online status. 
     2145 * This enumeration describes basic buddy's online status. 
    19992146 */ 
    20002147typedef enum pjsua_buddy_status 
     
    20212168 
    20222169/** 
    2023  * Buddy info. 
     2170 * This structure describes buddy info, which can be retrieved by calling 
     2171 * #pjsua_buddy_get_info(). 
    20242172 */ 
    20252173typedef struct pjsua_buddy_info 
     
    20662214 
    20672215/** 
     2216 * Set default values to the buddy config. 
     2217 */ 
     2218PJ_INLINE(void) pjsua_buddy_config_default(pjsua_buddy_config *cfg) 
     2219{ 
     2220    pj_bzero(cfg, sizeof(*cfg)); 
     2221} 
     2222 
     2223 
     2224/** 
    20682225 * Get total number of buddies. 
    20692226 * 
     
    20842241 
    20852242/** 
    2086  * Enum buddy IDs. 
     2243 * Enumerate all buddy IDs in the buddy list. Application then can use 
     2244 * #pjsua_buddy_get_info() to get the detail information for each buddy 
     2245 * id. 
    20872246 * 
    20882247 * @param ids           Array of ids to be initialized. 
     
    21082267 
    21092268/** 
    2110  * Add new buddy. 
     2269 * Add new buddy to the buddy list. If presence subscription is enabled 
     2270 * for this buddy, this function will also start the presence subscription 
     2271 * session immediately. 
    21112272 * 
    21122273 * @param cfg           Buddy configuration. 
     
    21202281 
    21212282/** 
    2122  * Delete buddy. 
     2283 * Delete the specified buddy from the buddy list. Any presence subscription 
     2284 * to this buddy will be terminated. 
    21232285 * 
    21242286 * @param buddy_id      Buddy identification. 
     
    21302292 
    21312293/** 
    2132  * Enable/disable buddy's presence monitoring. 
     2294 * Enable/disable buddy's presence monitoring. Once buddy's presence is 
     2295 * subscribed, application will be informed about buddy's presence status 
     2296 * changed via \a on_buddy_state() callback. 
    21332297 * 
    21342298 * @param buddy_id      Buddy identification. 
     
    21432307 
    21442308/** 
    2145  * Dump presence subscriptions to log file. 
     2309 * Dump presence subscriptions to log. 
    21462310 * 
    21472311 * @param verbose       Yes or no. 
     
    22712435#endif 
    22722436 
     2437/** 
     2438 * The default clock rate to be used by the conference bridge. 
     2439 */ 
    22732440#ifndef PJSUA_DEFAULT_CLOCK_RATE 
    22742441#   define PJSUA_DEFAULT_CLOCK_RATE     16000 
    22752442#endif 
    22762443 
     2444/** 
     2445 * Default codec quality settings. 
     2446 */ 
    22772447#ifndef PJSUA_DEFAULT_CODEC_QUALITY 
    22782448#   define PJSUA_DEFAULT_CODEC_QUALITY  5 
    22792449#endif 
    22802450 
     2451/** 
     2452 * Default iLBC mode. 
     2453 */ 
    22812454#ifndef PJSUA_DEFAULT_ILBC_MODE 
    22822455#   define PJSUA_DEFAULT_ILBC_MODE      20 
    22832456#endif 
    22842457 
    2285  
     2458/** 
     2459 * The default echo canceller tail length. 
     2460 */ 
    22862461#ifndef PJSUA_DEFAULT_EC_TAIL_LEN 
    22872462#   define PJSUA_DEFAULT_EC_TAIL_LEN    800 
     
    22902465 
    22912466/** 
    2292  * Media configuration. 
     2467 * This structure describes media configuration, which will be specified 
     2468 * when calling #pjsua_init(). Application MUST initialize this structure 
     2469 * by calling #pjsua_media_config_default(). 
    22932470 */ 
    22942471struct pjsua_media_config 
     
    22962473    /** 
    22972474     * Clock rate to be applied to the conference bridge. 
    2298      * If value is zero, default clock rate will be used (16KHz). 
     2475     * If value is zero, default clock rate will be used  
     2476     * (PJSUA_DEFAULT_CLOCK_RATE, which by default is 16KHz). 
    22992477     */ 
    23002478    unsigned            clock_rate; 
     
    24442622 
    24452623/** 
    2446  * Codec config. 
     2624 * This structure describes codec information, which can be retrieved by 
     2625 * calling #pjsua_enum_codecs(). 
    24472626 */ 
    24482627typedef struct pjsua_codec_info 
     
    24672646 
    24682647/** 
    2469  * Conference port info. 
     2648 * This structure descibes information about a particular media port that 
     2649 * has been registered into the conference bridge. Application can query 
     2650 * this info by calling #pjsua_conf_get_port_info(). 
    24702651 */ 
    24712652typedef struct pjsua_conf_port_info 
     
    25852766/** 
    25862767 * Remove arbitrary slot from the conference bridge. Application should only 
    2587  * call this function if it registered the port manually. 
     2768 * call this function if it registered the port manually with previous call 
     2769 * to #pjsua_conf_add_port(). 
    25882770 * 
    25892771 * @param id            The slot id of the port to be removed. 
     
    28183000 
    28193001/** 
    2820  * Enum sound devices. 
     3002 * Enum all sound devices installed in the system. 
    28213003 * 
    28223004 * @param info          Array of info to be initialized. 
Note: See TracChangeset for help on using the changeset viewer.