Esempio n. 1
0
        /// <summary>
        /// private method to parse the cdr
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        private ArrayList ParseTheCdr(string fileName)
        {
            // make the array size (number of cdrs per file ) configurable
            System.Collections.ArrayList theControls = new System.Collections.ArrayList(1000);

            // example file formats
            //146148451ce6120071008204847.1711-070000,,Start
            //146158451ce6120071008204858.8531-070000,Javelin_sp,Normal,+14256051047,,Originating,+14256051047,Public,2142498,20071008204858.853,1-070000,Yes,20071008204910.746,20071008205017.699,016,VoIP,,2142498,,,14252142498,,remote,172.27.58.50:5060,[email protected],G729/8000,,,,,,Pacific_Financial_Advisors_gp,,,,,,,,,,y,,,66330:0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,[email protected],,,,,,,,,,,,,,,,,,,,,,,,,,,,20071008205001.004,Success,66330:1,Transfer Consult,,,,,16.157,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
            char[] sep = new char[] { ',' };
            char[] trim = new char[] { '"' };
            int lineNumber = 1;
            try
            {
                using (StreamReader sr = new StreamReader(fileName))
                {
                    String line;
                    while ((line = sr.ReadLine()) != null)
                    {
                        try
                        {
                            // new record
                            BworksCdr aRec = new BworksCdr();

                            // parse the line
                            string[] controls = line.Split(sep);
                            if (controls.GetLength(0) < 100)
                            {
                                // we have a non-data line -- header or footer... so skip it
                                continue;
                            }

                            aRec.recordId = controls[0].Trim(trim);
                            aRec.serviceProvider = controls[1].Trim(trim);
                            aRec.type = controls[2].Trim(trim);
                            aRec.userNumber = controls[3].Trim(trim);
                            aRec.groupNumber = controls[4].Trim(trim);
                            aRec.direction = controls[5].Trim(trim);
                            aRec.callingNumber = controls[6].Trim(trim);
                            aRec.callingPresentationIndicator = controls[7].Trim(trim);
                            aRec.calledNumber = controls[8].Trim(trim);
                            aRec.startTime = controls[9].Trim(trim);
                            aRec.userTimeZone = controls[10].Trim(trim);
                            aRec.answerIndicator = controls[11].Trim(trim);
                            aRec.answerTime = controls[12].Trim(trim);
                            aRec.releaseTime = controls[13].Trim(trim);
                            aRec.terminationCause = controls[14].Trim(trim);
                            aRec.networkType = controls[15].Trim(trim);
                            aRec.carrierIdentificationCode = controls[16].Trim(trim);
                            aRec.dialedDigits = controls[17].Trim(trim);
                            aRec.callCategory = controls[18].Trim(trim);
                            aRec.networkCallType = controls[19].Trim(trim);
                            aRec.networkTranslatedNumber = controls[20].Trim(trim);
                            aRec.networkTranslatedGroup = controls[21].Trim(trim);
                            aRec.releasingParty = controls[22].Trim(trim);
                            aRec.route = controls[23].Trim(trim);
                            aRec.networkCallId = controls[24].Trim(trim);
                            aRec.codec = controls[25].Trim(trim);
                            aRec.group = controls[31].Trim(trim);
                            aRec.chargeIndicator = controls[41].Trim(trim);
                            aRec.conferenceId = controls[51].Trim(trim);
                            aRec.userId = controls[120].Trim(trim);

                            // cache the record
                            theControls.Add(aRec);

                            lineNumber++;
                        }
                        catch (System.Exception ex)
                        {
                            string errorMsg = "Error in File>" + fileName + " Line>" + lineNumber;
                            if (line != null)
                            {// add the line information if available
                                errorMsg += "Line>" + line;
                            }
                            LogFileError(errorMsg + "\r\n" + ex.Message + "\r\n" + ex.StackTrace);
                        }
                    }
                }
            }// try
            catch (Exception e)
            {
                EventLog.WriteEntry(m_eventLogName, "Error in ParseJobControlFile-- error is " + e.ToString(), EventLogEntryType.Error, 3012);
            }// catch

            return theControls;
        }
