Пример #1
0
        public override bool ParseParameter(string name, string value)
        {
            var res = ChannelState.ParseParameter(name, value);

            switch (name)
            {
            case "status":
                Status = value;
                break;

            case "rpid":
                Rpid = value;
                break;

            case "login":
                Login = value;
                break;

            case "event_type":
                PresenceEventType = value;
                break;

            case "resub":
                ReSubscribe = value == "true";
                break;

            case "alt_event_type":
                AlternativeEventType = value;
                break;

            case "event_count":
                EventCount = int.Parse(value);
                break;

            case "channel-state":
                State = ChannelStateParser.Parse(value);
                break;

            case "presence-calling-file":
                CallingFile = value;
                break;

            case "presence-calling-function":
                CallingFunction = value;
                break;

            case "presence-calling-line":
                CallingLineNumber = int.Parse(value);
                break;

            default:
                if (name.Length > 8 && name.Substring(0, 8) == "channel-")
                {
                    if (ChannelInfo == null)
                    {
                        ChannelInfo = new ChannelInfo();
                    }
                    return(ChannelInfo.Parse(name, value));
                }
                if (name.Length > 7 && name.Substring(0, 7) == "caller-")
                {
                    if (Caller == null)
                    {
                        Caller = new PartyInfo();
                    }
                    return(Caller.Parse(name.Substring(7), value));
                }

                return(base.ParseParameter(name, value) || res);
            }
            return(true);
        }