Beispiel #1
0
        public bool Parse(string name, string value)
        {
            switch (name)
            {
            case "channel-state":
                State = ChannelStateParser.Parse(value);
                break;

            case "channel-state-number":
                int.TryParse(value, out _stateNumber);
                break;

            case "channel-name":
                Parse(value);
                break;

            case "channel-read-codec-name":
                ReadCodecName = value;
                break;

            case "channel-read-codec-rate":
                int.TryParse(value, out _readCodecRate);
                break;

            case "channel-write-codec-name":
                WriteCodecName = value;
                break;

            case "channel-write-codec-rate":
                int.TryParse(value, out _writeCodecRate);
                break;

            case "channel-presence-id":
                PresenceId = value;
                break;

            case "channel-call-uuid":
                CallId = new UniqueId(value);
                break;

            case "channel-call-state":
                CallState = Enumm.Parse <CallState>(value);
                break;

            case "channel-read-codec-bit-rate":
                ReadCodecBitRate = value.Split(',').Select(int.Parse).ToArray();
                break;

            case "channel-write-codec-bit-rate":
                WriteCodecBitRate = value.Split(',').Select(int.Parse).ToArray();
                break;

            default:
                return(false);
            }
            return(true);
        }
Beispiel #2
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);
        }