Created
May 14, 2017 07:05
-
-
Save andrewvmail/8bce791108ac15ef927193f01f77f8e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is in the constructor of a class | |
this.onInvite = session => { | |
console.log(this); | |
console.log(this); | |
console.log(this); | |
console.log(this); | |
console.log(this); | |
console.log(this); | |
// reject this call if we already have an existing call | |
if (this._session) { | |
session.reject(); | |
return; | |
} | |
console.log("sip onInvite ") | |
this._session = session; | |
console.log("sip session: ", this._session); | |
this._callExtra = {type: 'incomingP2p'}; | |
session.on('terminated', this.onTerminated); | |
console.log('after onInfo', this._session); | |
this.events.publish('sip', {type: 'UA.INVITE', msg: this._session}); | |
// // For DTMF feedback during calls | |
if (!window.cordova || (window.cordova && cordova.platformId === 'android')) { | |
console.log('hello1') | |
this._session.audioContext = new (window.AudioContext || window.webkitAudioContext)(); | |
console.log('hello2') | |
} | |
console.log('-0-0-0-'); | |
this._session.onInfo = (request) => { | |
console.log("sip onAudioBoard createSession ", request) | |
playSound(this._session.audioContext, request.headers["Audioboard-File"][0].raw); | |
console.log(request.reply(200, 'OK')); | |
request.reply(200, 'OK'); | |
} | |
console.log('-011111-0-0-'); | |
console.log(this._session); | |
return this._session; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment