2.Salesforce Softhphone 연동개요

Edit

2.1개요

이 문서는 넥서스 소프트폰(NXSoftphone)을 Salesforce 와 연동을 위해 작성되었습니다.

2.1.1사용하기 전에

이 문서에 사용된 제품의 그림과 화면 이미지는 실제와 다를 수 있습니다.

2.1.2소프트폰

소프트폰은 WebRTC 를 사용하여 멀티미디어 통신을 지원하는 애플리케이션으로 이 프로그램을 통해 IP전화기에서 사용할 수 있는 대부분의 기능을 사용할 수 있습니다.

2.1.3임베디드 형태

Salesforce 에 소프트폰이 임베디드(Embedded) 된 형태입니다. 아래 이미지를 참고해 주세요.

2.2연동 방법

2.2.1제약사항

Lightning Experience 모드에서 만 사용 가능.

추후 Lightning Classic 에서도 호환되게 개발 예정입니다.

2.2.2연동 방식

연동방식은 Lightning App 하단의 탭을 이용해서 Softphone 을 실행 할수 있습니다.
Softphone 은 Open CTI 와 Softphone URL 를 이용해서 화면을 표시 합니다.
자세한 사항은 아래 메뉴를 확인해 주시면 됩니다.

2.2.2.1Call Centers

Open CTI 와 연동을 위해서는 먼저 Call Centers 를 세팅해 주어야 합니다. 
Setup > Call Centers 에  CTI Adapter URL 와 User CTI API  을 설정해 주시면 됩니다. 
자세한 사항은 아래 상세 항목을 확인해 주시면 됩니다.

CTI Adpter URL 를 실제 사용할 Jedai 서버의 softphone URL 을 설정해 줘야합니다.

그림 2-1스크린샷 2021-07-06 오후 1.26.25

2.2.2.2Lightning App

Lightning App 을 생성해 줍니다.
생성후에 Utitlity Items 메뉴를 이용해서 Lightning App 하단의 탭에 메뉴를 추가할수 있습니다.

기본적으로 생성되어 있는 Lightning App 에 추가하는 것은 추후 검토가 필요합니다.

2.2.2.2.1Utitlity Items

Utitlity Items 메뉴를 이용해서 Open CTI Softphone 을 추가해 주시면 됩니다.

그림 2-2스크린샷 2021-07-06 오전 11.46.16

2.2.3세일즈포스 연동 소프트폰 확인

2.2.3.1Lightning App 선택 화면

2.2.3.1.1아래는 임시로 만든 demo nxsoftphone 를 선택하면 됩니다.

그림 2-3관리

2.2.3.2nxsoftphone 생성 확인

2.2.3.2.1하단에 nxsoftphone 항목이 있는지 확인후 실행은 nxsoftphone클릭하면 됩니다.

그림 2-4관리

2.3연동 기능

2.3.1Click To Call

2.3.1.1전화기 상태 활성화 기능

그림 2-5비공개 앱 업로드

2.3.1.2전화기 활성화 상태에서 클릭시 소프트폰에서 발신

전화기 버튼을 클릭시 소프트폰이 활성화 되고, 클릭한 전화번호로 발신을 시도 합니다.

그림 2-6비공개 앱 업로드

2.3.2수신/발신 연동 기능

2.3.2.1팝업 기능

2.3.3수신/발신 커스컴 Object 생성(NxSoftphone)

수신 및 발신시 통화 관련 로그 및 녹취 를 위한 Object 를 생성이 필요합니다.

2.3.3.1Custome Object

2.3.3.1.1SETUP > OBJECT MANAGER 에서 OBJECT 를 신규 생성합니다.

  1. Label : NxSoftphone

  2. Object Name : NxSoftphone

  3. Record Name : Name

  4. Date Type : Auto Number

  5. Display Format : {YYYY}{MM}{DD}-{000000}

  6. Starting Number : 1

  7. Deployment Status : Deployed

  8. Search Status : Allow Search (check)

그림 2-7스크린샷 2021-10-08 오전 10.59.38

