Пример #1
0
        /* public string bridgeXml(String destinationNumber, String extensionName, string gatewayname, string userContext)
         * {
         *   //application - bridge
         *
         *   String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\r\n" +
         *          "<document type=\"freeswitch/xml\">\r\n" +
         *          "  <section name=\"dialplan\" description=\"RE Dial Plan For FreeSwitch\">\r\n" +
         *          "    <context name=\"" + userContext + "\">\r\n" +
         *          "      <extension name=\"" + extensionName + "\">\r\n" +
         *          "        <condition field=\"destination_number\" expression=\"^" + destinationNumber + "$\">\r\n" +
         *          "          <action application=\"bridge\" data=\"" + gatewayname + "/" + destinationNumber + "\"/>\r\n" +
         *          "        </condition>\r\n" +
         *          "      </extension>\r\n" +
         *          "    </context>\r\n" +
         *          "  </section>\r\n" +
         *          "</document>\r\n";
         *
         *   return xml;
         * }*/


        public string ResponseXml()
        {
            string responsexml = string.Empty;

            //DialPlanParameters.DestinationNumber
            //DialPlanParameters.CallerIdNumber
            //this.AgentOutBoundType
            //DialPlanParameters.CallerIdName
            helper            = new Helper();
            this.CallStatusId = 1;
            Press3.DataAccessLayer.SipPhoneRegistration SipPhoneRegister = new DataAccessLayer.SipPhoneRegistration(AppConfig.ConnectionString);
            var ds = SipPhoneRegister.GetResponseXml(DialPlanParameters.CallerIdNumber, DialPlanParameters.DestinationNumber, this.AgentOutBoundType, this.DialNumberType, DialPlanParameters.TransferFromNumber, DialPlanParameters.TransferToNumber);


            if (ds == null)
            {
                helper.CreateProperty(UDC.Label.MESSAGE, "No data returned from database");
                helper.CreateProperty(UDC.Label.SUCCESS, false);
            }
            else
            {
                helper.ParseDataSet(ds);
            }

            JObject ResponseJobj = helper.GetResponse();

            Logger.Info("Response Xml: response:" + ResponseJobj.ToString());

            if (ResponseJobj.SelectToken("Success").ToString() == "True")
            {
                responsexml = ResponseJobj.SelectToken("Message").ToString();
            }
            return(responsexml);
        }
