Siebel Communications Server Administration Guide > Configuring Advanced Communications Features > Integrating with Siebel Scripting Languages >

Integrating Using Server Scripts


Here are some examples of using business services and Siebel scripting with your communications configurations, such as for Siebel CTI Connect. These examples are for server-side scripting using Siebel eScript.

Event Response Example

Table 56 shows an example event response that invokes the server-layer scripting business service method CTI_Test.EvtBSGotoView. This event response retrieves work item data and generates a screen pop to the view Contact List View, with all contacts whose last name starts with the letter S.

Table 56. Event Response: OnInboundCallReceived
Parameter Name
Parameter Value

ServiceMethod

CTI_Test.EvtBSGotoView

ServiceParam.myWorkItemID

{SiebelWorkItemID}

ServiceParam.ANI

{ANI}

Command Example

Table 57 and Table 58 show an example communications command and associated command data that invokes the server-layer scripting business service method CTI_Test.CmdBSGotoView. This command makes an outbound phone call to the number the user specified in the communications toolbar's text input field.

Table 57. Command: MakeCallToPhone
Parameter Name
Parameter Value

ServiceMethod

CTI_Test.CmdBSGotoView

CmdData

MakeCallToPhone

OnEditControl

TRUE

Table 58. Command Data: MakeCallToPhone
Parameter Name
Parameter Value

ServiceParam.PhoneNumber

{@Phone:PhoneTypeLookup}

RequiredField.@Phone

?*

Param.CallNotifyText

Call from {@UserName}...

Server Script Examples

Define the following server scripts in the CTI_Test business service. These scripts are invoked by the event response and command described in Event Response Example and Command Example:

function Service_PreCanInvokeMethod (MethodName, &CanInvoke)
{
   var ReturnVal = ContinueOperation;
   switch (MethodName)
   {
      case "EvtBSGotoView":
      case "CmdBSGotoView":
      CanInvoke = "True";
      ReturnVal = CancelOperation;
   }
   return (ReturnVal);
}

function Service_PreInvokeMethod (MethodName, Inputs, Outputs)
{
   var ReturnVal = ContinueOperation;
   switch (MethodName)
   {
      case "EvtBSGotoView":
         EvtBSGotoView(Inputs, Outputs);
         ReturnVal = CancelOperation;
         break;

      case "CmdBSGotoView":
          CmdBSGotoView(Inputs, Outputs);
          ReturnVal = CancelOperation;
          break;
   }
   return (ReturnVal);
}

function EvtBSGotoView(Inputs, Outputs)
{
   // Getting input arguments from Event Response parameters
   var itemID = Inputs.GetProperty("myWorkItemID");
   var ANI = Inputs.GetProperty("ANI");

   // Invoking Business Service "Communications Session Manager" method
   var ctibs = TheApplication().GetService("Communications Session Manager");
   var ip = TheApplication().NewPropertySet();
   var op = TheApplication().NewPropertySet();
   ip.SetProperty("WorkItemID", itemID);
   ctibs.InvokeMethod("GetWorkItemInfo", ip, op);

   // Generate a screen pop to "Contact List View" with
   // all the contacts whose last name start with letter "S"
   var boGlobal = TheApplication().GetBusObject("Contact");
   var bcContact = boGlobal.GetBusComp("Contact");
   bcContact.SetViewMode(AllView);
   bcContact.ClearToQuery();
   bcContact.SetSearchSpec("Last Name", "S*");
   bcContact.ExecuteQuery(ForwardBackward);
   TheApplication().GotoView("Contact List View", boGlobal);
}

function CmdBSGotoView(Inputs, Outputs)
{
   // Getting input arguments from Command Data parameters
   var number = Inputs.GetProperty("PhoneNumber");

   // Invoking Business Service "Communications Client" method
   var ctibs = TheApplication().GetService("Communications Client");
   var ip = TheApplication().NewPropertySet();
   var op = TheApplication().NewPropertySet();
   ip.SetProperty("PhoneNumber", number);
   ip.SetProperty("ProfileName", "Siebel CTI Connect for San Mateo");
   ctibs.InvokeMethod("MakeCall", ip, op);
}

Siebel Communications Server Administration Guide