« Back to CTIOS Toolkit Questions

RE: New Message from Arun Kumar in Computer Telephony Integration Object Se

Combination View Flat View Tree View
Threads [ Previous | Next ]
I have no development experience on CTIOS desktop.  I have only one type of enhancement that I need to make over a base CTIOS version.  I need to be able to invoke a web URL when CTIOS desktop starts and also invoke a URL by passing account number when a IVR call comes.
How easy is it to do that ?  Can someone list the steps and point out as to what I need to change or provide a sample code.  Thanks.

The source code to the out of the box CTIOS Agent Desktop is available in C:\Program Files\Cisco Systems\CTIOS Client\CTIOS Toolkit\Win32 CIL\Samples\CTI Toolkit AgentDesktop
(You must have selected to install the CTIOS Toolkit when you install the CTIOS Desktop)

The code is written in VB.NET. and uses the CTIOS ActiveX controls. Regarding how you would invoke a web URL that is a VB.NET function: I would refer you to Microsoft on how to invoke a url from a Windows app. You could probably place a browser control on the form but I don’t know for sure. Perhaps other CTIOS Developers have done that and can provide input.

You can obtain the account number (assuming it is in a Callvariable) and populate the url with it by writing a handler for the m_Session_OnCallEstablished event).
You would use the call object that is an argument to the onCallEstablished event to obtain the callvariable.

To Obtain the callvariables from the callobject use the GetCallData method of the call object.

There is also a C# sample that uses the .NET Cil if you have a language preference, but it does not match the out of box CTIOS Agent Desktop. Theres also a Java version but it is very crude and would take a lot of work to match the out of box CTIOS Agent Desktop.

Note that all the sample code is provided as is and its up to you to thoroughly test your application in your environment

For more information on the call object, see CTIOS Developer Guide here
http://www.cisco.com/en/US/partner/docs/voice_ip_comm/cust_contact/contact_center/ctios/ctios9_0/developer/guide/UCCE_BK_C3995718_00_cti-os-developers-guide-ucce.html

David Lender:
For more information on the call object, see CTIOS Developer Guide here http://www.cisco.com/en/US/partner/docs/voice_ip_comm/cust_contact/contact_center/ctios/ctios9_0/developer/guide/UCCE_BK_C3995718_00_cti-os-developers-guide-ucce.html
David's advice is spot on as usual. To pass information from the IVR you want to use CallVariables as he described. As for launching a web page it depends on how tricky you want to get and what user interface you want to provide. You can do as I have done and create an entire web browser in the app with a WebBrowser control but it is much more complicated than that because you need to create all the forward/back/refresh/stop/home/etc controls, handle sub windows and all the other things web browsers do. Or you can simply launch IE or your browser of choice passing the account number on the command line. The latter is simple to accomplish by using Process.Start( url, params) method in .NET. [url=http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start(v=vs.80).aspx]http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start(v=vs.80).aspx for example Process.Start( "www.cisco.com" ); will launch the Cisco web site. The other options are listed in the link provided. The way I wrote the last example will start whatever browser is defualt so it could use IE or FireFox or Chrome whatever the user has specified. To use IE specifically you could use Process.Start( "iexplore.exe",  " www.cisco.com " ). Passing the url could be something like Process.Start( "www.myapp.com?accountnum= "+ accountNumber ); but you may have to play with it a little if that doesn't parse correctly. Like I said it depends on how sophisticated you want to get  

Thank you Shannon and David.  One thing can you clarify.  I really do not need to create a web browser in the app. The need here is simple
1) web browser with a certian URL is launched when the CTIOS softphone is launched
Where do I put this code Process.start (".http://......");
I mean which file and method do I call it in?
 
2) web broswer to be launched with call variables when call comes in.  Which file and method do I call the 
Process.start("....") in  ?
Can you give me the filename and method in each of the above 2 cases ?

In the file softphoneform.cs on line 2351 ( at least on mine ) look for ProcessOnCallEstablished()
Something like this should do the trick. I have not tested it but this is how it is supposed to be done. You should be able to figure out the rest yourself.
<pre style="background: white; color: black; font-family: Consolas;"> private void ProcessOnCallEstablished(Arguments args)
    {
    string uid;
    args.GetValueString( Enum_CtiOs.CTIOS_UNIQUEOBJECTID, out uid );
            
            CtiOsObject call;
            m_ctiObject.Session.GetObjectFromObjectID(uid, out call );

    string accountNumber;
    call.GetValueString( Enum_CtiOs.CTIOS_CALLVARIABLE1, out accountNumber );

    System.Diagnostics.Process.Start( @"http://www.whatever.com?accountnumber=" + accountNumber );

CtiOsDataGrid.CtiOsDataGrid.UpdateGrid(m_callGrid, args);
}
</pre>

