Wiki

« Back to SimpleJtapiPhoneM...

SimpleJtapiPhoneMonitor-Csharp

About#

This application monitors a phone using a Jtapi connection and displays a message in the console for all Jtapi events.

Create the Application project#

1. Open a command shell

2. The cuae requires at a minimum the name of the application project, the implementation language and the module name in the java to get started. If the language and or the module name are omitted the tool will prompt the you for them. Lets use the cuae tool to create a new application.

cuae create SimpleJtapiPhoneMonitor

3. First the tool will ask you if you are building an application or a plugin. Answer application:

Project Type? [application or plugin] application

4. Next the tool will ask you to specify the programming language. Answer csharp:

Programming language? [java or csharp] csharp

5. Next the tool will ask you for the namespace for the application. You can provide a name or accept the default. Let's accept the default for this sample application SimpleIpPhoneMenuTree:

Project namespace? [default: simplejtapiphonemonitor ] <Return>

6. Finally the tool will ask if you would like to specify a triggering event. All CUAE applications will need to register against at least one triggering event. You can specify the triggering event now or wait and specify the triggering event later. You can also change the triggering event during development. Again since we know that this application needs to be triggered on an Http request, lets go ahead and specify the triggering event now. Select cisco.uc.cuae.JTapi.JTapiCallInitiated (option 3):

Available application triggering event:
0: Skip this step 1: cisco.uc.cuae.legacy.ApplicationControl.StaticConstruction 2: cisco.uc.cuae.legacy.JTapi.JTapiIncomingCall 3: cisco.uc.cuae.legacy.JTapi.JTapiCallInitiated 4: cisco.uc.cuae.legacy.JTapi.JTapiCallEstablished 5: cisco.uc.cuae.legacy.CallControl.IncomingCall 6: cisco.uc.cuae.legacy.Http.GotRequest 7: cisco.uc.cuae.legacy.Presence.SubscriptionTerminated 8: cisco.uc.cuae.legacy.Presence.Notify 9: cisco.uc.cuae.legacy.TimerFacility.TimerFire Triggering event? [0-9] 3}}}

The tool now has enough information to generate the project template.

Generating:

  • application named "SimpleJtapiPhoneMonitor"
  • with namespace "simplejtapiphonemonitor"
  • with laguage "csharp"
  • with trigger event "cisco.uc.cuae.legacy.JTapi.JTapiCallInitiated"
  • in location C:\workspace\

Created project "SimpleJtapiPhoneMonitor" in directory "C:\workspace\SimpleJtapiPhoneMonitor\"}}}

Mixin services#

The first step in building an Etch-based CUAE application is identifying which services the application requires and updating the .etch file to mixin those services into the application. For this application we will want to service an JTapi events. The default etch file already has a mixin for Jtapias we selected it as the triggering event:

  mixin cisco.uc.cuae.legacy.JTapi

Generate Sources - MSBuild#

To generate the source file templates for this application, enter the following command from the application directory

SimpleJtapiPhoneMonitor> msbuild

Making a connection to the listener#

Two items need to be done inside main() function to enable the client application register to the CUAE server. First, call server.registerApplication() to do the actual registration.

Write the following code after the line " TODO: Insert Your Code Here"

string key = server.registerApplication( "SimpleJtapiPhoneMonitor", "Default", "<username>", "<password>" );
Console.WriteLine( " CUAE application registered with key : " + key ); Console.WriteLine( "Hit any key to exit" ); Console.ReadLine();}}}

Code Sample#

public static void Main(String[] args)
{ TODO: Change to correct URIstring uri = "tcp://localhost:4001"; RemoteSimpleJtapiPhoneMonitorServer server = SimpleJtapiPhoneMonitorHelper.NewServer( uri, null, new MainSimpleJtapiPhoneMonitorClient());

Connect to the serviceserver._StartAndWaitUp( 4000 );

TODO: Insert Your Code Here

Disconnect from the serviceserver._StopAndWaitDown( 4000 ); } }}}

Then, modify the String URI to match the IP address and port of the Cisco Unified Application Server

URI settings vary slightly between 2.5(1) Beta 1 and more recent versions of 2.5(1), as follows:

2.5(1) and 2.5(1) Beta 2, Beta 3, Beta 4 & later releases#

// TODO Change to correct URI
String uri = "tls://appserver_ipaddress:9000?TlsConnection.authReqd=false&filter=KeepAlive &KeepAlive.Count=5&Packetizer.maxPktSize=102400&TcpTransport.reconnectDelay=4000";}}}

Note: In Beta 2, the Etch Bridge was updated to use Transport Layer Securityfor encryption by default. For your applications to work, you must specify TLS as the protocol in the URI and set the authReqd parameter to false. In the example above, the KeepAlive filter and Max Packet Size and Reconnect Delay parameters have also been set.

2.5(1) Beta 1#

// TODO Change to correct URI
String uri = "tcp://appserver_ipaddress:9000?&TcpConnection.reconnect_delay=4000";}}}

Note: In addition to setting the correct IP address and port for the Cisco Unfied Application Server, the Reconnect Delay parameter should be set on all connection URIs.

Servicing incoming triggering event#

We need to call a number of specific function to service incoming JTapi events.

Code Sample#

	// TODO: Implement delegates or provide implementation of server	