Esempio n. 2
0
        }     // public void CloseDataConn( ref SqlConnection dataConnection )

        /// <summary>
        /// private method to parse the cdr
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        private ArrayList ParseTheCdr(string fileName)
        {
            // make the array size (number of cdrs per file ) configurable
            System.Collections.ArrayList theControls = new System.Collections.ArrayList(1000);


            // example file formats
            //146148451ce6120071008204847.1711-070000,,Start
            //146158451ce6120071008204858.8531-070000,Javelin_sp,Normal,+14256051047,,Originating,+14256051047,Public,2142498,20071008204858.853,1-070000,Yes,20071008204910.746,20071008205017.699,016,VoIP,,2142498,,,14252142498,,remote,172.27.58.50:5060,[email protected],G729/8000,,,,,,Pacific_Financial_Advisors_gp,,,,,,,,,,y,,,66330:0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,[email protected],,,,,,,,,,,,,,,,,,,,,,,,,,,,20071008205001.004,Success,66330:1,Transfer Consult,,,,,16.157,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
            char[] sep        = new char[] { ',' };
            char[] trim       = new char[] { '"' };
            int    lineNumber = 1;

            try
            {
                using (StreamReader sr = new StreamReader(fileName))
                {
                    String line;
                    while ((line = sr.ReadLine()) != null)
                    {
                        try
                        {
                            // new record
                            BworksCdr aRec = new BworksCdr();

                            // parse the line
                            string[] controls = line.Split(sep);
                            if (controls.GetLength(0) < 100)
                            {
                                // we have a non-data line -- header or footer... so skip it
                                continue;
                            }

                            aRec.recordId        = controls[0].Trim(trim);
                            aRec.serviceProvider = controls[1].Trim(trim);
                            aRec.type            = controls[2].Trim(trim);
                            aRec.userNumber      = controls[3].Trim(trim);
                            aRec.groupNumber     = controls[4].Trim(trim);
                            aRec.direction       = controls[5].Trim(trim);
                            aRec.callingNumber   = controls[6].Trim(trim);
                            aRec.callingPresentationIndicator = controls[7].Trim(trim);
                            aRec.calledNumber              = controls[8].Trim(trim);
                            aRec.startTime                 = controls[9].Trim(trim);
                            aRec.userTimeZone              = controls[10].Trim(trim);
                            aRec.answerIndicator           = controls[11].Trim(trim);
                            aRec.answerTime                = controls[12].Trim(trim);
                            aRec.releaseTime               = controls[13].Trim(trim);
                            aRec.terminationCause          = controls[14].Trim(trim);
                            aRec.networkType               = controls[15].Trim(trim);
                            aRec.carrierIdentificationCode = controls[16].Trim(trim);
                            aRec.dialedDigits              = controls[17].Trim(trim);
                            aRec.callCategory              = controls[18].Trim(trim);
                            aRec.networkCallType           = controls[19].Trim(trim);
                            aRec.networkTranslatedNumber   = controls[20].Trim(trim);
                            aRec.networkTranslatedGroup    = controls[21].Trim(trim);
                            aRec.releasingParty            = controls[22].Trim(trim);
                            aRec.route           = controls[23].Trim(trim);
                            aRec.networkCallId   = controls[24].Trim(trim);
                            aRec.codec           = controls[25].Trim(trim);
                            aRec.group           = controls[31].Trim(trim);
                            aRec.chargeIndicator = controls[41].Trim(trim);
                            aRec.conferenceId    = controls[51].Trim(trim);
                            aRec.userId          = controls[120].Trim(trim);

                            // cache the record
                            theControls.Add(aRec);

                            lineNumber++;
                        }
                        catch (System.Exception ex)
                        {
                            string errorMsg = "Error in File>" + fileName + " Line>" + lineNumber;
                            if (line != null)
                            {// add the line information if available
                                errorMsg += "Line>" + line;
                            }
                            LogFileError(errorMsg + "\r\n" + ex.Message + "\r\n" + ex.StackTrace);
                        }
                    }
                }
            }// try
            catch (Exception e)
            {
                EventLog.WriteEntry(m_eventLogName, "Error in ParseJobControlFile-- error is " + e.ToString(), EventLogEntryType.Error, 3012);
            }// catch

            return(theControls);
        }// private void ParseJobControlFile()
