Retrieve call forwarding (routing) rules of a Lync client - c#

How can I retrieve the call forwarding (routing) rules of a lyn client using UCMA or MSPL?
I have tried to retrieve it using a UserEndpoint and subscribing to the PresenceNotificationReceived event of RemotePresenceView.
Unfortunately this seems not to work. According to the msdn documentation it is only possible to query the route category with a local-access (LocalOwnerPresence).
Another options would be to use an ApplicationEndpoint of impersonate every user for which I want the retrieve the call forwarding rules. But in my eyes this seems to be a dirty solution.
Could this be also be done with MSPL?

In my tests this:
Another options would be to use an ApplicationEndpoint of impersonate every user for which I want the retrieve the call forwarding rules. But in my eyes this seems to be a dirty solution.
Has been the only working solution (outside of querying the database directly).
If you want this done in MSPL, look at QueryCategory. The problem there is you will need the correct ContainerNumber and Instance ids.
However, if you look them up (See MSDN for Presence data source and category instance ID) you will find there is no instance numbers listed for routing. The container number info can be found here: Routing category instance value element, and that one does list some instance IDs.
Interesting point is that routing data is classified as "local only", see Local-access only category instances:
The routing category instances contain routing rules to forward inbound calls made by any members of a hosting container. They are private category instances and are not visible to the remote users who are members of the hosting containers.
So far I have not found a combination of name ('routing'), ContainerNumber and Instance id that give any results, so please update if you find anything.

Related

How do I set a default naming convention for subscriptions and queues in MassTransit?

