dialing numbers after call is initiated in lync - c#

I am initiating a call using Lync Sdk,
I am making an application that dials to an automated voice message service and i want to dial numbers after the call is initiated to automatically choose menu options.
so i need to basically dial digits from code after the call is initiated.
any ideas?

First, you need to get to the AudioChannel on the Conversation:
var avModality = (AVModality)conversation.Modalities[ModalityTypes.AudioVideo];
var audioChannel = avModality.AudioChannel;
Then you can send DTMF tones down the channel:
avModality.AudioChannel.BeginSendDtmf("1", SendDtmfComplete, null));
Bear in mind that the service on the other end may change the order of the menu options, or may require a delay before sending the tone.
If you think this is the right answer, please mark it as accepted, to help anyone else browsing the question. Thanks!

Related

How to redirect already answered incoming call using pjsip?

I use pjsip.dll for creating softphone app. Answering and dialing works fine.
Now, I need to redirect already answered incoming call to another sip-user (for example, from number 101 to 104). How to do that? I cannot find function in pjsip sdk docs.
I have a C# app (softphone with sipek sdk wrapper), PBX, Asterisk.
Library should have SIP transfer option.
If it have no, freepbx have transfer code like *2(pause 0.1sec), 100(pause 0.1),#, Hangup. Just use DTMF and send that sequence.

UCMA recording app

I've installed a MSPL script to redirect INVITE audio messages to the UCMA sip address
I'm currently writing a UCMA app for Skype for Business to:
receive incoming calls
accept the call
create a conference call
add a trusted participant to the conference
create a recording instance on the trusted participant audio flow to record the conversation
The last thing I need to do is add the To caller URI to the conference call.
I've tried to invite the new participant into the conference using the code examples from this article, but I get an exception saying there are no AvailableMediaTypes in the conversation.
public static async void InviteToConference(string destinationUri)
{
//Create a new conversation for the application endpoint.
_toConversation = new Conversation(_server.ApplicationEndPoint);
var conferenceInviteSettings = new ConferenceInvitationSettings();
conferenceInviteSettings.ConferenceUri = _conferenceUri;
ConferenceInvitation invitation = new ConferenceInvitation(_toConversation, conferenceInviteSettings);
try
{
await invitation.DeliverAsync(destinationUri);
}
catch (InvalidOperationException)
{
// Conversation was terminated while trying to add participant.
}
}
Can someone please show me what I need to do to add / invite a participant into a conference call?
It would be even better if someone could show me how to record a Skype for Business call without the need to create a conference, as a conference can't be forwarded.
Your code looks like the old way (UCMA 3) of doing it. Have you tried this.
e.g.
McuDialOutOptions mcuDialOutOptions = new McuDialOutOptions();
mcuDialOutOptions.ParticipantUri = "sip:alice#contoso.com";
mcuDialOutOptions.ParticipantDisplayName = "Alice";
mcuDialOutOptions.PreferredLanguage = CultureInfo.GetCultureInfo("en-us");
conversation.ConferenceSession.AudioVideoMcuSession.BeginDialOut("tel:+14255551234", mcuDialOutOptions, dialOutCallback, state);
Using this sort of method to record very specific and low traffic should be fine but when you start to scale it up then you are going to hit all sorts of problems.
As for how to do it without a conference:
There is no way to do it fully with the supplied Microsoft API's.
What you have to do is implement, buy or use open source libraries for the following pieces:
sniff network packets
decode RTP/SRTP streams
decode the audio and/or video codecs used between the callers
encode streams into your desired format and save somewhere
To get access to the SRTP streams encryption setup and to figure out what the dynamic payload types for the audio/video codecs used, you also need to know the SDP offered and answered between the calling parties. You also need access to the SIP traffic to determine the calling parties to know who called who. This can be a lot more trouble than what it seems...
To get the SIP/SDP information there are two options that I know of:
Skype/Lync Server SDK (MSPL / Server Application) to see most of the SIP traffic. This is what I've used to implement a recording solution.
Skype/Lync SDN SDK - I haven't used this API but it seems to give access to the SDP so it should work.
If you get all these peices into place then the next problem is you can only "record" (basically "sniff") what you can see. If you can't see the RTP/SRTP traffic you can't record the calls.
So you need to have the sniffer part of the recording software on areas of the network that see the traffic you want to record. For example if you wish to record all PSTN calls, you can have a network spanning port off the Skype mediation servers.
If you wish to record ALL calls, then that gets a lot harder. You most likely need to either:
Force all media trafic to go through a known place (like the Edge server) and put sniffers on the that network.
Have lots of sniffers in strategic areas of the network to capture most RTP/SRTP traffic.
The problems with the above solutions are:
Forcing all the traffic through one point can cause performance issues (like you will see with your conference setup) once load starts to increase. Also forcing external (edge server users) and/or federated calls through this one point can cause a problems. Think edger server user calls to edge server users where the media traffic may not even go into your network at all but live only on the internet. Forcing the trafficing into your network can cause performance issues.
When not forcing all the traffic through one point, you may never be see all skype user to skype user calls depending on your network setup. Calls between Edge server skype users are even more of a problem as the media traffic may not even enter your network at all.
On top of all that there are the general problems of storage management (recording after a while will start taking up a large amount of disk space) and call recording management (e.g. searching for a specific call) and user security around these recordings to deal with. I'm sure I'm missing a lot but those are the basics.
If recording in not going to be a core component, you could just buy a 3rd party call recording solution that supports Lync/Skype.

