Fix a problem with accessing peerconnection, use duration and pause in the API.
This commit is contained in:
parent
0efcbdcd37
commit
134d89a3d6
|
@ -13,11 +13,12 @@ var initDtmfSender = function() {
|
||||||
var localAudio = APP.RTC.localAudio;
|
var localAudio = APP.RTC.localAudio;
|
||||||
if (localAudio && localAudio.getTracks().length > 0)
|
if (localAudio && localAudio.getTracks().length > 0)
|
||||||
{
|
{
|
||||||
var peerconnection =
|
var peerconnection
|
||||||
APP.xmpp.getConnection().jingle.activecall.peerconnection.peerconnection;
|
= APP.xmpp.getConnection().jingle.activecall.peerconnection;
|
||||||
if (peerconnection) {
|
if (peerconnection) {
|
||||||
DTMFSender =
|
DTMFSender =
|
||||||
peerconnection.createDTMFSender(localAudio.getTracks()[0]);
|
peerconnection.peerconnection
|
||||||
|
.createDTMFSender(localAudio.getTracks()[0]);
|
||||||
console.log("Initialized DTMFSender");
|
console.log("Initialized DTMFSender");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -30,12 +31,14 @@ var initDtmfSender = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
var DTMF = {
|
var DTMF = {
|
||||||
sendTones: function (tones) {
|
sendTones: function (tones, duration, pause) {
|
||||||
if (!DTMFSender)
|
if (!DTMFSender)
|
||||||
initDtmfSender();
|
initDtmfSender();
|
||||||
|
|
||||||
if (DTMFSender){
|
if (DTMFSender){
|
||||||
DTMFSender.insertDTMF(tones);
|
DTMFSender.insertDTMF(tones,
|
||||||
|
(duration || 200),
|
||||||
|
(pause || 200));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue