Cannot make call programatically in WDE

Hi, I´m customizing WDE. I login my agent in place P305, in the extension 305, and acd position acd_305. I want to make a call programatically to extension 202, so first in my custom module I obtaing Agent, Voice Service and Channel Service as following:

   [b]  agent = unityContainer.Resolve<Genesyslab.Desktop.Modules.Core.Model.Agents.IAgent>();
     
     IEnterpriseServiceProvider enterpriseServiceProvider = agent.EntrepriseService;
     
     voiceService = enterpriseServiceProvider.Resolve<IVoiceService>("voiceService");

     channelService = enterpriseServiceProvider.Resolve<IChannelService>("channelService");[/b]

All this atributes are static, and can be obtained from other classes.
When I want to make the call, i invoke the following method:

voiceService.MakeCall(agent.EnterpriseAgent, channelService.GetChannel(“TServerNEAX”), “202@SwitchNEAX”, Genesyslab.Enterprise.Model.Interaction.MakeCallType.Regular, “”, kvp, kvp, kvp, 20000);

Exception tells me my agent dn is not valid. But if I call 202 naturally from interaction bar, the call can be executed without problems.
Any ideas?

Thank you!

Try to make the call from the Extension, not the agent

MMM ok, can you show how it would be? An example?
Thank you for your response!
Regards

Z

Nope, just following logic, never coded on WDE that but how all deployments I did work

Guess you have to capture the place and get the DNs from it…

Here is the problem, when I do agent.EnterpriseAgent, this Enterprise agent doesn´t have any devices. I don´t know whit is this happening

Shouldn’t, place is the one with devices

The thing is, that from the place i cannot obtaing the dn. I got the device like this :

CustomModule.ObtainCurrentAgent().Place.DeviceService.GetDevices(“305”, “Resources”).ElementAt(0)

But from here, I wasn´t able to get dn… :-\

Use commands instead?


                    string xfr = "12345";
                    IDictionary<string, object> parameters = new Dictionary<string, object>();
                    parameters.Add("CommandParameter", @case.MainInteraction);
                    parameters.Add("Destination", xfr);
                    commandManager.GetChainOfCommandByName("InteractionVoiceSingleStepTransfer").Execute(parameters);

Sorry… I re-read and realized you need to MAKE a call, not transfer a call. I didn’t see a command in docs to flat out make a call :frowning:

Hi,
How it mented Abudwil you can use the WDE command interface instead of using the T-Server protocols. Here is a little thought about how you should change the Abudwill code:


                    string xfr = "202";
                    Agents.IMediaVoice myIMediaVoice=youEnterpriseAgentObject.FirstMediaVoice;
                    IDictionary<string, object> parameters = new Dictionary<string, object>();
                    parameters.Add("CommandParameter", myIMediaVoice);
                    parameters.Add("Destination", xfr);
                    parameters.Add("MakeCallType", MakeCallType.Regular);
                    commandManager.GetChainOfCommandByName("MakeCall").Execute(parameters);

Look at complete describe of custom commands here
http://docs.genesys.com/Documentation/IW/latest/Developer/PlaceandMedia#cite_note-IMediaVoice-14
hope it help,
Tim

Thank you both guys, I willgive it a try, and tell you how it was.
Ur very kind!

Z :slight_smile:

Agents.IMediaVoice myIMediaVoice=youEnterpriseAgentObject.FirstMediaVoice;

The thing is that FirstMediaVoice returns a IMedia type and I need IMediaVoice type…

Maybe a simple casting would do…Gonna try that

Thank you all guys for your help. I was able to do ir finally, if someone would like a code sample, just let me know!

Great!!! ;D

Hi, can you please provide me the working code sample. I am struggling on this same issue

Dictionary<string, object> outParameters = new Dictionary<string, object>();
Enterprise.Commons.Collections.KeyValueCollection userData = new Enterprise.Commons.Collections.KeyValueCollection();

outParameters.Add(“CommandParameter”, _agent.FirstMediaVoice);
outParameters.Add(“Destination”, outprefix + phoneNumber);
outParameters.Add(“MakeCallType”, MakeCallType.Regular);
outParameters.Add(“UserData”, userData);
IChainOfCommand mediaVoiceMakeCall = _commandManager.CreateChainOfCommandByName(“MediaVoiceMakeCall”);
mediaVoiceMakeCall.Execute(outParameters);

it works.