Great post, Shannon.

To the original poster, make sure you surround these method calls with checks on the retrieved objects not being null – you can look at the code for the Blended Agent softphone to see how Cisco suggest you should do this.

Regards,
Geoff

Thanks Geoff, I assumed null checking was implied as I ommitted them for brevity and clarity but it is always a good point to make a note of that. Good catch.
 

OP I forgot to mention that for case number one you mentioned it depends on what you mean by when the app starts. You can put it in softphoneform.cs in the Form Load Event handler on line 1355 ( on mine ) and just add something like like this
<pre style="background: white; color: black; font-family: Consolas;">private void SoftphoneForm_Load( object sender, System.EventArgs e )
    {
   System.Diagnostics.Process.Start( @"www.whatever.com" ); 
...
// existing Cisco code
  ...
    }

This will launch when the window loads or you can put it in some other place like after the user logs in. That is up to you. </pre>

Thank you so much Shannon.  I appreciate your feedback.  Now the code you have referred to is the C sharp code right ? I see C sharp code in my folder: under  CTI Toolkit Combo Desktop.NET
I did not see the VB code. 

Yes the code is C# just ignore the
<pre> tag stuff that is from cutting and pasting in the reply its not part of the code. I assume you have or are reading the CTIOS Developer's guide because you mention VB and unforturnately the guide does not use C# but instead uses VB, Java, and COM. I program in Java as well and C# is so close to Java that you can use the Java doc for almost all of the things you need. You just need to convert certain things like in your head (e.g. import = using). Unfortunately you have chosen a big mountain to climb for your introduction to .NET emoticon The CTIOS C# Desktop is a 8 out of 10 in difficulty to understand and also contains quite a few bugs and very little adherence to proper design patterns. I suggest you try Pluralsight to bring yourself up to speed faster. Also safari.informit.com is a very helpful resource they are both pay services but are affordable and invaluable. You should also tell us what version of CTIOS you are using because some of these answers differ a little base on version. Also what version of Visual Studio you are using

 </pre>

I am using the code that came with 8.0(1) version. As I said I do not need anything other than web url coming up.
So when you say C# code is buggy, what kind of issues can I expect.  How about the VB one ? Is that better ?
What files should I change there. 
 
I prefer java, however I see only 3 files under Java Phone. Is that code complete ? Can I use that.  You guidance is very much appreciated.  

Also should I compile .NEt code with Visual studio 2005 0r 2008 ?

Arun Kumar:
Also should I compile .NEt code with Visual studio 2005 0r 2008 ?
This is an age old question that has been debated many times on this board. You can see mine and Davids posts on it with a search. Basically Cisco has an official supported config with Visual Studio matching the version of .NET with the version of Visual Studio. So I believe 8.0 uses .NET 2.0 so you can use 2005 (official), and perphaps 2008(David?) I personally use any version I want and have had no problems but I am outside the official bounds. Technically .NET 1.1 was the last version of .NET that had any platform specific issues. As of 2.0 every .NET version is fully reverse compatible. So even if you use 2010 or 2012 you should still be able to compile and work properly. I even use later versions of .NET such as 3.5, 4.0 and even 4.5 to get the more advanced features and still successfully use the .NET Cil as it is basically just a wrapper around tcp/ip messages anyway and doesn't tend to have anything that breaks. If you don't have much experience in .NET and don't need to make any major changes to the sample code I would paint within the lines and stay "official". I think 2008 is ok to use for that but David can confirm. He is the authority on such matters.  Also you can check the 8.0 Developers Guide and it should say which is supported.

Thanks again. One last thing.  Can you shed some light on:
 
I am using the code that came with 8.0(1) version. As I said I do not need anything other than web url coming up.
So when you say C# code is buggy, what kind of issues can I expect.  How about the VB one ? Is that better ?
What files should I change there. 
 
I prefer java, however I see only 3 files under Java Phone. Is that code complete ? Can I use that.  You guidance is very much appreciated

Arun Kumar:
Thanks again. One last thing.  Can you shed some light on:
 
I am using the code that came with 8.0(1) version. As I said I do not need anything other than web url coming up.
So when you say C# code is buggy, what kind of issues can I expect.  How about the VB one ? Is that better ?
What files should I change there. 
 
I prefer java, however I see only 3 files under Java Phone. Is that code complete ? Can I use that.  You guidance is very much appreciated

