public static DialogResult Show(int iFolio, string sRutaGrabacion)
        {
            _RegistrarLlamadaModal = new RegistrarLlamadaModal();
            _RegistrarLlamadaModal.StartPosition = FormStartPosition.CenterScreen;

            _RegistrarLlamadaModal.iFolio         = iFolio;
            _RegistrarLlamadaModal.sRutaGrabacion = sRutaGrabacion;

            _DialogResult = DialogResult.No;

            _RegistrarLlamadaModal.Activate();
            _RegistrarLlamadaModal.ShowDialog();

            return(_DialogResult);
        }
Example #2
0
        void call_CallStateChanged(object sender, CallStateChangedArgs e)
        {
            InvokeGUIThread(() => { lbl_CallState.Text = e.State.ToString(); lblEstatusLlamada.Text = e.State.ToString(); });

            if (e.State == CallState.Answered)
            {
                InvokeGUIThread(() => {
                    wplayer.controls.stop();
                    crearFolio();
                    ALlamadaData.bCurso = true;

                    string sRuta = string.Format(@"{0}\mpy\records\nws", Path.GetTempPath());
                    if (!Directory.Exists(sRuta))
                    {
                        Directory.CreateDirectory(sRuta);
                    }
                });

                StartDevices();
                SendDTMFSingnal();

                sFechaInicio = DateTime.Now;
                sRecordName  = AProspeccionData.bCurso ? string.Format("pcll-{1}.wav", Path.GetTempPath(), AProspeccionData.iIdLlamada) : string.Format("Folio-{0}-{1}{2}{3}{4}{5}{6}.wav", iIdFolio, sFechaInicio.Day, sFechaInicio.Month, sFechaInicio.Year, sFechaInicio.Hour, sFechaInicio.Minute, sFechaInicio.Second);
                filename     = string.Format(@"{0}\mpy\records\nws\{1}", Path.GetTempPath(), sRecordName);

                recorder = new WaveStreamRecorder(filename);  // new recorder object
                _connector.Connect(_microphone, recorder);    // connects the outgoing voice to the recorder
                _connector.Connect(_mediaReceiver, recorder); // connects the incoming voice to the recorder

                _mediaSender.AttachToCall(_call);
                _mediaReceiver.AttachToCall(_call);
                recorder.Start();  // starts the recording

                InvokeGUIThread(() => {
                    timer1.Start();
                    txtDisplay.Text     = "" + ((IPhoneCall)sender).DialInfo.SIPCallerID.DisplayName;
                    lblExtEntrante.Text = "" + ((IPhoneCall)sender).DialInfo.SIPCallerID.DisplayName;

                    if (!AProspeccionData.bCurso)
                    {
                        // Valida despues de mostrar la modal para registrar la llamada
                        if (RegistrarLlamadaModal.Show(iIdFolio, filename) == DialogResult.Yes)
                        {
                            Cliente ACliente = new Cliente();
                            Caso NoCliente;
                            if (bSeguimiento)
                            {
                                NoCliente = new Caso().ClienteCaso(iIdFolioSeguimiento);
                            }
                            else
                            {
                                NoCliente = new Caso().ClienteCaso(iIdFolio);
                            }
                        }
                    }
                });
            }
            else if (e.State == CallState.InCall)
            {
                StartDevices();
            }

            if (e.State == CallState.LocalHeld || e.State == CallState.InactiveHeld)
            {
                StopDevices();
                InvokeGUIThread(() => {
                    lnkHold.Text         = "Unhold";
                    lnkHold.Image        = Properties.Resources.resume_button_48px;
                    lnkHold.NoFocusImage = Properties.Resources.resume_button_48px;
                });
            }
            else
            {
                InvokeGUIThread(() => {
                    lnkHold.Text         = "Hold";
                    lnkHold.Image        = Properties.Resources.pause_48px;
                    lnkHold.NoFocusImage = Properties.Resources.pause_48px;
                });
            }

            if (e.State.IsCallEnded())
            {
                StopDevices();

                _mediaSender.Detach();
                _mediaReceiver.Detach();

                WireDownCallEvents();

                if (recorder != null)
                {
                    recorder.Dispose();
                    recorder = null;
                }

                _call = null;

                timer1.Stop();

                InvokeGUIThread(() => {
                    wplayer.controls.stop();
                    txtDisplay.Text     = String.Empty;
                    lblExtEntrante.Text = string.Empty;
                    lblTiempo.Text      = string.Empty;

                    if (pnlLlamada.Visible == true)
                    {
                        frmTelefono.Animate2(pnlLlamada, frmTelefono.Effect.Slide, 150, 360);
                        frmTelefono.Animate(pnlKeyPad, frmTelefono.Effect.Slide, 150, 360);
                    }

                    lnkPickUpInCall.Visible      = true;
                    lnkVolverLLamada.Visible     = false;
                    pnlTransferirLlamada.Visible = false;
                    txtNoTransferir.Text         = string.Empty;
                    lnkConfigurar.Enabled        = true;
                    lnkHangUp.Location           = new Point(150, 94);
                    AProspeccionData.bCurso      = false;

                    string sFilePath = "";
                    if (bSeguimiento && iIdFolioSeguimiento != 0)
                    {
                        sFilePath = string.Format(@"{0}\mpy\records\nws\Folio-{1}-{2}{3}{4}{5}{6}{7}.wav", Path.GetTempPath(), iIdFolioSeguimiento, sFechaInicio.Day, sFechaInicio.Month, sFechaInicio.Year, sFechaInicio.Hour, sFechaInicio.Minute, sFechaInicio.Second);
                        File.Move(filename, sFilePath);
                        CasoHistorial _UpdRecord = new CasoHistorial();
                        _UpdRecord.UpdateHistorialRecord(iIdHistorialFolio, sFilePath);
                    }

                    if (ALlamadaData.bCurso)
                    {
                        if (sFilePath == "")
                        {
                            string FullPath = string.Format("{0}/{1}/Records/", FTPCredentials.Path, ConnectionString.FolderConnection);
                            FTPServer.Upload(FullPath, FTPCredentials.User, FTPCredentials.Password, Path.GetFileName(filename), filename);
                            File.Delete(filename);
                        }
                        else
                        {
                            string FullPath = string.Format("{0}/{1}/Records/", FTPCredentials.Path, ConnectionString.FolderConnection);
                            FTPServer.Upload(FullPath, FTPCredentials.User, FTPCredentials.Password, Path.GetFileName(sFilePath), sFilePath);
                            File.Delete(sFilePath);
                        }
                        ALlamadaData.bCurso = false;
                    }
                });
            }
        }