Follow

CSENSE - Coresuite Enterprise Search Skype Plugin

Important Notes

The samples and information below is provided without a warranty of any kind. This post is for informational purposes and coresystems ag assumes no responsibility for errors or omissions in the information provided.

Purpose

The Skype plugin allows to integrate the Skype functionality with the coresuite enterprise search.  The functionality provided are:

1.- INCOMING CALLS:  

a) Skype online number incoming Calls (SkypeIn™) / Incoming calls from public telephone network.
Whenever an incoming call to your personal Skype Online Number (SkypeIn™) is detected, this rule searches for a BP Contact registered in the system with the incoming phone number.  Once the BP Contact is detected the enterprise search searches for all the documents related to this BP Contact.
If no BP Contact is detected, the rule searches for a BP registered in the system with the incoming phone number.  Once the BP is detected the enterprise search searches for all the documents related to this Business Partner.

b) Skype Peer-to-Peer calls.
If the incoming call is coming from a Skype contact rather than a PSTN number, the Enterprise Search searches all the document related to such Skype Contact Name.

2.- OUTGOING CALLS:

a) Business Partner Contacts.
Via right click on a certain Business Partner Contact it is possible to start a Skype Call with this Business Partner Contact.  It is possible to call the Business Partner Contact using either his "Telephone 1" or "Mobile Phone" number.

b) Business Partner.
Via right click on a certain Business Partner it is possible to start a Skype Call with this Business Partner.  It is possible to call the Business Partner using his "Tel 1" number.

In the attach .zip file is included a .pdf file with more detail installation instructions.

 

Requirements

The sample requires coresuite Version 2.81 or higher, and SAP Business One 8.8 or higher.


Procedure to use this small solution

1. Download the attached FAQ_10177_Skype_P... file

2. Unpack the .zip files, this file contains two files: 01_Skype_Plugin.sip and 02_Skype_Plugin.cocu

3. Install the .sip file via the coresuite administration menu.

4. Import the .cocu file in SAP Business One via > Administration > Add-Ons > coresuite customize > Import / Export > Import rules. In the message box, select “All Active”. Click on “Import”.

3. Restart the coresuite Add-On.

 

Preview Sample (Optimizer Rule C#):

/*
***** General Information *****
Creator: coresystems ag, map
Create Date: 2010-07-22
***** StartConfDesc *****
This function has been delivered by coresystems ag as a sample. This sample has been tested with a SAP Business One demo database and is delivered without further warranties.

***** Description: *****

1 -- INCOMING CALLS
1.A -- Skype online number incoming Calls (SkypeIn™) / Incoming calls from public telephone network
Whenever an incoming call to your personal Skype Online Number (SkypeIn™) is detected, this rule searches for a BP Contact registered in the system with the incoming
phone number.
Once the BP Contact is detected the enterprise search searches for all the documents related to this BP Contact.

If no BP Contact is detected, the rule searches for a BP registered in the system with the incoming phone number.
Once the BP is detected the enterprise search searches for all the documents related to this Business Partner.

1.B -- Skype Peer-to-Peer calls
If the incoming call is coming from a Skype contact rather than a PSTN number, the Enterprise Search searches all the document related to such Skype Contact Name.

2 -- OUTGOING CALLS

2.A -- Business Partner Contacts
Via right click on a certain Business Partner Contact it is possible to start a Skype Call with this Business Partner Contact.
It is possible to call the Business Partner Contact using either his "Telephone 1" or "Mobile Phone" number.

2.B -- Business Partner
Via right click on a certain Business Partner it is possible to start a Skype Call with this Business Partner.
It is possible to call the Business Partner using his "Tel 1" number.

***** Requirements: *****
This rule requires the Skype DLL compiled with .NET Framework 2.0.
Before enabling the rule please make sure that the Skype .dll is loaded into your system.
A ready to use .sip file containing the required dll is available for download from the following web-page: http://bit.ly/btcH3z

Please import the .sip file from Administration -> Add-Ons -> coresuite administration -> Administration.
After importing the .dll restart the coresuite Add-On and enable this rule.
***** Updates *****

*/
try {
//COR_EnterpriseSearch.RemoteAPI.StartSearch("paolo");
SwissAddonFramework.Messaging.StatusBar.WriteSucess("Skype plug-in is loading");
SKYPE4COMLib.Skype oSkype = new SKYPE4COMLib.Skype();
// Event Handling for incoming call
SKYPE4COMLib._ISkypeEvents_CallStatusEventHandler del = delegate(SKYPE4COMLib.Call oCall, SKYPE4COMLib.TCallStatus oCallStatus)
{
// Peer2Peer incoming call -> Search for the name
if (oCallStatus == SKYPE4COMLib.TCallStatus.clsRinging && oCall.Type == SKYPE4COMLib.TCallType.cltIncomingP2P)
{
// Get the name from my "Contacts" list (if an unknow user is calling search should not be performed)
string partnerDisplayName = oCall.PartnerDisplayName;
// call the Enterprise Search with partner display name
SwissAddonFramework.Messaging.StatusBar.WriteSucess("Incoming call from " + partnerDisplayName);

COR_EnterpriseSearch.RemoteAPI.StartSearch(partnerDisplayName);
return;
}
// PSTN incoming call -> Search for the phone nr.
if (oCallStatus == SKYPE4COMLib.TCallStatus.clsRinging && oCall.Type == SKYPE4COMLib.TCallType.cltIncomingPSTN)
{
string partnerNumber = oCall.PstnNumber;

// search for a BP with the incoming phone nr.
System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
string query = @"SELECT TOP 1 CntctCode, CardCode, Name
FROM OCPR
WHERE Name IS NOT NULL AND (
REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(Tel1,'-',''),'.',''),'/',''),'(',''),')',''),' ','') LIKE @P1 OR
REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(Tel2,'-',''),'.',''),'/',''),'(',''),')',''),' ','') LIKE @P1 OR
REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(Cellolar,'-',''),'.',''),'/',''),'(',''),')',''),' ','') LIKE @P1 )";
cmd.CommandText = query;
cmd.Parameters.AddWithValue("@P1", partnerNumber);

