VOIP中关于DTMF数据的处理方法和发送方式-实际用法(linphone)
- 目前传送DTMF信号普遍有三种方式:
A.通过通信协议传输(SIP info)
B. 通过RTP的数据内容传输(Inband)
C. 通过rfc2833的规则和格式包传输
- 结合抓包分析SIP INFO
- 集合抓包分析rfc2833
由payload=101是由SDP协商的,后期过滤这个101就可以得到rfc2833的事件。
- linphone中如何实现?
linphone_core_set_use_rfc2833_for_dtmf(marie->lc, use_rfc2833);
linphone_core_set_use_info_for_dtmf(marie->lc, use_sipinfo);
linphone_core_set_use_rfc2833_for_dtmf(pauline->lc, use_rfc2833);
linphone_core_set_use_info_for_dtmf(pauline->lc, use_sipinfo);
以上接口在建立通话初期需要调用,表示启用改功能;
linphone_call_send_dtmfs(marie_call, dtmf_seq);
linphone_call_send_dtmf(marie_call, dtmf_seq);
以上接口是正常的发送接口,用来发送dtmf数据; - linphone中给的示例:
/*
liblinphone_tester - liblinphone test suite
Copyright (C) 2013 Belledonne Communications SARL
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "liblinphone_tester.h"
#include "private.h"
LinphoneCoreManager* marie;
LinphoneCoreManager* pauline;
LinphoneCall *marie_call;
void dtmf_received(LinphoneCore *lc, LinphoneCall *call, int dtmf) {
stats* counters = get_stats(lc);
char** dst = &counters->dtmf_list_received;
*dst = *dst ?
ms_strcat_printf(*dst, "%c", dtmf)
: ms_strdup_printf("%c", dtmf);
counters->dtmf_count++;
}
void send_dtmf_base(bool_t use_rfc2833, bool_t use_sipinfo, char dtmf, char* dtmf_seq) {
char* expected = NULL;
int dtmf_count_prev;
marie = linphone_core_manager_new( "marie_rc");
pauline = linphone_core_manager_new( "pauline_rc");
linphone_core_set_use_rfc2833_for_dtmf(marie->lc, use_rfc2833);
linphone_core_set_use_info_