2.3.3.1.2Fileds 를 추가 합니다.

  1. SETUP > OBJECT MANAGER 리스트에서 NxSoftphone 클릭 하세요.

  2. Fileds & Relationships > New 로 필드 추가해 주세요.

  3. 상세 항목은 아래 표를 참조해서 생성해 주세요

Field Label

Field Name

Type

Call Id

Call_Id

Text(100)

Comment

Comment

Text Area(255)

Date

Date

Date/Time

Duration

Duration

Number(18, 0)

From

From

Phone

Inbound

Inbound

Checkbox

Lead

Lead

Lookup(Lead)

Opportunity

Opportunity

Lookup(Opportunity)

Recording URL

Recording_URL

URL(255)

To

To

Phone

그림 2-8스크린샷 2021-09-28 오전 11.10.20

2.3.3.2APEX Class 연동

2.3.3.2.1SETUP > Apex Classes 에서 생성

public class NxSoftphone {

  //  public String createSoftphone(String callFrom,  String callTo, String callId, Boolean isInbound){
   //     return createSoftphone(callFrom,  callTo, callId, isInbound, null, null);
   // }
    


    public String createSoftphone(String callFrom,  String callTo, String callId, Boolean isInbound, String objectType, String objectId ){

        if(callId == null || callId.length() == 0){
            return null;
        }

        if(callFrom == null || callFrom.length() == 0){
            return null;
        }
        
        if(callTo == null || callTo.length() == 0){
            return null;
        }
        
        DateTime dt = Datetime.now();
        NxSoftphone__c softphone = new NxSoftphone__c();
        softphone.nxsoftphone__Call_Id__c = callId;
        softphone.nxsoftphone__from__c = callFrom;
        softphone.nxsoftphone__to__c = callTo;
        softphone.nxsoftphone__inbound__c = isInbound;
        softphone.nxsoftphone__Date__c = dt;
        
        if(objectType != null && objectType.equals('Lead') ) softphone.nxsoftphone__Lead__c = objectId;
        if(objectType != null && objectType.equals('Opportunity')) softphone.nxsoftphone__Opportunity__c = objectId;
              
        insert softphone;
        
        System.debug('insert  softphone.');
        System.debug('softphone id:' + softphone.id);
        
        return softphone.id;
    }
    
    public Integer updateSoftphone(String callId, Integer duration, String recordingUrl ){
        Integer returnValue = -1;
        
        if(callId == null || callId.length() == 0){
            return returnValue;
        }

        
        List<NxSoftphone__c> lstSoftphone = [Select id, nxsoftphone__Recording_URL__c,nxsoftphone__Duration__c  from nxsoftphone__NxSoftphone__c where nxsoftphone__Call_Id__c =  :callId];
        try {
            for (NxSoftphone__c ld: lstSoftphone) {
                ld.nxsoftphone__Duration__c = duration;
                if(recordingUrl != null  && recordingUrl.length() > 0){
                    ld.nxsoftphone__Recording_URL__c =  EncodingUtil.urlDecode(recordingUrl,'UTF-8');
                }
                
                update ld;
                returnValue++;
            }
        }catch(DmlException e) {
        //    returnValue = false;
            System.debug('An unexpected error has occurred: ' + e.getMessage());
        }
        
        return returnValue;
    }
    
    public static void totalCount(NxSoftphone__c[] softhphones) {
       System.debug('totalCount  softphone.');
    }

    
    
}

CTI <->APEX 연동

https://developer.salesforce.com/docs/atlas.en-us.api_cti.meta/api_cti/sforce_api_cti_runapex_lex.htm

2.3.4녹취기능

  1. 수신/발신 종료후 NxSoftphone 오브잭트에 Recording URL 을 통해서 가능합니다.

  2. 아래 첨부 이미지의 Recording URL 를 클릭합니다.

  3. 아이디/비밀번호를 입력합니다.

  4. 리스트에서 play 버튼을 클릭합니다.

그림 2-9스크린샷 2021-10-08 오전 11.23.08

그림 2-10스크린샷 2021-10-08 오전 11.27.48

2.4유용한 정보

소프트폰은 기본적으로 넥서스 Jedai (Sip server) 에 포함될 예정입니다. 소프트폰 URL 은 제대이 소프트폰 URL 을 사용하면 됩니다.