Esempio n. 3
0
        } // insertcdrintodb

        /// <summary>
        /// private method to parse the cdr
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        private ArrayList ParseTheCdr(string fileName)
        {
            // make the array size (number of cdrs per file ) configurable
            System.Collections.ArrayList theControls = new System.Collections.ArrayList(1000);

            // our service provider handler to create a separate file to write the CDRs to
            ServiceProviderCdrHandler spHandler = new ServiceProviderCdrHandler();

            // set up the filenames
            string newFileName = this.ParseFileName(fileName);

            foreach (FtpSiteInfo s in m_ftpSites)
            {
                s.Filename = m_ServiceProviderDirectory + s.ServiceProvider + newFileName.Substring(2) + ".csv";
            }

            // example file formats
            //146148451ce6120071008204847.1711-070000,,Start
            //146158451ce6120071008204858.8531-070000,Javelin_sp,Normal,+14256051047,,Originating,+14256051047,Public,2142498,20071008204858.853,1-070000,Yes,20071008204910.746,20071008205017.699,016,VoIP,,2142498,,,14252142498,,remote,172.27.58.50:5060,[email protected],G729/8000,,,,,,Pacific_Financial_Advisors_gp,,,,,,,,,,y,,,66330:0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,[email protected],,,,,,,,,,,,,,,,,,,,,,,,,,,,20071008205001.004,Success,66330:1,Transfer Consult,,,,,16.157,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
            char[] sep        = new char[] { ',' };
            char[] trim       = new char[] { '"' };
            int    lineNumber = 1;

            try
            {
                using (StreamReader sr = new StreamReader(fileName))
                {
                    String line;
                    while ((line = sr.ReadLine()) != null)
                    {
                        try
                        {
                            if (this.m_getServiceProviderCdrs.Equals("TRUE"))
                            {
                                foreach (FtpSiteInfo s in m_ftpSites)
                                {
                                    spHandler.ProcessServiceProviderCdrs(fileName, line, s);
                                }
                            }

                            // new record
                            BworksCdr aRec = new BworksCdr();

                            // parse the line
                            string[] controls = line.Split(sep);
                            if (controls.GetLength(0) < 100)
                            {
                                // we have a non-data line -- header or footer... so skip it
                                continue;
                            }

                            aRec.recordId        = controls[0].Trim(trim);
                            aRec.serviceProvider = controls[1].Trim(trim);
                            aRec.type            = controls[2].Trim(trim);
                            aRec.userNumber      = controls[3].Trim(trim);
                            aRec.groupNumber     = controls[4].Trim(trim);
                            aRec.direction       = controls[5].Trim(trim);
                            aRec.callingNumber   = controls[6].Trim(trim);
                            aRec.callingPresentationIndicator = controls[7].Trim(trim);
                            aRec.calledNumber              = controls[8].Trim(trim);
                            aRec.startTime                 = controls[9].Trim(trim);
                            aRec.userTimeZone              = controls[10].Trim(trim);
                            aRec.answerIndicator           = controls[11].Trim(trim);
                            aRec.answerTime                = controls[12].Trim(trim);
                            aRec.releaseTime               = controls[13].Trim(trim);
                            aRec.terminationCause          = controls[14].Trim(trim);
                            aRec.networkType               = controls[15].Trim(trim);
                            aRec.carrierIdentificationCode = controls[16].Trim(trim);
                            aRec.dialedDigits              = controls[17].Trim(trim);
                            aRec.callCategory              = controls[18].Trim(trim);
                            aRec.networkCallType           = controls[19].Trim(trim);
                            aRec.networkTranslatedNumber   = controls[20].Trim(trim);
                            aRec.networkTranslatedGroup    = controls[21].Trim(trim);
                            aRec.releasingParty            = controls[22].Trim(trim);
                            aRec.route         = controls[23].Trim(trim);
                            aRec.networkCallId = controls[24].Trim(trim);
                            aRec.codec         = controls[25].Trim(trim);
                            aRec.group         = controls[31].Trim(trim);
                            // added to help determine call flows
                            aRec.department           = controls[32].Trim(trim);
                            aRec.originalCalledNumber = controls[35].Trim(trim);
                            aRec.originalCalledReason = controls[37].Trim(trim);
                            aRec.redirectingNumber    = controls[38].Trim(trim);
                            aRec.redirectingReason    = controls[40].Trim(trim);

                            aRec.chargeIndicator = controls[41].Trim(trim);
                            aRec.conferenceId    = controls[51].Trim(trim);
                            aRec.userId          = controls[120].Trim(trim);

                            // cache the record
                            theControls.Add(aRec);

                            lineNumber++;
                        }
                        catch (System.Exception ex)
                        {
                            string errorMsg = "Error in File>" + fileName + " Line>" + lineNumber;
                            if (line != null)
                            {// add the line information if available
                                errorMsg += "Line>" + line;
                            }
                            LogIt("CdrHandler::ParseTheCdr()::ExceptionCaught:" + errorMsg + "::" + ex.Message);
                        }
                    } // while more lines to read
                }     // using streamreader to read

                // post each service provider CDR file to the ftp site
                foreach (FtpSiteInfo s in m_ftpSites)
                {
                    spHandler.PostFileToSite(s);
                }
            }// try
            catch (Exception e)
            {
                LogIt("CdrHandler::ParseTheCdr()::ExceptionCaught:" + e.Message);
            }// catch

            return(theControls);
        }// private void ParseJobControlFile()
