Загрузка данных


typedef struct pjsua_acc_config
{
    /**
     * Arbitrary user data to be associated with the newly created account.Application may set this later with #pjsua_acc_set_user_data() and
     * retrieve it with #pjsua_acc_get_user_data().
     */
    void           *user_data;
     * Account priority, which is used to control the order of matching incoming/outgoing requests. The higher the number means the higher
     * the priority is, and the account will be matched first.
    int             priority;
     * The full SIP URL for the account. The value can take name address or 
     * URL format, and will look something like "sip:account@serviceprovider"
     * or "\"Display Name\" <sip:account@provider>".
    pj_str_t        id;
     * This is the URL to be put in the request URI for the registration,
     * and will look something like "sip:serviceprovider".
    pj_str_t        reg_uri;
     * The optional custom SIP headers to be put in the registration
     * request.
    pjsip_hdr       reg_hdr_list;
     * Additional parameters that will be appended in the Contact header
     * for this account. This will only affect REGISTER requests and
     * will be appended after \a contact_params;
     * The parameters should be preceeded by semicolon, and all strings must
     * be properly escaped. Example:
     *   ";my-param=X;another-param=Hi%20there"
    pj_str_t        reg_contact_params;
     * Additional URI parameters that will be appended in the Contact URI
     * for this account. This will only affect REGISTER requests and
     * will be appended after \a contact_uri_params;
     * The parameters should be preceeded by semicolon, and all strings must
     * be properly escaped. Example:
     *   ";my-param=X;another-param=Hi%20there"
    pj_str_t        reg_contact_uri_params;

     * The optional custom SIP headers to be put in the presence
     * subscription request.
    pjsip_hdr       sub_hdr_list;
     * Subscribe to message waiting indication events (RFC 3842).
     * See also \a enable_unsolicited_mwi field on #pjsua_config.
     * Default: no
    pj_bool_t       mwi_enabled;
     * Specify the default expiration time for Message Waiting Indication
     * (RFC 3842) event subscription. This must not be zero.
     * Default: PJSIP_MWI_DEFAULT_EXPIRES
    unsigned        mwi_expires;
     * If this flag is set, the presence information of this account will
     * be PUBLISH-ed to the server where the account belongs.
     * Default: PJ_FALSE
    pj_bool_t       publish_enabled;
     * Event publication options.
    pjsip_publishc_opt  publish_opt;
     * Maximum time to wait for unpublication transaction(s) to complete
     * Defalt: PJSUA_UNPUBLISH_MAX_WAIT_TIME_MSEC
    unsigned        unpublish_max_wait_time_msec;
     * Authentication preference.
    pjsip_auth_clt_pref auth_pref;
     * Optional PIDF tuple ID for outgoing PUBLISH and NOTIFY. If this value
     * is not specified, a random string will be used.
    pj_str_t        pidf_tuple_id;
     * Optional URI to be put as Contact for this account. It is recommended
     * that this field is left empty, so that the value will be calculated
     * automatically based on the transport address.
    pj_str_t        force_contact;
    /* * Additional parameters that will be appended in the Contact header
     * for this account. This will affect the Contact header in all SIP 
     * messages sent on behalf of this account, including but not limited to
     * REGISTER, INVITE, and SUBCRIBE requests or responses.
     *
     * The parameters should be preceeded by semicolon, and all strings must
     * be properly escaped. Example:
     *   ";my-param=X;another-param=Hi%20there"
     */
    pj_str_t        contact_params;

    /**
     * Additional URI parameters that will be appended in the Contact URI
     * for this account. This will affect the Contact URI in all SIP
     * messages sent on behalf of this account, including but not limited to
     * REGISTER, INVITE, and SUBCRIBE requests or responses.
     * The parameters should be preceeded by semicolon, and all strings must
     * be properly escaped. Example:
     *   ";my-param=X;another-param=Hi%20there"
     */
    pj_str_t        contact_uri_params;

    /**
     * Specify how support for reliable provisional response (100rel/
     * PRACK) should be used for all sessions in this account. See the
     * documentation of pjsua_100rel_use enumeration for more info.
     *
     * Default: The default value is taken from the value of
     *          require_100rel in pjsua_config.
     */
    pjsua_100rel_use require_100rel;

    /**
     * Specify the usage of Session Timers for all sessions. See the
     * #pjsua_sip_timer_use for possible values.
     *
     * Default: PJSUA_SIP_TIMER_OPTIONAL
     */
    pjsua_sip_timer_use use_timer;

    /**
     * Specify the usage of SIPREC sessions. See the
     * #pjsua_sip_siprec_use for possible values.
     *
     * Default: PJSUA_SIP_SIPREC_INACTIVE
     */
    pjsua_sip_siprec_use use_siprec;

    /**
     * Specify Session Timer settings, see #pjsip_timer_setting. 
     */
    pjsip_timer_setting timer_setting;

    /**
     * Number of proxies in the proxy array below.
     */
    unsigned        proxy_cnt;

    /** 
     * Optional URI of the proxies to be visited for all outgoing requests 
     * that are using this account (REGISTER, INVITE, etc). Application need 
     * to specify these proxies if the service provider requires that requests
     * destined towards its network should go through certain proxies first
     * (for example, border controllers).
     *
     * These proxies will be put in the route set for this account, with 
     * maintaining the orders (the first proxy in the array will be visited
     * first). If global outbound proxies are configured in pjsua_config,
     * then these account proxies will be placed after the global outbound
     * proxies in the routeset.
     */
    pj_str_t        proxy[PJSUA_ACC_MAX_PROXIES];

    /**
     * If remote sends SDP answer containing more than one format or codec in
     * the media line, send re-INVITE or UPDATE with just one codec to lock
     * which codec to use.
     *
     * Default: 1 (Yes). Set to zero to disable.
     */
    unsigned        lock_codec;

    /** 
     * Optional interval for registration, in seconds. If the value is zero, 
     * default interval will be used (PJSUA_REG_INTERVAL, 300 seconds).
     */
    unsigned        reg_timeout;

    /**
     * Specify the number of seconds to refresh the client registration
     * before the registration expires.
     *
     * Default: PJSIP_REGISTER_CLIENT_DELAY_BEFORE_REFRESH, 5 seconds
     */
    unsigned        reg_delay_before_refresh;

    /**
     * Specify the maximum time to wait for unregistration requests to
     * complete during library shutdown sequence.
     *
     * Default: PJSUA_UNREG_TIMEOUT
     */
    unsigned        unreg_timeout;

    /** 
     * Number of credentials in the credential array.
     */
    unsigned        cred_count;

    /** 
     * Array of credentials. If registration is desired, normally there should
     * be at least one credential specified, to successfully authenticate
     * against the service provider. More credentials can be specified, for
     * example when the requests are expected to be challenged by the
     * proxies in the route set.
     */
    pjsip_cred_info cred_info[PJSUA_ACC_MAX_PROXIES];

    /**
     * Optionally bind this account to specific transport. This normally is
     * not a good idea, as account should be able to send requests using
     * any available transports according to the destination. But some
     * application may want to have explicit control over the transport to
     * use, so in that case it can set this field.
     *
     * Default: -1 (PJSUA_INVALID_ID)
     *
     * @see pjsua_acc_set_transport()
     */
    pjsua_transport_id  transport_id;

    /**
     * This option is used to update the transport address and the Contact
     * header of REGISTER request. When this option is  enabled, the library 
     * will keep track of the public IP address from the response of REGISTER
     * request. Once it detects that the address has changed, it will 
     * unregister current Contact, update the Contact with transport address
     * learned from Via header, and register a new Contact to the registrar.
     * This will also update the public name of UDP transport if STUN is
     * configured.
     *
     * Possible values:
     * * 0 (disabled).
     * * 1 (enabled). Update except if both Contact and server's IP address
     * are public but response contains private IP.
     * * 2 (enabled). Update without exception.
     * 
     * See also contact_rewrite_method field.
     *
     * Default: 1
     */
    pj_bool_t allow_contact_rewrite;

    /**
     * Specify how Contact update will be done with the registration, if
     * \a allow_contact_rewrite is enabled. The value is bitmask combination of
     * \a pjsua_contact_rewrite_method. See also pjsua_contact_rewrite_method.
     *
     * Value PJSUA_CONTACT_REWRITE_UNREGISTER(1) is the legacy behavior.
     *
     * Default value: PJSUA_CONTACT_REWRITE_METHOD
     * (PJSUA_CONTACT_REWRITE_NO_UNREG | PJSUA_CONTACT_REWRITE_ALWAYS_UPDATE)
     */
    int              contact_rewrite_method;

    /**
     * Specify if source TCP port should be used as the initial Contact
     * address if TCP/TLS transport is used. Note that this feature will
     * be automatically turned off when nameserver is configured because
     * it may yield different destination address due to DNS SRV resolution.
     * Also some platforms are unable to report the local address of the
     * TCP socket when it is still connecting. In these cases, this
     * feature will also be turned off.
     *
     * Default: PJ_TRUE (yes).
     */
    pj_bool_t        contact_use_src_port;

    /**
     * This option is used to overwrite the "sent-by" field of the Via header
     * for outgoing messages with the same interface address as the one in
     * the REGISTER request, as long as the request uses the same transport
     * instance as the previous REGISTER request.
     *
     * Default: 1 (yes)
     */
    pj_bool_t        allow_via_rewrite;

    /**
     * This option controls whether the IP address in SDP should be replaced
     * with the IP address found in Via header of the REGISTER response, ONLY
     * when STUN and ICE are not used. If the value is FALSE (the original
     * behavior), then the local IP address will be used. If TRUE, and when
     * STUN and ICE are disabled, then the IP address found in registration
     * response will be used.
     *
     * Default: PJ_FALSE (no)
     */
    pj_bool_t        allow_sdp_nat_rewrite;

    /**
     * Control the use of SIP outbound feature. SIP outbound is described in
     * RFC 5626 to enable proxies or registrar to send inbound requests back
     * to UA using the same connection initiated by the UA for its
     * registration. This feature is highly useful in NAT-ed deployemtns,
     * hence it is enabled by default.
     *
     * Note: currently SIP outbound can only be used with TCP and TLS
     * transports. If UDP is used for the registration, the SIP outbound
     * feature will be silently ignored for the account.
     *
     * Default: PJ_TRUE
     */
    unsigned         use_rfc5626;

    /**
     * Specify SIP outbound (RFC 5626) instance ID to be used by this
     * application. If empty, an instance ID will be generated based on
     * the hostname of this agent. If application specifies this parameter, the
     * value will look like "<urn:uuid:00000000-0000-1000-8000-AABBCCDDEEFF>"
     * without the doublequote.
     *
     * Default: empty
     */
    pj_str_t         rfc5626_instance_id;

    /**
     * Specify SIP outbound (RFC 5626) registration ID. The default value
     * is empty, which would cause the library to automatically generate
     * a suitable value.
     *
     * Default: empty
     */
    pj_str_t         rfc5626_reg_id;

    /**
     * Set the interval for periodic keep-alive transmission for this account.
     * If this value is zero, keep-alive will be disabled for this account.
     * The keep-alive transmission will be sent to the registrar's address,
     * after successful registration.
     *
     * Default: 15 (seconds)
     */
    unsigned         ka_interval;

    /**
     * Specify the data to be transmitted as keep-alive packets.
     *
     * Default: CR-LF
     */
    pj_str_t         ka_data;

    /**
     * Specifies text stream redundancy level, as specified in RFC 4103
     * and 2198. When redundancy is enabled, each packet transmission
     * will contain the current text data as well as a number of the
     * previously transmitted text data to provide levels of redundancy.
     * This mechanism offers protection against loss of data at the cost
     * of additional bandwidth required.
     *
     * Value is integer indicating redundancy levels, i.e. the number
     * of previous text data to be included with the current packet.
     * (0 means disabled/no redundancy).
     * A value of 1 provides an adequate protection against an average
     * packet loss of up to 50%, while 2 can potentially protect
     * against 66.7%.
     * The maximum value is determined by PJMEDIA_TXT_STREAM_MAX_RED_LEVELS.
     *
     * Note that the redundancy level actually used is subject to remote
     * capability and we will opt to use the lower redundancy value based
     * on the result of SDP negotiation.
     *
     * Default: PJSUA_TXT_DEFAULT_REDUNDANCY_LEVEL (2), as per the
     * recommendation of RFC 4103.
     */
    int              txt_red_level;

    /**
     * Specify whether incoming video should be shown to screen by default.
     * This applies to incoming call (INVITE), incoming re-INVITE, and
     * incoming UPDATE requests.
     *
     * Regardless of this setting, application can detect incoming video
     * by implementing \a on_call_media_state() callback and enumerating
     * the media stream(s) with #pjsua_call_get_info(). Once incoming
     * video is recognised, application may retrieve the window associated
     * with the incoming video and show or hide it with
     * #pjsua_vid_win_set_show().
     *
     * Default: PJ_FALSE
     */
    pj_bool_t        vid_in_auto_show;

    /**
     * Specify whether outgoing video should be activated by default when
     * making outgoing calls and/or when incoming video is detected. This
     * applies to incoming and outgoing calls, incoming re-INVITE, and
     * incoming UPDATE. If the setting is non-zero, outgoing video
     * transmission will be started as soon as response to these requests
     * is sent (or received).
     *
     * Regardless of the value of this setting, application can start and
     * stop outgoing video transmission with #pjsua_call_set_vid_strm().
     *
     * Default: PJ_FALSE
     */
    pj_bool_t        vid_out_auto_transmit;

    /**
     * Specify video window's flags. The value is a bitmask combination of
     * #pjmedia_vid_dev_wnd_flag.
     *
     * Default: 0
     */
    unsigned         vid_wnd_flags;

    /**
     * Specify the default capture device to be used by this account. If
     * \a vid_out_auto_transmit is enabled, this device will be used for
     * capturing video.
     *
     * Default: PJMEDIA_VID_DEFAULT_CAPTURE_DEV
     */
    pjmedia_vid_dev_index vid_cap_dev;

    /**
     * Specify the default rendering device to be used by this account.
     *
     * Default: PJMEDIA_VID_DEFAULT_RENDER_DEV
     */
    pjmedia_vid_dev_index vid_rend_dev;

    /**
     * Specify the send rate control for video stream.
     *
     * Default: see #pjmedia_vid_stream_rc_config
     */
    pjmedia_vid_stream_rc_config vid_stream_rc_cfg;

    /**
     * Specify the send keyframe config for video stream.
     *
     * Default: see #pjmedia_vid_stream_sk_config
     */
    pjmedia_vid_stream_sk_config vid_stream_sk_cfg;

    /**
     * Media transport config.
     * 
     * For \a port and \a port_range settings, RTCP port is selected as 
     * RTP port+1.
     * Example: \a port=5000, \a port_range=4
     * - Available ports: 5000, 5002, 5004 (Media/RTP transport)
     *                    5001, 5003, 5005 (Media/RTCP transport)
     */
    pjsua_transport_config rtp_cfg;

    /**
     * Specify NAT64 options.
     *
     * Default: PJSUA_NAT64_DISABLED
     */
    pjsua_nat64_opt             nat64_opt;

    /**
     * Specify whether IPv6 should be used for SIP signalling.
     *
     * Default: PJSUA_IPV6_ENABLED_NO_PREFERENCE
     * (IP version used will be based on the address resolution
     * returned by OS/resolver)
     */
    pjsua_ipv6_use              ipv6_sip_use;

    /**
     * Specify whether IPv6 should be used on media.
     *
     * Default: PJSUA_IPV6_ENABLED_PREFER_IPV4
     * (Dual stack media, capable to use IPv4/IPv6.
     * Outgoing offer will prefer to use IPv4)
     */
    pjsua_ipv6_use              ipv6_media_use;

    /**
     * Control the use of STUN for the SIP signaling.
     *
     * Default: PJSUA_STUN_USE_DEFAULT
     */
    pjsua_stun_use              sip_stun_use;

    /**
     * Control the use of STUN for the media transports.
     *
     * Default: PJSUA_STUN_RETRY_ON_FAILURE
     */
    pjsua_stun_use              media_stun_use;

    /**
     * Control the use of UPnP for the SIP signaling.
     *
     * Default: PJSUA_UPNP_USE_DEFAULT
     */
    pjsua_upnp_use              sip_upnp_use;

    /**
     * Control the use of UPnP for the media transports.
     *
     * Default: PJSUA_UPNP_USE_DEFAULT
     */
    pjsua_upnp_use              media_upnp_use;

    /**
     * Use loopback media transport. This may be useful if application
     * doesn't want PJSIP to create real media transports/sockets, such as
     * when using third party media.
     *
     * Default: PJ_FALSE
     */
    pj_bool_t                   use_loop_med_tp;

    /**
     * Enable local loopback when loop_med_tp_use is set to PJ_TRUE.
     * If enabled, packets sent to the transport will be sent back to
     * the streams attached to the transport.
     *
     * Default: PJ_FALSE
     */
    pj_bool_t                   enable_loopback;

    /**
     * Control the use of ICE in the account. By default, the settings in the
     * \a pjsua_media_config will be used.
     *
     * Default: PJSUA_ICE_CONFIG_USE_DEFAULT
     */
    pjsua_ice_config_use        ice_cfg_use;

    /**
     * The custom ICE setting for this account. This setting will only be
     * used if \a ice_cfg_use is set to PJSUA_ICE_CONFIG_USE_CUSTOM
     */
    pjsua_ice_config            ice_cfg;

    /**
     * Control the use of TURN in the account. By default, the settings in the
     * \a pjsua_media_config will be used
     *
     * Default: PJSUA_TURN_CONFIG_USE_DEFAULT
     */
    pjsua_turn_config_use       turn_cfg_use;

    /**
     * The custom TURN setting for this account. This setting will only be
     * used if \a turn_cfg_use is set to PJSUA_TURN_CONFIG_USE_CUSTOM
     */
    pjsua_turn_config           turn_cfg;

    /**
     * Specify whether secure media transport should be used for this account.
     * Valid values are PJMEDIA_SRTP_DISABLED, PJMEDIA_SRTP_OPTIONAL, and
     * PJMEDIA_SRTP_MANDATORY.
     *
     * Default: #PJSUA_DEFAULT_USE_SRTP
     */
    pjmedia_srtp_use            use_srtp;

    /**
     * Specify whether SRTP requires secure signaling to be used. This option
     * is only used when \a use_srtp option above is non-zero.
     *
     * Valid values are:
     *  0: SRTP does not require secure signaling
     *  1: SRTP requires secure transport such as TLS
     *  2: SRTP requires secure end-to-end transport (SIPS)
     *
     * Default: #PJSUA_DEFAULT_SRTP_SECURE_SIGNALING
     */
    int              srtp_secure_signaling;

    /**
     * This setting has been deprecated and will be ignored.
     */
    pj_bool_t        srtp_optional_dup_offer;

    /**
     * Specify SRTP transport setting. Application can initialize it with
     * default values using pjsua_srtp_opt_default().
     */
    pjsua_srtp_opt   srtp_opt;

    /**
     * Specify interval of auto registration retry upon registration failure,
     * in seconds. Set to 0 to disable auto re-registration. Note that
     * registration will only be automatically retried for temporal failures
     * considered to be recoverable in relatively short term, such as:
     * 408 (Request Timeout), 480 (Temporarily Unavailable),
     * 500 (Internal Server Error), 502 (Bad Gateway),
     * 503 (Service Unavailable), 504 (Server Timeout),
     * 6xx (global failure), and failure caused by transport problem.
     * For registration retry caused by transport failure, the first retry
     * will be done after \a reg_first_retry_interval seconds instead.
     * Note that the interval will be randomized slightly by some seconds
     * (specified in \a reg_retry_random_interval) to avoid all clients
     * re-registering at the same time.
     *
     * See also \a reg_first_retry_interval setting.
     *
     * Default: #PJSUA_REG_RETRY_INTERVAL
     */
    unsigned         reg_retry_interval;

    /**
     * This specifies the interval for the first registration retry. The
     * registration retry is explained in \a reg_retry_interval. Note that
     * the value here will also be randomized by some seconds (specified
     * in \a reg_retry_random_interval) to avoid all clients re-registering
     * at the same time.
     *
     * Default: 0
     */
    unsigned         reg_first_retry_interval;

    /**
     * This specifies maximum randomized value to be added/substracted
     * to/from the registration retry interval specified in \a
     * reg_retry_interval and \a reg_first_retry_interval, in second.
     * This is useful to avoid all clients re-registering at the same time.
     * For example, if the registration retry interval is set to 100 seconds
     * and this is set to 10 seconds, the actual registration retry interval
     * will be in the range of 90 to 110 seconds.
     *
     * Default: 10
     */
    unsigned         reg_retry_random_interval;

    /**
     * Specify whether calls of the configured account should be dropped
     * after registration failure and an attempt of re-registration has 
     * also failed.
     *
     * Default: PJ_FALSE (disabled)
     */
    pj_bool_t        drop_calls_on_reg_fail;

    /**
     * Specify how the registration uses the outbound and account proxy
     * settings. This controls if and what Route headers will appear in
     * the REGISTER request of this account. The value is bitmask combination
     * of PJSUA_REG_USE_OUTBOUND_PROXY and PJSUA_REG_USE_ACC_PROXY bits.
     * If the value is set to 0, the REGISTER request will not use any proxy
     * (i.e. it will not have any Route headers).
     *
     * Default: 3 (PJSUA_REG_USE_OUTBOUND_PROXY | PJSUA_REG_USE_ACC_PROXY)
     */
    unsigned         reg_use_proxy;

#if defined(PJMEDIA_STREAM_ENABLE_KA) && (PJMEDIA_STREAM_ENABLE_KA != 0)
    /**
     * Specify whether stream keep-alive and NAT hole punching with
     * non-codec-VAD mechanism (see @ref PJMEDIA_STREAM_ENABLE_KA) is enabled
     * for this account.
     *
     * Default: PJ_FALSE (disabled)
     */
    pj_bool_t        use_stream_ka;

    /**
     * Specify the keepalive configuration for stream.
     *
     * Default: see #pjmedia_stream_ka_config
     */
    pjmedia_stream_ka_config stream_ka_cfg;
#endif

    /**
     * Specify how to offer call hold to remote peer. Please see the
     * documentation on #pjsua_call_hold_type for more info.
     *
     * Default: PJSUA_CALL_HOLD_TYPE_DEFAULT
     */
    pjsua_call_hold_type call_hold_type;
    
    
    /**
     * Specify whether the account should register as soon as it is
     * added to the UA. Application can set this to PJ_FALSE and control
     * the registration manually with pjsua_acc_set_registration().
     *
     * Default: PJ_TRUE
     */
    pj_bool_t           register_on_acc_add;

    /**
     * Specify whether account modification with pjsua_acc_modify() should
     * automatically update registration if necessary, for example if
     * account credentials change.
     *
     * Disable this when immediate registration is not desirable, such as
     * during IP address change.
     *
     * Default: PJ_FALSE.
     */
    pj_bool_t           disable_reg_on_modify;

    /**
     * Specify account configuration specific to IP address change used when
     * calling #pjsua_handle_ip_change().
     */
    pjsua_ip_change_acc_cfg ip_change_cfg;

    /**
     * Enable RTP and RTCP multiplexing.
     */
    pj_bool_t           enable_rtcp_mux;

    /**
     * RTCP Feedback configuration.
     */
    pjmedia_rtcp_fb_setting rtcp_fb_cfg;

    /**
     * Enable RTCP Extended Report (RTCP XR).
     *
     * Default: PJMEDIA_STREAM_ENABLE_XR
     */
    pj_bool_t           enable_rtcp_xr;

    /**
     * Use a shared authorization session within this account.
     * This will use the accounts credentials on outgoing requests,
     * so that less 401/407 Responses will be returned.
     *
     * Needs PJSIP_AUTH_AUTO_SEND_NEXT and PJSIP_AUTH_HEADER_CACHING
     * enabled to work properly, and also will grow usage of the used pool for
     * the cached headers.
     *
     * Default: PJ_FALSE
     */
    pj_bool_t        use_shared_auth;

}