Genesys CTI User Forum

Genesys CTI User Forum => Genesys CTI Technical Discussion => Topic started by: gzooby on May 28, 2015, 05:08:07 PM

Title: Cannot make call programatically in WDE
Post by: gzooby on May 28, 2015, 05:08:07 PM
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:

[b]voiceService.MakeCall(agent.EnterpriseAgent, channelService.GetChannel("TServerNEAX"), "202@SwitchNEAX", Genesyslab.Enterprise.Model.Interaction.MakeCallType.Regular, "", kvp, kvp, kvp, 20000);
[/b]
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!
Title: Re: Cannot make call programatically in WDE
Post by: cavagnaro on May 28, 2015, 05:55:12 PM
Try to make the call from the Extension, not the agent
Title: Re: Cannot make call programatically in WDE
Post by: gzooby on May 28, 2015, 06:00:11 PM
MMM ok, can you show how it would be? An example?
Thank you for your response!
Regards

Z
Title: Re: Cannot make call programatically in WDE
Post by: cavagnaro on May 28, 2015, 06:03:50 PM
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...
Title: Re: Cannot make call programatically in WDE
Post by: gzooby on May 28, 2015, 06:15:15 PM
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
Title: Re: Cannot make call programatically in WDE
Post by: cavagnaro on May 28, 2015, 06:46:02 PM
Shouldn't, place is the one with devices
Title: Re: Cannot make call programatically in WDE
Post by: gzooby on May 28, 2015, 08:53:38 PM
The thing is, that from the place i cannot obtaing the dn. I got the device like this :
[b]
CustomModule.ObtainCurrentAgent().Place.DeviceService.GetDevices("305", "Resources").ElementAt(0)[/b]


But from here, I wasnīt able to get dn... :-\
Title: Re: Cannot make call programatically in WDE
Post by: abudwill on May 28, 2015, 11:20:24 PM
Use commands instead?

[code]
                    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);
[/code]
Title: Re: Cannot make call programatically in WDE
Post by: abudwill on May 28, 2015, 11:43:10 PM
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 :(
Title: Re: Cannot make call programatically in WDE
Post by: Timur Karimov on May 29, 2015, 07:58:25 AM
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:
[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);
[/code]

Look at complete describe of custom commands here
[url=http://docs.genesys.com/Documentation/IW/latest/Developer/PlaceandMedia#cite_note-IMediaVoice-14]http://docs.genesys.com/Documentation/IW/latest/Developer/PlaceandMedia#cite_note-IMediaVoice-14[/url]
hope it help,
Tim
Title: Re: Cannot make call programatically in WDE
Post by: gzooby on May 29, 2015, 05:24:11 PM
Thank you both guys, I willgive it a try, and tell you how it was.
Ur very kind!

Z :)
Title: Re: Cannot make call programatically in WDE
Post by: gzooby on May 29, 2015, 07:28:39 PM
  Agents.IMediaVoice myIMediaVoice=youEnterpriseAgentObject.FirstMediaVoice;

The thing is that FirstMediaVoice returns a IMedia type and I need IMediaVoice type...
Title: Re: Cannot make call programatically in WDE
Post by: gzooby on May 29, 2015, 07:34:02 PM
Maybe a simple casting would do...Gonna try that
Title: Re: Cannot make call programatically in WDE
Post by: gzooby on May 29, 2015, 08:42:29 PM
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
Title: Re: Cannot make call programatically in WDE
Post by: aravind_mano on November 04, 2016, 05:21:32 AM
Hi, can you please provide me the working code sample. I am struggling on this same issue
Title: Re: Cannot make call programatically in WDE
Post by: gaeg0 on February 08, 2018, 09:40:01 AM
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.