Esempio n. 4
0
        /// <summary>
        /// private method to parse the cdr
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        private ArrayList ParseTheCdr(string fileName)
        {
            // make the array size (number of cdrs per file ) configurable
            System.Collections.ArrayList theControls = new System.Collections.ArrayList(1000);

            // our service provider handler to create a separate file to write the CDRs to
            ServiceProviderCdrHandler spHandler = new ServiceProviderCdrHandler();

            // set up the filenames
            string newFileName = this.ParseFileName(fileName);
            foreach (FtpSiteInfo s in m_ftpSites)
            {
                s.Filename = m_ServiceProviderDirectory + s.ServiceProvider + newFileName.Substring(2) + ".csv";
            }

            // example file formats
            //146148451ce6120071008204847.1711-070000,,Start
            //146158451ce6120071008204858.8531-070000,Javelin_sp,Normal,+14256051047,,Originating,+14256051047,Public,2142498,20071008204858.853,1-070000,Yes,20071008204910.746,20071008205017.699,016,VoIP,,2142498,,,14252142498,,remote,172.27.58.50:5060,[email protected],G729/8000,,,,,,Pacific_Financial_Advisors_gp,,,,,,,,,,y,,,66330:0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,[email protected],,,,,,,,,,,,,,,,,,,,,,,,,,,,20071008205001.004,Success,66330:1,Transfer Consult,,,,,16.157,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
            char[] sep = new char[] { ',' };
            char[] trim = new char[] { '"' };
            int lineNumber = 1;
            try
            {
                using (StreamReader sr = new StreamReader(fileName))
                {
                    String line;
                    while ((line = sr.ReadLine()) != null)
                    {
                        try
                        {

                            if (this.m_getServiceProviderCdrs.Equals("TRUE"))
                            {
                                foreach (FtpSiteInfo s in m_ftpSites )
                                {
                                    spHandler.ProcessServiceProviderCdrs(fileName, line, s );
                                }
                            }

                            // new record
                            BworksCdr aRec = new BworksCdr();

                            // parse the line
                            string[] controls = line.Split(sep);
                            if (controls.GetLength(0) < 100)
                            {
                                // we have a non-data line -- header or footer... so skip it
                                continue;
                            }

                            aRec.recordId = controls[0].Trim(trim);
                            aRec.serviceProvider = controls[1].Trim(trim);
                            aRec.type = controls[2].Trim(trim);
                            aRec.userNumber = controls[3].Trim(trim);
                            aRec.groupNumber = controls[4].Trim(trim);
                            aRec.direction = controls[5].Trim(trim);
                            aRec.callingNumber = controls[6].Trim(trim);
                            aRec.callingPresentationIndicator = controls[7].Trim(trim);
                            aRec.calledNumber = controls[8].Trim(trim);
                            aRec.startTime = controls[9].Trim(trim);
                            aRec.userTimeZone = controls[10].Trim(trim);
                            aRec.answerIndicator = controls[11].Trim(trim);
                            aRec.answerTime = controls[12].Trim(trim);
                            aRec.releaseTime = controls[13].Trim(trim);
                            aRec.terminationCause = controls[14].Trim(trim);
                            aRec.networkType = controls[15].Trim(trim);
                            aRec.carrierIdentificationCode = controls[16].Trim(trim);
                            aRec.dialedDigits = controls[17].Trim(trim);
                            aRec.callCategory = controls[18].Trim(trim);
                            aRec.networkCallType = controls[19].Trim(trim);
                            aRec.networkTranslatedNumber = controls[20].Trim(trim);
                            aRec.networkTranslatedGroup = controls[21].Trim(trim);
                            aRec.releasingParty = controls[22].Trim(trim);
                            aRec.route = controls[23].Trim(trim);
                            aRec.networkCallId = controls[24].Trim(trim);
                            aRec.codec = controls[25].Trim(trim);
                            aRec.group = controls[31].Trim(trim);
                            // added to help determine call flows
                            aRec.department = controls[32].Trim(trim);
                            aRec.originalCalledNumber = controls[35].Trim(trim);
                            aRec.originalCalledReason = controls[37].Trim(trim);
                            aRec.redirectingNumber = controls[38].Trim(trim);
                            aRec.redirectingReason = controls[40].Trim(trim);

                            aRec.chargeIndicator = controls[41].Trim(trim);
                            aRec.conferenceId = controls[51].Trim(trim);
                            aRec.userId = controls[120].Trim(trim);

                            // cache the record
                            theControls.Add(aRec);

                            lineNumber++;
                        }
                        catch (System.Exception ex)
                        {
                            string errorMsg = "Error in File>" + fileName + " Line>" + lineNumber;
                            if (line != null)
                            {// add the line information if available
                                errorMsg += "Line>" + line;
                            }
                            LogIt("CdrHandler::ParseTheCdr()::ExceptionCaught:" + errorMsg + "::" + ex.Message);
                        }

                    }// while more lines to read

                }// using streamreader to read

                // post each service provider CDR file to the ftp site
                foreach (FtpSiteInfo s in m_ftpSites)
                {
                    spHandler.PostFileToSite( s );
                }

            }// try
            catch (Exception e)
            {
                LogIt("CdrHandler::ParseTheCdr()::ExceptionCaught:" + e.Message);
            }// catch

            return theControls;
        }