bool queryHasResult = false;
string retName="";
using (System.Data.SqlClient.SqlDataReader rdr = customize.B1Connector.GetB1Connector().ExecuteQuery(cmd))
{
if (rdr.Read())
{
queryHasResult = true;
retName = rdr.GetString(2);
}
}

if (!queryHasResult) // if no BP Contact has been found, try searching for the BP itself
{
query = @"SELECT TOP 1 CardCode, CardName
FROM OCRD
WHERE CardName IS NOT NULL AND (
REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(Phone1,'-',''),'.',''),'/',''),'(',''),')',''),' ','') LIKE @P1 OR
REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(Phone2,'-',''),'.',''),'/',''),'(',''),')',''),' ','') LIKE @P1 )";

cmd.CommandText = query;
using (System.Data.SqlClient.SqlDataReader rdr = customize.B1Connector.GetB1Connector().ExecuteQuery(cmd))
{
if (rdr.Read())
{
queryHasResult = true;
retName = rdr.GetString(1);
}
}

}
// call the Enterprise Search with partner number
SwissAddonFramework.Messaging.StatusBar.WriteSucess("Incoming call from " + partnerNumber);
if (queryHasResult)
COR_EnterpriseSearch.RemoteAPI.StartSearch(retName);

return;
}

};
oSkype.CallStatus += del;
oSkype.Attach(5, true);
// Event handling for outgoing call
COR_EnterpriseSearch.RemoteAPI.CallPhoneMenuActivated = true;
COR_EnterpriseSearch.RemoteAPI.CallPhone += delegate(string phoneNr)
{
if (oSkype.ActiveCalls.Count == 0) // if no other calls are in progress...
{
//Clean the number
string trim = "-/\\.()";
phoneNr = phoneNr.Trim(trim.ToCharArray());
phoneNr = phoneNr.Replace(" ", string.Empty);

// call the number
SKYPE4COMLib.Call oCall = oSkype.PlaceCall(phoneNr, null, null, null);

// open Skype™ form
oSkype.Client.Focus();
}
else // error msg
{
SwissAddonFramework.Messaging.StatusBar.WriteError("Another phone call is in progress... please try again later");
}
};
}
catch (Exception ex)
{
SwissAddonFramework.Messaging.Debug.WriteMessage(ex, SwissAddonFramework.Messaging.Debug.DebugLevel.Exception);
}
return true;
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.