public CallHistoryItem(CallHistoryEntryTypes type, string number, string displayName, int duration, long timeInitiated)
 {
     Type          = type;
     Number        = number;
     DisplayName   = displayName;
     Duration      = duration;
     TimeInitiated = timeInitiated;
 }
        private void HandleCallHistoryStatus(ArrayList callHistoryList)
        {
            List <CallHistoryItem> callHistoryItemList = new List <CallHistoryItem>();

            foreach (Hashtable callHistory in callHistoryList)
            {
                CallHistoryEntryTypes type = CallHistoryEntryTypes.Missed;
                int  duration      = 0;
                long timeInitiated = 0;

                string typeStr = (string)callHistory[CMessageParser.ApiStringConstants.CallHistoryStatusResponse.Type];
                if (typeStr != null)
                {
                    switch (typeStr)
                    {
                    case CMessageParser.ApiStringConstants.CallHistoryEntryType.Missed:
                        type = CallHistoryEntryTypes.Missed;
                        break;

                    case CMessageParser.ApiStringConstants.CallHistoryEntryType.Received:
                        type = CallHistoryEntryTypes.Received;
                        break;

                    case CMessageParser.ApiStringConstants.CallHistoryEntryType.Dialed:
                        type = CallHistoryEntryTypes.Dialed;
                        break;
                    }
                }

                string number = (string)callHistory[CMessageParser.ApiStringConstants.CallHistoryStatusResponse.Number];

                string displayName = (string)callHistory[CMessageParser.ApiStringConstants.CallHistoryStatusResponse.DisplayName];

                string durationStr = (string)callHistory[CMessageParser.ApiStringConstants.CallHistoryStatusResponse.Duration];
                if (durationStr != null)
                {
                    duration = System.Convert.ToInt32(durationStr);
                }

                string timeInitiatedStr = (string)callHistory[CMessageParser.ApiStringConstants.CallHistoryStatusResponse.TimeInitiated];
                if (timeInitiatedStr != null)
                {
                    timeInitiated = System.Convert.ToInt64(timeInitiatedStr);
                }

                CallHistoryItem callHistoryItem = new CallHistoryItem(type, number, displayName, duration, timeInitiated);
                callHistoryItemList.Add(callHistoryItem);
            }

            if (OnCallHistoryStatus != null)
            {
                OnCallHistoryStatus(this, new CallHistoryStatusEventArgs(callHistoryItemList));
            }
        }