Esempio n. 1
0
        private KamailioRegistrationExpireMessage ParseRegExpire(KamailioData kamailioData)
        {
            var expire = new KamailioRegistrationExpireMessage()
            {
                SipAddress = new SipUri(kamailioData.GetField("aor")),
                ReceivedIp = kamailioData.GetField("ip"),
            };

            return(expire);
        }
Esempio n. 2
0
        private KamailioDialogMessage ParseDialog(KamailioData kamailioData)
        {
            DialogStatus dialogStatus;

            if (!Enum.TryParse(kamailioData.GetField("dstat"), true, out dialogStatus))
            {
                log.Warn("Unable to parse dstat field of Kamailio dialog message");
                return(null);
            }

            var dialog = new KamailioDialogMessage
            {
                Status          = dialogStatus,
                CallId          = kamailioData.GetField("ci"),
                HashId          = kamailioData.GetField("hashid"),
                HashEntry       = kamailioData.GetField("hashent"),
                FromDisplayName = ParseDisplayName(kamailioData.GetField("fn")),
                ToDisplayName   = ParseDisplayName(kamailioData.GetField("tn")),
                FromSipUri      = new SipUri(kamailioData.GetField("fu")),
                ToSipUri        = new SipUri(kamailioData.GetField("ru")),
                FromTag         = kamailioData.GetField("fot"),
                ToTag           = kamailioData.GetField("tot"),
                Sdp             = kamailioData.GetField("sdp"),
                HangupReason    = kamailioData.GetField("hr")
            };

            // Fix för tomt ru-fält i kamailio-data
            if (dialog.ToSipUri == null || string.IsNullOrEmpty(dialog.ToSipUri.User))
            {
                dialog.ToSipUri = new SipUri(kamailioData.GetField("tu"));
            }

            return(dialog);
        }
Esempio n. 3
0
        private KamailioRegistrationMessage ParseRegistration(KamailioData kamailioData)
        {
            var registration = new KamailioRegistrationMessage()
            {
                Ip            = kamailioData.GetField("si"),
                Port          = ParseInt(kamailioData.GetField("sp")),
                UnixTimeStamp = ParseLong(kamailioData.GetField("TS")),
                Sip           = new SipUri(kamailioData.GetField("fu")),
                UserAgent     = kamailioData.GetField("ua"),
                Username      = kamailioData.GetField("Au"),
                ToDisplayName = ParseDisplayName(kamailioData.GetField("tn")),
                Expires       = ParseInt(kamailioData.GetField("Expires"), DefaultExpireValue),

                // Används inte
                ToUsername      = kamailioData.GetField("rU"),
                RequestedSip    = new SipUri(kamailioData.GetField("ru")),
                ReceivedIp      = kamailioData.GetField("Ri"),
                ReceivedPort    = ParseInt(kamailioData.GetField("Rp")),
                FromDisplayName = ParseDisplayName(kamailioData.GetField("fn")),
                CallId          = kamailioData.GetField("ci"),
            };

            return(registration);
        }