public override void onCallMediaState(OnCallMediaStateParam prm) { base.onCallMediaState(prm); var ci = getInfo(); for (uint i = 0; i < ci.media.Count; i++) { if (ci.media[(int)i].type == pjmedia_type.PJMEDIA_TYPE_AUDIO) { var audMed = AudioMedia.typecastFromMedia(this.getMedia(i)); var mgr = Endpoint.instance().audDevManager(); audMed.startTransmit(mgr.getPlaybackDevMedia()); mgr.getCaptureDevMedia().startTransmit(audMed); } else { throw new ApplicationException("现在仅支持音频哦亲"); } } }
public AudioMedia getAudioMedia() { lock (locker) { if (State.In(pjsip_inv_state.PJSIP_INV_STATE_NULL, pjsip_inv_state.PJSIP_INV_STATE_DISCONNECTED)) { return(null); } for (var i = 0; i < getInfo().media.Count; ++i) { if (getInfo().media[i].type != pjmedia_type.PJMEDIA_TYPE_AUDIO) { continue; } return(AudioMedia.typecastFromMedia(getMedia((uint)i))); } return(null); } }