public override void jTapiCallInitiated(string sessionId, JTapiCallInitiatedOptions options) { server.logWrite(LogLevel.INFO, "Call Initiated\n\n SimpleJtapiPhoneMonitor Received OnJTapiCallInitiated Event \n\n"); }

public override void jTapiCallActive(string sessionId, JTapiCallActiveOptions options) { server.logWrite(LogLevel.INFO, "Call Active\n\n SimpleJtapiPhoneMonitor Received OnJTapiCallActive Event \n" + " Call made to: " + options.to + " \n\n"); }

public override void jTapiCallInactive(string sessionId, JTapiCallInactiveOptions options) { server.logWrite(LogLevel.INFO, "Call Inactive\n\n SimpleJtapiPhoneMonitor Received OnJTapiCallInactive Event \n\n"); } public override void jTapiHangupCall(string sessionId, JTapiHangupCallOptions options) { server.logWrite(LogLevel.INFO, "Call Hangup\n\n SimpleJtapiPhoneMonitor Received OnJTapiHangup Event \n\n"); } public override void jTapiGotDigits(string sessionId, JTapiGotDigitsOptions options) { server.logWrite(LogLevel.INFO, "Call GotDigits\n\n SimpleJtapiPhoneMonitor Received OnJTapiGotDigits Event \n" + " Digit(s): " + options.digits + " From Device: " + options.deviceName + " \n\n"); }

public override void jTapiIncomingCall(string sessionId, JTapiIncomingCallOptions options) { server.logWrite(LogLevel.INFO, "Incoming call\n\n SimpleJtapiPhoneMonitor Received OnJTapiIncomingCall Event from " + "phone: " + options.from + " \n\n");

server.makeCall(sessionId, "100299", "", "", null);

}

public override void onMakeCallComplete(string sessionId, cisco.uc.cuae.legacy.types.CallControl.MakeCallResult results, object state) {

}

public override void jTapiCallEstablished(string sessionId, JTapiCallEstablishedOptions options) { server.logWrite(LogLevel.INFO, "Call Established\n\n SimpleJtapiPhoneMonitor Received CallEstablished event \n\n"); } }}}

Packaging The Test Application#

  1. Execute a successful build request for you test applcation within your IDE.
  2. To package the application, run execute the "cuae package" command from a DOS command shell in test application parent directory of the test application.

C:\workspace\SimpleJtapiPhoneMonitor>cuae package
Created package file "C:\workspace\SimpleJtapiPhoneMonitor\bin\SimpleJtapiPhoneMonitor.mca"}}}

Installing The Test Application#

  • To install the test application on a CUAE server, execute the cuae install command from a DOS command shell in test application parent directory of the test application. The cuae install command varies slightly between 2.5(1) Beta 1 and Beta 2.

2.5(1) Beta 2#

You are prompted to enter an IP address, username, and password (to view the help, run the cuae install -h command). When prompted, enter Y or N to save management settings. This will save the answers to the above three questions in the properties file and remember them the next time you go to install.

Note: You are also prompted for the communications protocol (TCP or TLS). Select the protocol that is set on the Management Service. TLS is the default supported protocol. If you want to use TCP, follow the instructions in Management Service Transport Layer Security (TLS) to change the default URI of the Management Service before running these commands.

C:\workspace\SimpleJtapiPhoneMonitor>cuae package
Created package file "C:\workspace\SimpleJtapiPhoneMonitor\bin\SimpleJtapiPhoneMonitor.mca"

C:\workspace\SimpleJtapiPhoneMonitor>cuae install Enter the hostname or IP address of the management service (for example: localhost, 1.1.1.1): localhost Protocol: tls Generated mgmt-service uri: tls://localhost:9001?TlsConnection.authReqd=false Enter management service login username: Entermanagement service login password: Save the amanagement settings with the project? [yes or no] n Application : C:\workspace\SimpleJtapiPhoneMonitor\bin\SimpleJtapiPhoneMonitor.mca Uploading : ===========================> 100% Application has been installed successfully}}}

2.5(1) Beta 1#

You are prompted to enter an IP address, username, and password (to view the help, run the cuae install -h command). When prompted, enter Y or N to save management settings. This will save the answers to the above three questions in the properties file and remember them the next time you go to install.

C:\workspace\SimpleJtapiPhoneMonitor>cuae package
Created package file "C:\workspace\SimpleJtapiPhoneMonitor\bin\SimpleJtapiPhoneMonitor.mca"

C:\workspace\SimpleJtapiPhoneMonitor>cuae install Enter management service uri or host/IP <for example: localhost, tcp://1.1.1.1.:4001>: Enter management service login username: Entermanagement service login password: Save the amanagement settings with the project? [YyNn] n Application : C:\workspace\SimpleJtapiPhoneMonitor\bin\SimpleJtapiPhoneMonitor.mca Uploading : ===========================> 100% Application ahas been installed successfully}}}

Executing the application#

Once the client application is installed on the server, and the service is pointing to the CUAE server, the client application can be invoked. Once the client application is invoked (through console or from within your IDE), it is ready to service the incoming triggers from the CUAE server. Since this is a jtapi monitoring application, the test phone needs to be added to monitord device pool under the telephony Manager section of cuaeadmin console page. App Server logs will show the details of various jtapi events being generated with the monitored phone.

0 Attachments
436 Views
Average (0 Votes)
The average rating is 0.0 stars out of 5.
Comments
No comments yet. Be the first.