Windows 10 Feedback Task for my App

Similar to this question which invokes the Windows 10 store to allow a user to write a review or rate an app, I'd also like to be able to invoke the Windows 10 Feedback app and allow users to provide feedback there.
I cannot seem to find much information on:
How this works in general. Can any old app use this service? (I
notice it just kind of shows whatever apps I have running)
How to invoke the Windows Feedback app with my package id
In short - not that I can see.
Other apps are invoked via protocol activation. I haven't seen this documented for the feedback app though so I have to err on the side of 'we haven't made this available yet' (I'm still checking though)
Here's an overall guide to the process http://blog.jerrynixon.com/2012/10/walkthrough-using-windows-8-custom.html?m=1
When I look in the registry under HKEY_CLASSES_ROOT\Extensions\ContractId\Windows.Protocol I see (shortened a tad)
[HKEY_CLASSES_ROOT\Extensions\ContractId\Windows.Protocol\PackageId\Microsoft.WindowsFeedback...\ActivatableClassId\App.AppX7eaybq6p4x7d4jgd6w6jk7r5dg6yhmbf.mca\CustomProperties]
"Name"="windows-feedback"
So - give that a try via launching windows-feedback
If I do Windows Key-R (run): windows-feedback://
it works fine so this should work:
var uri = new Uri(#"windows-feedback://");
var success = await Windows.System.Launcher.LaunchUriAsync(uri);
if (success)
{
// URI launched
}
else
{
// URI launch failed
}
Update
I've done some searching and it seems the magic parameter there is
windows-feedback:?contextid=522
That launches the NFL feedback for example. This is a predetermined number - I'm not sure how one gets on this list though.

Azure Application Insights custom response metric

I need some help to find a good pattern for a custom application insights metric.
Environment
I have a custom Windows Service running on multiple Azure VMs.
I can successfull add Events to my Monitoring instance on Azure.
Goal
I want to create a custom metric that allows me to monitor if my windows services are running and responding per instance. It would be perfect if it acts like the respond timeout in website metric.
Each service instance has a custom maschine related identifier, like:
TelemetryClient telemetry = new TelemetryClient();
telemetry.Context.Device.Id = FingerPrint.Instance;
Now I wnat to create a alert if one of my Service instances (Context.Device.Id) is not running or responding.
Question
How to achive this?
Is it even possible or usefull to Monitor multiple instance of one service type onside on application insight? Or must I open one single application insight per instance?
Can anybody help me?
Response to Paul's answere
Track Metric Use TrackMetric to send metrics that are not attached to particular events. For example, you could monitor a queue length at regular intervals.
If I do so, whats happens if my server made a restart (update or somethink) and my service don't start up. Now the service did't send a TrackMetric to the application insight and no alert is raised because the value don't drop below 1, but the Service is still not running.
Regards Steffen
I found a good working solution, with only a few simple steps.
1) Implement a HttpListener instance on a service port (for example 8181) with a simple text response "200: OK"
2) Add a matching endpoint to the azure VM imstande
3) Create a default web test on "myVM.cloudapp.net:8181" with checkup of response text
Work great so far and matches all my needs! :)
Per the documentation on Azure portal:
https://azure.microsoft.com/en-us/documentation/articles/app-insights-api-custom-events-metrics/#track-metric
Track Metric
Use TrackMetric to send metrics that are not attached to particular events. For example, you could monitor a queue length at regular intervals.
Metrics are displayed as statistical charts in metric explorer, but unlike events, you can't search for individual occurrences in diagnostic search.
Metric values should be >= 0 to be correctly displayed.
c# code looks like this
private void Run() {
var appInsights = new TelemetryClient();
while (true) {
Thread.Sleep(60000);
appInsights.TrackMetric("Queue", queue.Length);
}
}
I don't think there is currently a good way to accomplish this. What you're actually looking for is a way to detect a "stale heartbeat." For example, if your service was sending up an event "Service Health is okay", you'd want an alert that you haven't received one of those events in a certain amount of time. There aren't any date/time conditional operators in AI's alert system.
Microsoft might explain that this scenario is not intended to be satisfied by AI, as this is more of a "health checking" system's responsibility, like SCOM or Operation Insights or something else entirely.
I agree this is something that needs a solution, and using AI for it would be wonderful (I've already attempted to accomplish the same thing with no luck); I just think "they" will say its not a scenario in the realm of responsibility for AI.

In need of some advice controlling a C# winforms application via a asp.net website

I'm working on a little project for a basic Youtube remote control, whereby I have a helper app running on my PC, and then can send commands from a website accessed via the web browser on my phone.
Reading through threads on other sites from people trying to do the same thing I've realized it is not a concept that most people would be comfortable with, but I am struggling to think of another way to do it beyond writing a native app for my phone and having it communicate with the helper application internally via WLAN(Would be happy to do this, but don't have the cash to spring for a new mac to develop for my iphone).
If I were to stick with the Website/Winforms model, is there a way to do this in such a way that (most) people would be comfortable running?
The ideas I had so far were:
a) Build a web server into the helper app(Though not sure of the logistics of having it host an ASP.net site)
b) Host the site externally, and have the helper app periodically poll a database/webservice on a server to receive commands (Sketchy and i imagine very resource heavy)
Sorry for the wall of text, I'm capable of running with an idea and building it, I'm just not sure what is possible and considered the 'best' way to do something like this.
Any advice would be appreciated.
Cheers
Edit Thanks, just to be clear, when i say uncomfortable, I mean - Would you be ok with having a website being able to send potentially ANY command to your computer? This seems to be the problem raised in other discussions about this topic. Obviously I'm not trying to do anything malicious, but as I said, it seemed to be a concern.
If this is a controlled environment where you can always open a port on the firewall for incoming communication, you can have the web app make a WCF call back to the Windows Client through the users firewall.
If not (which is what I suspect), you may be better off polling a web service. Just do it every few seconds and whatever you're checking in that web service call (a database?) make sure it's well optimized. Perhaps just have it return some status int/enum or something very light weight to instruct the client on the next call to make (0 = no update, 1 = command1, 2 = command2, etc).
As for how you do the polling, you could do something like:
int seconds = 4;
System.Timers.Timer _clientTimer = new System.Timers.Timer(seconds * 1000);
_clientTimer.AutoReset = false;
_clientTimer.Elapsed += clientTimer_Elapsed;
_clientTimer.Start();
private void clientTimer_Elapsed(object sender, ElapsedEventArgs e)
{
try
{
// Connect to web service, get status, if status != 0 do something...
}
finally
{
_clientTimer.Start();
}
}
NOTE: the auto-reset = false means that each time the Elapsed event fires, the timer is stopped. In the approach I've taken, I let the timer stop so the client can process the web service results and then start the timer once again after it's done. This will help prevent multiple requests from piling up if a connection is real slow.
That's all I can think of :)

Categories

Resources