Currently we are tied to a single Azure Service Bus instance for local and the test environment (I would prefer a different setup but It's not up to me). Previously we were using a custom framework that for each topic it created a subscrption with a name that was a mix of the service name and, if the project was run by a dev in his machine, it appended a "local name" to avoid having all the dev local computers and the server instances competing for the same message. So for example for the ShoppingService it created a subscription called ShoppingService for the server instances and in Joe's local machine it created a subscription called let's say ShoppingService-JoeComputer. Right now we are trying to switch from this custom framework to MassTransit because we like the additional features it provides (and also because honestly the custom framework was more buggy than we would like to admit). We followed this video published by Patterson to create the commands, events and consumers and everything works as described:
MassTransit - Using Azure Service Bus
However, we are now facing the competition issue I mentioned before. To solve it we will try to set the custom naming convention we are currently using so the questions I have are:
Is there a way to modify the default naming convention used by MassTransit? We would like to keep most of it where it creates a topic based on the command type name but we would like to add a postfix to both the forwarding subscription and the queue. In other words if we were talking about the submit order command described in the video we would like the subscription name to be "submit-order-joe" and the queue name to be "submit-order-joe" if it runs on joe's machine. We could set up the configuration manually for each consumer/client/publisher but it would be great if we can set it up "globally".
Using the default convention, what happens if there are two commands named "namespaceOne.SubmitOrder" and "namespaceTwo.SubmitOrder"? Based on what we saw it would create two different topics but both subscriptions would be called "submit-order" and both would forward messages to the same queue called "submit-order". That would be confusing and I don't even know if MassTransit is going to consume the commands correctly.
There are two naming conventions in MassTransit. Entity names (which are based upon message type, and would be topics in Azure Service Bus) and endpoint names (which are based upon the consumer, saga, or activity type and would be queues in ASB).
You can specify your own entity name formatter to customize the entity name format, or you can override specific messages.
You can also specify your own endpoint name formatter, described in this video to customize the queue names generated for receive endpoints. Or you can create an instance of the built-in formatters specifying different constructor arguments to include a prefix, include the namespace, etc.

Add session variable to inbound and outbound URLs

I'm designing a site using ASPx and IIS, where clients can sign up and then offer services to their clients. For example:
if you go to http://www.mywebsite.com you can sign up for your mywebsite.com account as a business owner. When you sign up, you are given a Site ID (Example: AA1234).
http://www.mywebsite.com/AA1234
What I want to do is always include the Site ID in every url (Inbound and Outbound). The Site ID is stored in a session variable based on the initial incoming request.
Does anyone know of a good way to do this - or a different design that works better than this?
Thanks
Your question is nebulous at best. However...
Wouldn't this be what cookies are used for?
In particular, if your user is authenticated (this is generally achieved in asp.net with an auth cookie), then at the server, you would have tools at your disposal that allow you to recognize the user and provide a different experience according to whatever criteria you choose. Most likely, these details might be stored in a database.
Found the answer in this topic: http://www.tek-tips.com/viewthread.cfm?qid=1149673
The last response from BoulderBum is exactly what I needed.
Using the HTTP module I will take the /AA1234/ URL and point it to /Company/.
On the way out, I replace all instances of /Company/ with the site id again

Getting main domain name from referring website

We are relying on refering urls when we pick up requests from users who installed our widget, it's just and iframe, similar to Google plus button, Facebook Like etc.
Recently we noticed that Google's blogspot blogs can be accessed using multiple urls with different ending like:
*.blogspot.com
*.blogspot.fr
*.blogspot.co.uk
...
Now our database is getting filled with duplicate websites.
Is there any way to get real address every time like *.blogspot.com
Are there any other websites that do such a thing, make themsalves available through different domains without redirecting to real one, or is blogspot specific?
How does facebook handle this, do people that own blog on blogspot have different like count for different domain?
You can do a dns lookup for CNAME entries.
var host = Dns.GetHostByName("www.blogspot.com").HostName;
// host == "blogger.l.google.com"
If the host DNS contains a CNAME, the HostName property will return the CNAME.
The following description my be helpful:
A CNAME record or Canonical Name record is a type of resource record
in the Domain Name System (DNS) that specifies that the domain name is
an alias of another, canonical domain name. Here "canonical" usually
means: a more generally accepted or standard name.
(Wikipedia)

Identify if an email address is 'public'

I would like to identify if an email address comes from a public provider or is from an established business. I consider public email addresses to be things such as:
Open email service providers, such as
gmail, hotmail and yahoo.
Anonymization services, such as mailinator or dispostable.
I'm aware that there is no foolproof way to do this, and obviously any list based solution would require constant updates.
Is there a public listing or .NET library that can do this for me?
Are there really that many free webmail providers out there? I would go with a 'blacklisting' style solution.
For example, flag everything in this wikipedia list as free (heck I would think covering gmail/hotmail/yahoo/aol would cover a huge % of users anyway). Then if you get more than 2 (or higher number if your site has high throughput) registrations from the same email domain, it notifies the admin to check the domain to see if it needs to be added to the 'blacklist'.
I would imagine there are much more reliable ways to detect business customers though. For example in Australia you could just ask for an ABN and then check that it's valid. Are you willing to punish small business who don't have email providing and just use a generic #gmail account?
Here is a link to SpamAssasin's freemail list: http://svn.apache.org/repos/asf/spamassassin/trunk/rules/20_freemail_domains.cf.
I suppose, checking against this list is a good start.
You might want to talk to the Better-Business-Bureau ( http://www.bbb.org ) and see if they provide some kind of a feed or API. I had a quick look at their site and couldn't see anything obvious, but it would be this kind of organisation I would head to first if I wanted to find out domain names belonging to established businesses. They do have a form on their site to search by email address ( http://www.bbb.org/us/Find-Business-Reviews/ )
Consider using HubSpot blocked domains list. It is not a guarantee that it is 100% accurate or complete.
They also provide a CSV file that you can download and parse programmatically. Link to CSV file is in the linked page.
I am guessing the ultimate goal is to clean your database from unwanted contacts that will increase the monthly bill. What you can do is the following:
Create a webhook that is triggered whenever a new contact is added.
In that webhook (which can be written in any language), check if the contact is in a blacklist (which is gmail/etc...).
Remove the contact if it is in a blacklist using an API call (you will need to first get the contact ID, which can be easily retrieved using API).

Global variables in WCF REST services

My applciation works as follows
[user]----username/password/domain----->[WCF service]
then i access the domain server to see to which actual DB the user is associated,
after getting that, i validate the user in his actual DB(DB is per domain)
the problem is that i need a place to store the domain name for the following requests against the db.
for example,if the users calls a WCF service operation:
Test()
first the validation procedure is called, (WCF UserNamePasswordValidator) which validates the user password(which is sent as part of the header for REST or as part of the SOAP), and the next function to be called is the Test, but by then i cant tell the domain of the user(to actually serve the request agains that domain..)
I dont want to change the signature of each domain to
Test(string domain)
I cant simply access the headers since i expose the same methods both as REST and as SOAP and the authentication is different for each of them..(one is with headers as with Amazon S3 and the later is using the SOAP standard)
so basically i'm looking for a global, per call storage.(i want to avoid the Per-Call initiation method)
thanks.
EDIT:
Maybe i should use the ThreadStaticAttribute? will that work?
This will not work. You can't store anything in UserNamePasswordValidator. It even doesn't have access to OperationContext because it runs on different thread.
The way to do this is create custom message inspector and extract the information from custom message header to custom operation context extension as Frank mentioned.
WCF knows a Current OperationContext. You can write your own extensions for it. Unrelated to this issue, I used the same mechanics in this NHibernate Session management here, which may work in its concept for you as well. It accesses the InstanceContext, but the concepts are similar.

Categories

Resources