This again is a more complicated question that it might seem to be. The Java code is weak and frankly I just skip it as an option. There are constant rumors that Java support may be dropped altogether but every version is it still there. I don't know how much active development is being done with it internally. The VB sample is complete but it uses the ActiveX( welcome back to 2002 )  controls for 80% of the code so it is very limited in regards to customization but it is very short and is the only .NET version that supports silent monitoring because it is using ActiveX. You can probably accomplish what you want with it though. The C# example is by FAR the most complete example and the most powerful. I have rewritten it multiple times on multiple versions and I use power tools such as Resharper that allow me to find addition coding flaws that don't show with normal Visual Studio. The app runs for the most part very well, and the bugs vary from version to version. An example I found repeatedly is that the list of reason codes for logging of and going not ready does not repopulate properly when changing from one to the other so you can end up in a state where you click on not ready but you have logout reasons or vice versa. Its a little hard so remember all the issues as I simply corrected them when I rewrote it. I have converted the VB sample to C# and did a lot of customization but it is not for the faint of heart. So depending on whom you are developing for and how picky they are the C# code offers the most flexibility and the more modern(2003) interaction. So your choices are C#, total control, VB more stable but almost no control. Hope this helps. Cheers 

The VB one is the code from the out of box CTIOS Agent desktop and since it uses ActiveX controls the code is much simpler.
Considering what you are trying to do, I suggest using the VB.NET sample.

David/Shannon,
        Based onn VB code, can you suggest as to which file/method  i need to change to do the following
1. Invoke a web url when the softphone is launched
2. Invove a web url by passing call variables when a call comes in from IVR.
 
 You guys have been really helpful.

1. You need to add your web url code to the frmCTIOSSoftphone_Load handler

2. You will need to add your web url code to the m_Session_OnCallEstablished event handler. Previous post indicates how to obtain the callvariables associated with the call.

David/Shannon,
        Based onn VB code, can you suggest as to which file/method  i need to change to do the following
1. Invoke a web url when the softphone is launched
2. Invove a web url by passing call variables when a call comes in from IVR.
 
 You guys have been really helpful.

Sorry message posted twice.  Now I was able to create the exe and the browser opens up when I launch. I need to now test when the call comes in.  Thanks for the same.
My desktop exe has the login button grayed out as it is offline and not able to connec to the PG's.  How can I make it a installable version, where the user can select the PG ip or I could change the PG ip in registry settings

To have the CTIOS Desktop connect, set the CtiOsA and CtiOsB registry settings to the IP address or hostname of your CTIOS Server.

For windows 7 the registry settings are in:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Cisco Systems, Inc.\CTI Desktop\CtiOs

For earlier versions of windows remove the Wow6232Node it should be something like

HKEY_LOCAL_MACHINE\SOFTWARE\ Cisco Systems, Inc.\CTI Desktop\CtiOs

Oops had a wrong PG address. Cool, it works now. I was able to get a call and succesfully launch the popup.
Now  any issue with the reason/wrap up code or it should automatically populate as long as I have it set in my PFG right. I am not able to see the not ready codes right now.   I just see 4 lines 'Insert not ready reason code here 1..2..3.4.. etc,
Do you consider this VB version stable for production?  I mean are there any kinks or bugs associated that ones to be concerned about ?
Also I assume the supersvisor desktop can be compiled the same way.  Your help has been great. I have a version up and running with the web pop up. 
Instead of producing 3 or 4 different flavors of exe, I might add code to read from registry key the line of business and set the URL accordingly based on line of BU.
 
 

Good. Reason codes are configured on the CTIOS Server registry. See the CTIOS System Manager’s Guide here. (section on CTIOS Configuration)
http://www.cisco.com/en/US/partner/docs/voice_ip_comm/cust_contact/contact_center/ctios/ctios9_0/installation/guide/UCCE_BK_C3D5EC47_00_cti-os-system-manager-guide.html

Arun/Shannon

VS 2008 is not officially supported. Cisco CTI OS Toolkit 8.5(2) introduces support for application development using Microsoft Visual
Studio .NET 2010 and .NET 3.5 framework

David

David Lender:
Arun/Shannon

VS 2008 is not officially supported. Cisco CTI OS Toolkit 8.5(2) introduces support for application development using Microsoft Visual
Studio .NET 2010 and .NET 3.5 framework

David

Thanks David, I knew I could depend on your guruness emoticon

David Lender (474)
Shannon McCoy (91)
Arthur Shats (57)
Christopher Nagel (47)
GEOFFREY THOMPSON (40)