Exemplo n.º 1
0
		public SimpleTU(SimpleModule simpleModule)
		{
			this.dialogManager = new DialogManager();

			this.simpleModule = simpleModule;
			this.simpleModule.NotifyEvent += SimpleModule_NotifyEvent;
			this.simpleModule.SubscriptionRemovedEvent += SimpleModule_SubscriptionRemovedEvent;

			this.notifyProducer = new ProducedRequest(this);
		}
Exemplo n.º 2
0
		public MsPresTU(IAccounts accounts, IUserz userz, LocationService locationService)
		{
			this.accounts = accounts;
			this.userz = userz;
			this.locationService = locationService;
			this.enhancedPresence = new EnhancedPresence1(BenotifyHandler);
			this.dialogManager = new DialogManager();

			locationService.AorAdded += LocationService_AorAdded;
			locationService.AorRemoved += LocationService_AorRemoved;
			locationService.ContactAdded += LocationService_ContactAdded;
			locationService.ContactRemoved += LocationService_ContactRemoved;

			userz.Updated += Users_AddedOrUpdated;
			userz.Added += Users_AddedOrUpdated;
			userz.Reset += Users_Reset;

			accounts.ForEach((account) =>
			{
				for (int i = 0; i < userz.Count; i++)
					ResetUsers(userz[i], account);
			});
		}
Exemplo n.º 3
0
        public void GenerateForwardedRequest(SipMessageWriter writer, SipMessageReader reader, ArraySegment <byte> content, ConnectionAddresses fromConnectionAddress, int serverTransactionId)
        {
            //dialog2 = new Dialog(reader, fromTag, fromConnectionAddress);

            Dialog dialog1 = null;

            if (HexEncoding.TryParseHex8(reader.To.Tag, out tag))
            {
                dialog1 = trunk.GetDialog1(tag);
            }
            else
            {
                tag = DialogManager.NewLocalTag();
            }

            dialog2 = new Dialog(reader, tag, fromConnectionAddress);
            trunk.AddDialog2(tag, dialog2);

            /////////////////////////////////////////////////////////////////////////////////

            writer.WriteRequestLine(reader.Method, binding.AddrSpec);

            //var msReceivedCid = fromConnectionAddress.ToLowerHexChars(serverTransactionId);
            //writer.WriteVia(binding.ConnectionAddresses.Transport, binding.ConnectionAddresses.LocalEndPoint, TransactionId, msReceivedCid);
            writer.WriteVia(binding.ConnectionAddresses.Transport, binding.ConnectionAddresses.LocalEndPoint, TransactionId);

            for (int i = 0; i < reader.Count.HeaderCount; i++)
            {
                switch (reader.Headers[i].HeaderName)
                {
                case HeaderNames.MaxForwards:
                    writer.WriteMaxForwards((reader.MaxForwards == int.MinValue) ? 69 : reader.MaxForwards - 1);
                    break;

                case HeaderNames.Contact:
                    writer.WriteContact(binding.ConnectionAddresses.LocalEndPoint, binding.ConnectionAddresses.Transport);
                    break;

                case HeaderNames.To:
                    writer.WriteTo(trunk.ForwardCallToUri, (dialog1 != null) ? dialog1.RemoteTag : ByteArrayPart.Invalid);
                    break;

                case HeaderNames.From:
                    writer.WriteFrom(reader.From.AddrSpec.Value, tag);
                    break;

                case HeaderNames.Authorization:
                    break;

                default:
                    writer.WriteHeader(reader, i);
                    break;

                case HeaderNames.Via:
                    via = reader.Headers[i].Value.DeepCopy();
                    break;
                }
            }

            if (reader.ContentLength == int.MinValue)
            {
                writer.WriteContentLength(content.Count);
            }

            writer.WriteCustomHeaders();
            writer.WriteCRLF();

            writer.Write(content);
        }
Exemplo n.º 4
0
		public MessageSummaryTU()
		{
			dialogManager = new DialogManager();
			notifyProducer = new ProducedRequest(this);
		}