Ignore:
Timestamp:
Jul 23, 2018 7:32:54 AM (16 months ago)
Author:
riza
Message:

Close #2036: Support DTMF via SIP INFO.

File:
1 edited

Legend:

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

    r5828 r5834  
    800800 
    801801/** 
     802 * This enumeration specifies DTMF method. 
     803 */ 
     804typedef enum pjsua_dtmf_method { 
     805    /** 
     806     * Send DTMF using RFC2833. 
     807     */ 
     808    PJSUA_DTMF_METHOD_RFC2833, 
     809 
     810    /** 
     811     * Send DTMF using SIP INFO. 
     812     * Notes: 
     813     * - This method is not finalized in any standard/rfc, however it is  
     814     *   commonly used. 
     815     * - Warning: in case the remote doesn't support SIP INFO, response might  
     816     *   not be sent and the sender will deal this as timeout and disconnect 
     817     *   the call. 
     818     */ 
     819    PJSUA_DTMF_METHOD_SIP_INFO 
     820 
     821} pjsua_dtmf_method; 
     822 
     823 
     824/** 
     825 * This will contain the information of the callback \a on_dtmf_digit2. 
     826 */ 
     827typedef struct pjsua_dtmf_info { 
     828    /** 
     829     * The method used to send DTMF. 
     830     */ 
     831    pjsua_dtmf_method method; 
     832 
     833    /** 
     834     * DTMF ASCII digit 
     835     */     
     836    unsigned digit; 
     837 
     838    /** 
     839     * DTMF signal duration which might be included when sending DTMF using  
     840     * SIP INFO. 
     841     */ 
     842    unsigned duration; 
     843 
     844} pjsua_dtmf_info; 
     845 
     846 
     847/** 
    802848 * Call settings. 
    803849 */ 
     
    9611007 
    9621008    /** 
    963      * Notify application upon incoming DTMF digits. 
     1009     * Notify application upon incoming DTMF digits using RFC 2833 payload  
     1010     * formats. This callback will not be called if app implements \a 
     1011     * on_dtmf_digit2(). 
    9641012     * 
    9651013     * @param call_id   The call index. 
     
    9671015     */ 
    9681016    void (*on_dtmf_digit)(pjsua_call_id call_id, int digit); 
     1017 
     1018    /** 
     1019     * Notify application upon incoming DTMF digits using the method specified  
     1020     * in \a pjsua_dtmf_method. 
     1021     * 
     1022     * @param call_id   The call index. 
     1023     * @param info      The DTMF info. 
     1024     */ 
     1025    void (*on_dtmf_digit2)(pjsua_call_id call_id, const pjsua_dtmf_info *info); 
    9691026 
    9701027    /** 
     
    49264983 
    49274984/** 
     4985 * Specify the default signal duration when sending DTMF using SIP INFO. 
     4986 * 
     4987 * Default is 160 
     4988 */ 
     4989#ifndef PJSUA_CALL_SEND_DTMF_DURATION_DEFAULT 
     4990#   define PJSUA_CALL_SEND_DTMF_DURATION_DEFAULT    160 
     4991#endif 
     4992 
     4993 
     4994/** 
     4995 * Parameters for sending DTMF. Application should use  
     4996 * #pjsua_call_send_dtmf_param_default() to initialize this structure 
     4997 * with its default values. 
     4998 */ 
     4999typedef struct pjsua_call_send_dtmf_param 
     5000{ 
     5001    /** 
     5002     * The method used to send DTMF. 
     5003     * 
     5004     * Default: PJSUA_DTMF_METHOD_RFC2833 
     5005     */ 
     5006    pjsua_dtmf_method method; 
     5007 
     5008    /** 
     5009     * The signal duration used for the DTMF. 
     5010     * 
     5011     * Default: PJSUA_CALL_SEND_DTMF_DURATION_DEFAULT 
     5012     */ 
     5013    unsigned duration; 
     5014 
     5015    /** 
     5016     * The DTMF digits to be sent. 
     5017     */ 
     5018    pj_str_t digits; 
     5019 
     5020} pjsua_call_send_dtmf_param; 
     5021 
     5022 
     5023/** 
    49285024 * Initialize call settings. 
    49295025 * 
     
    49405036PJ_DECL(void) 
    49415037pjsua_call_vid_strm_op_param_default(pjsua_call_vid_strm_op_param *param); 
     5038 
     5039 
     5040/** 
     5041 * Initialize send DTMF param with default values. 
     5042 * 
     5043 * @param param         The send DTMF param to be initialized. 
     5044 */ 
     5045PJ_DECL(void)  
     5046pjsua_call_send_dtmf_param_default(pjsua_call_send_dtmf_param *param); 
    49425047 
    49435048 
     
    54085513 
    54095514/** 
    5410  * Send DTMF digits to remote using RFC 2833 payload formats. 
     5515 * Send DTMF digits to remote using RFC 2833 payload formats. Use  
     5516 * #pjsua_call_send_dtmf() to send DTMF using SIP INFO or other method in  
     5517 * \a pjsua_dtmf_method. App can use \a on_dtmf_digit() or \a on_dtmf_digit2()  
     5518 * callback to monitor incoming DTMF. 
    54115519 * 
    54125520 * @param call_id       Call identification. 
     
    54205528PJ_DECL(pj_status_t) pjsua_call_dial_dtmf(pjsua_call_id call_id,  
    54215529                                          const pj_str_t *digits); 
     5530 
     5531/** 
     5532 * Send DTMF digits to remote. Use this method to send DTMF using the method in 
     5533 * \a pjsua_dtmf_method. This method will call #pjsua_call_dial_dtmf() when 
     5534 * sending DTMF using \a PJSUA_DTMF_METHOD_RFC2833. Note that  
     5535 * \a on_dtmf_digit() callback can only monitor incoming DTMF using RFC 2833.  
     5536 * App can use \a on_dtmf_digit2() to monitor incoming DTMF using the method in  
     5537 * \a pjsua_dtmf_method. Note that \a on_dtmf_digit() will not be called once 
     5538 * \a on_dtmf_digit2() is implemented. 
     5539 * 
     5540 * @param call_id       Call identification. 
     5541 * @param param         The send DTMF parameter. 
     5542 * 
     5543 * @return              PJ_SUCCESS on success, or the appropriate error code. 
     5544 */ 
     5545PJ_DECL(pj_status_t) pjsua_call_send_dtmf(pjsua_call_id call_id,  
     5546                                      const pjsua_call_send_dtmf_param *param); 
    54225547 
    54235548/** 
Note: See TracChangeset for help on using the changeset viewer.