Пример #2
0
        /*  public string noOutBOundXml(String playFile, string userContext, string extensionName, string destinationNumber)
         * {
         *    String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\r\n" +
         *              "<document type=\"freeswitch/xml\">\r\n" +
         *              "  <section name=\"dialplan\" description=\"RE Dial Plan For FreeSwitch\">\r\n" +
         *              "    <context name=\"" + userContext + "\">\r\n" +
         *              "      <extension name=\"" + extensionName + "\">\r\n" +
         *              "        <condition field=\"destination_number\" expression=\"^" + destinationNumber + "$\">\r\n" +
         *              "          <action application=\"playback\" data=\"" + playFile + "/>\r\n" +
         *              "        </condition>\r\n" +
         *              "      </extension>\r\n" +
         *              "    </context>\r\n" +
         *              "  </section>\r\n" +
         *              "</document>\r\n";
         *
         *    return xml;
         * }*/


        //public string joinConference(String extensionName, string userContext,string DestinationNumber,string CallerIdNumber)
        //   {
        //       //application - Conference
        //       String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\r\n" +
        //             "<document type=\"freeswitch/xml\">\r\n" +
        //             "  <section name=\"dialplan\" description=\"RE Dial Plan For FreeSwitch\">\r\n" +
        //             "    <context name=\"public\">\r\n" +
        //             "      <extension name=\"" + extensionName + "\">\r\n" +
        //             "        <condition field=\"destination_number\" expression=\"^" + DestinationNumber + "$\">\r\n" +
        //             "          <action application=\"answer\"/>\r\n" +
        //             "          <action application=\"conference\" data=\"" + CallerIdNumber + "_" + DestinationNumber + "\"/>\r\n" +
        //             "        </condition>\r\n" +
        //             "      </extension>\r\n" +
        //             "    </context>\r\n" +
        //             "  </section>\r\n" +
        //             "</document>\r\n";
        //       return xml;
        //   }


        /*  public string SocketXml(String extensionName, bool isInbound)
         * {
         *    string ycom_answer_url = AppConfig.YcomDefaultAnswerUrl;
         *    string agentDialUrl = AppConfig.AgentDialAnswerUrl;
         *    string socketAddress = AppConfig.socketAddress;
         *
         *    string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\r\n" +
         *          "<document type=\"freeswitch/xml\">\r\n" +
         *          "  <section name=\"dialplan\" description=\"RE Dial Plan For FreeSwitch\">\r\n" +
         *          "    <context name=\"public\">\r\n" +
         *          "      <extension name=\"" + extensionName + "\">\r\n" +
         *          "        <condition field=\"destination_number\" expression=\"(.*)\">\r\n" +
         *          "          <action application=\"set\" data=\"ycom_answer_url=" + (isInbound == true ? ycom_answer_url : agentDialUrl).Trim() + "\"/>\r\n" +
         *        //     "          <action application=\"answer\"/>\r\n" +
         *          "          <action application=\"socket\" data=\"" + socketAddress + " async full\"/>\r\n" +
         *          "        </condition>\r\n" +
         *          "      </extension>\r\n" +
         *          "    </context>\r\n" +
         *          "  </section>\r\n" +
         *          "</document>\r\n";
         *
         *    //<action application="socket" data="127.0.0.1:9090 async full"/>
         *    // <action application="set" data="ycom_answer_url=http://press3.demo.com/handlers/ClientCallerIdMetaData.ashx"/>
         *
         *    return xml;
         * }*/

        public void OutBoundType(String FromNumber, String CallerIP, string tonumber)
        {
            //outboundtypes
            //1-internal
            //2-national
            //3-international
            //4-no outbound

            Press3.DataAccessLayer.SipPhoneRegistration SipPhoneRegister = new DataAccessLayer.SipPhoneRegistration(AppConfig.ConnectionString);
            var ds = SipPhoneRegister.GetAgentoutBoundType(FromNumber, CallerIP, tonumber);

            if (ds == null)
            {
                helper.CreateProperty(UDC.Label.MESSAGE, "No data returned from database");
                helper.CreateProperty(UDC.Label.SUCCESS, false);
            }
            else
            {
                helper.ParseDataSet(ds);
            }

            JObject outbounddetails = helper.GetResponse();

            Logger.Info("AgentOutboundType response:" + outbounddetails.ToString());

            if (outbounddetails.SelectToken("Success").ToString() == "True")
            {
                JArray AgentOutBoundDetails = (JArray)outbounddetails.SelectToken("AgentOutboundDetails");

                if (AgentOutBoundDetails != null)
                {
                    if (AgentOutBoundDetails[0].SelectToken("OutboundType") != null)
                    {
                        this.AgentOutBoundType = Int32.Parse(AgentOutBoundDetails[0].SelectToken("OutboundType").ToString());
                    }
                    if (AgentOutBoundDetails[0].SelectToken("CountryCode") != null)
                    {
                        this.AgentCountrycode = Int32.Parse(AgentOutBoundDetails[0].SelectToken("CountryCode").ToString());
                    }
                    if (AgentOutBoundDetails[0].SelectToken("CallerId") != null)
                    {
                        this.CallerId          = Int32.Parse(AgentOutBoundDetails[0].SelectToken("CallerId").ToString());
                        this.DestinationNumber = DialPlanParameters.DestinationNumber;
                    }
                }
                else
                {
                    Logger.Info("Dial plan requested but no agent details found requested from number.");
                }
            }
            else
            {
                this.IsAgentDial = true;
                Logger.Info("No data Returned from database so no agent typ and no callertype un authorised.");
            }
        }
Пример #3
0
        public string UpdateOutboundCalls(HttpParameters restparameters)
        {
            string updateResponse = string.Empty;

            Press3.DataAccessLayer.SipPhoneRegistration SipPhoneRegister = new DataAccessLayer.SipPhoneRegistration(AppConfig.ConnectionString);
            var ds = SipPhoneRegister.UpdateOutboundCalls(restparameters);



            helper = new Helper();
            if (ds == null)
            {
                helper.CreateProperty(UDC.Label.MESSAGE, "No data returned from database");
                helper.CreateProperty(UDC.Label.SUCCESS, false);
            }
            else
            {
                helper.ParseDataSet(ds);
            }
            JObject updateOutBoundDetails = helper.GetResponse();

            Logger.Info("Updating hangup for agent outbound calls" + updateOutBoundDetails.ToString());

            if (updateOutBoundDetails.SelectToken("Success").ToString() == "True")
            {
                //  JArray AgentOutBoundDetails = (JArray)outbounddetails.SelectToken("AgentOutboundDetails");

                if (updateOutBoundDetails.SelectToken("Message") != null)
                {
                    updateResponse = updateOutBoundDetails.SelectToken("Message").ToString();
                }
            }
            else
            {
                Logger.Info("No data Returned from database so no agent typ and no callertype un authorised.");
            }

            return(updateResponse);
        }
Пример #4
0
        public JObject UpdateDial(HttpParameters freeswitchparameters)
        {
            helper = new Helper();
            Press3.DataAccessLayer.SipPhoneRegistration SipPhoneRegister = new DataAccessLayer.SipPhoneRegistration(AppConfig.ConnectionString);
            var ds = SipPhoneRegister.UpdateDial(freeswitchparameters);


            if (ds == null)
            {
                helper.CreateProperty(UDC.Label.MESSAGE, "No data returned from database");
                helper.CreateProperty(UDC.Label.SUCCESS, false);
            }
            else
            {
                helper.ParseDataSet(ds);
            }

            JObject ResponseJobj = helper.GetResponse();

            Logger.Info("Response Xml: response:" + ResponseJobj.ToString());
            return(ResponseJobj);
        }