Esempio n. 1
0
        private void FncOpenClinet(object lstParameters)
        {
            try
            {
                System.Collections.Generic.List<object> lstTempObj = (System.Collections.Generic.List<object>)lstParameters;
                strUri = lstTempObj[1].ToString();

                if ((VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.NodeWithNetP2P || (VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.BootStrap || (VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.SuperNode)
                {
                    VMuktiService.NetPeerClient ncpAudio = new VMuktiService.NetPeerClient();
                    ((clsNetTcpAudio)objNetTcpAudio).EntsvcP2PJoin += new AutoProgressivePhone.Business.Service.NetP2P.clsNetTcpAudio.DelsvcP2PJoin(ctlDialer_EntsvcP2PJoin);
                    ((clsNetTcpAudio)objNetTcpAudio).EntsvcP2PStartConference += new AutoProgressivePhone.Business.Service.NetP2P.clsNetTcpAudio.DelsvcP2PStartConference(ctlDialer_EntsvcP2PStartConference);
                    ((clsNetTcpAudio)objNetTcpAudio).EntsvcP2PUnJoin += new AutoProgressivePhone.Business.Service.NetP2P.clsNetTcpAudio.DelsvcP2PUnJoin(ctlDialer_EntsvcP2PUnJoin);
                    NetP2PChannel = (INetTcpAudioChannel)ncpAudio.OpenClient<INetTcpAudioChannel>(strUri, strUri.ToString().Split(':')[2].Split('/')[2], ref objNetTcpAudio);

                    while (temp < 20)
        {
            try
            {
                            NetP2PChannel.svcP2PJoin(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName);
                            temp = 20;
                        }
                        catch
                        {
                            temp++;
                            System.Threading.Thread.Sleep(1000);
                        }
                    }
                }
                else
                {
                    VMuktiService.BasicHttpClient bhcAudio = new VMuktiService.BasicHttpClient();
                    Httpchannel = (IHttpAudio)bhcAudio.OpenClient<IHttpAudio>(strUri);
                    while (tempcounter < 20)
        {
            try
            {
                            Httpchannel.svcJoin(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName);
                            tempcounter = 20;
                        }
                        catch
                        {
                            tempcounter++;
                            System.Threading.Thread.Sleep(1000);
                        }
                    }
                    dtGetConference.Interval = TimeSpan.FromSeconds(2);
                    dtGetConference.Tick += new EventHandler(dtGetConference_Tick);
                    dtGetConference.Start();
                }
            }
            catch (Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "fncOpenClient()", "ctlDialer.xaml.cs");
            }
        }
Esempio n. 2
0
        public void FncRegister(object sender, VMuktiEventArgs e)
        {
            try
            {
                DataSet da = new DataSet();
                if (VMuktiAPI.VMuktiInfo.strExternalPBX == "true")
                {
                    try
                    {
                        //MessageBox.show("Sip Number is: " + e._args[0].ToString() + "and Sip server is: " + e._args[2].ToString());
                        if (blIsVista)
                        {
                            ClientNetP2PRTCVistaChannel.svcRegisterSIPPhone(e._args[0].ToString(), e._args[1].ToString(), e._args[2].ToString());
                        }
                        else
                        {
                            RClient = new RTCClient(e._args[0].ToString(), e._args[1].ToString(), e._args[2].ToString());
                            RClient.entstatus += new RTCClient.delStatus(RClient_entstatus);
                            RClient.NonHumanDetected += OnNonHumanDetected;
                        }
                        lblUserNumber.Content = e._args[0].ToString() + "@" + e._args[2].ToString();
                    }
                    catch (Exception ex)
                    {
                        VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "FncRegister()--1", "ctlDialer.xaml.cs");
                    }
                }
                else
                {
                    //SNChannel = (IService)bhcSuperNode.OpenClient<IService>("http://210.211.254.132:80/SNService");
                    //string strSIPNumber = "2118";
                    ///string strSIPServerIP = "210.211.254.132";

                    string strSIPNumber = "";
                    if (VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == VMuktiAPI.PeerType.NodeWithHttp)
                    {
                        VMuktiService.BasicHttpClient bhcSuperNode = new VMuktiService.BasicHttpClient();
                        SNChannel = (IService)bhcSuperNode.OpenClient<IService>("http://" + VMuktiAPI.VMuktiInfo.CurrentPeer.SuperNodeIP + ":80/SNService");
                        strSIPServer = VMuktiInfo.CurrentPeer.SuperNodeIP;
                        strSIPNumber = SNChannel.svcAddSIPUser();
                    }
                    else
                    {
                        strSIPNumber = FncAddSIPUser();
                        strSIPServer = VMuktiAPI.VMuktiInfo.CurrentPeer.CurrentMachineIP.ToString();
                    }

                    if (blIsVista)
                    {
                        ClientNetP2PRTCVistaChannel.svcRegisterSIPPhone(strSIPNumber, strSIPNumber, strSIPServer);
                    }
                    else
                    {
                        RClient = new RTCClient(strSIPNumber, strSIPNumber, strSIPServer);
                        RClient.entstatus += new RTCClient.delStatus(RClient_entstatus);
                        RClient.NonHumanDetected += OnNonHumanDetected;
                    }
                    lblUserNumber.Content = strSIPNumber + "@" + strSIPServer;
                }
             
            }
            catch (Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "FncRegister()--2", "ctlDialer.xaml.cs");
            }
        }
 public void FncRegister(object sender, VMuktiEventArgs e)
 {
     try
     {
         if (VMuktiAPI.VMuktiInfo.strExternalPBX == "true")
         {
             try
             {
                 RClient = new RTCClient(e._args[0].ToString(), e._args[1].ToString(), e._args[2].ToString());
                 lblUserNumber.Content = e._args[0].ToString() + "@" + e._args[2].ToString();
                 RClient.entstatus += new RTCClient.delStatus(RClient_entstatus);
                 RClient.NonHumanDetected += OnNonHumanDetected;
             }
             catch (Exception ex)
             {
                 VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "FncRegister()--1", "ctlDialer.xaml.cs");
             }
         }
         else
         {
             string strSIPNumber = "";
             if (VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == VMuktiAPI.PeerType.NodeWithHttp)
             {
                 VMuktiService.BasicHttpClient bhcSuperNode = new VMuktiService.BasicHttpClient();
                 SNChannelPredictive = (IService)bhcSuperNode.OpenClient<IService>("http://" + VMuktiAPI.VMuktiInfo.CurrentPeer.SuperNodeIP + ":80/SNServicePredictive");
                 strSIPServerIP = VMuktiInfo.CurrentPeer.SuperNodeIP;
                 strSIPNumber = SNChannelPredictive.svcAddSIPUser();
             }
             else
             {
                 strSIPNumber = FncAddSIPUser();
                 strSIPServerIP = VMuktiAPI.VMuktiInfo.CurrentPeer.CurrentMachineIP.ToString();
             }
             VMuktiHelper.CallEvent("SetAgentNumber", this, new VMuktiEventArgs(strSIPNumber, strSIPNumber, strSIPServerIP));
             RClient = new RTCClient(strSIPNumber, strSIPNumber, strSIPServerIP);
             lblUserNumber.Content = strSIPNumber + "@" + strSIPServerIP;
             RClient.entstatus += new RTCClient.delStatus(RClient_entstatus);
             RClient.NonHumanDetected += OnNonHumanDetected;
         }
     }
     catch (Exception ex)
     {
         VMuktiHelper.ExceptionHandler(ex, "FncRegister()", "ctlPredictivePhone.xaml.cs");
     }
 }