NotifyScoped - 범위 지정됨

  • 릴리스 버전: Washingtondc
  • 업데이트 날짜 2024년 02월 01일
  • 읽기20분
  • NotifyScoped API를 사용하면 스크립트를 사용하여 알림 통화 및 SMS 메시지와 상호작용할 수 있습니다.

    sn_notify 네임스페이스에서 NotifyScoped 클래스 및 관련 메서드를 실행합니다.

    NotifyScoped - call(문자열 notifyPhoneNumber, 문자열 toPhoneNumber, GlideRecord conferenceCall, GlideRecord conferenceCallRecord, 문자열 userSysId, 문자열 groupSysId, GlideRecord sourceRecord)

    지정된 E.164 호환 전화 번호로 전화를 겁니다.

    표 1. 매개변수
    이름 유형 설명
    알림 전화 번호 문자열 전화를 걸 수 있는 전화번호를 알려줍니다. 호출을 시작하면 이 번호와 연결된 번호 그룹에 대한 발신 콜 워크플로우가 실행됩니다. 이 워크플로우에 사용자를 전화 회의에 연결하는 전화 회의 참가 활동이 포함되어 있는지 확인합니다.
    toPhoneNumber 문자열 발신 대상 전화 번호입니다. 전화 회의에 착신 번호가 추가됩니다.
    컨퍼런스콜 GlideRecord 옵션입니다. 이 매개변수가 전달되면 매개변수에서 toPhoneNumber 식별된 호출자는 이 기록으로 식별되는 전화 회의에 자동으로 참가합니다.

    전화 회의 기록을 식별하는 알림 통화 [notify_call] 테이블에 대한 GlideRecord입니다. 이 기록은 발신 콜 워크플로우 스크래치패드에 workflow.scratchpad.conference_call 변수로 자동 추가됩니다.

    userSysId 문자열 옵션입니다. 호출과 연결된 사용자의 고유 식별자(sys_id)입니다.
    groupSysId 문자열 옵션입니다. 호출과 연결된 그룹의 고유 식별자(sys_id)입니다.
    sourceRecord GlideRecord 옵션입니다. 이 호출을 요청한 소스 기록입니다.
    표 2. 반환
    유형 설명
    void

    이 예에서는 다른 전화 번호로 전화를 거는 방법을 보여 줍니다.

    var from = '+14048007337';
    var to = '+31646810495';
    
    // set up call
    new sn_notify.NotifyScoped().call(from, to);

    이 예에서는 전화 번호 목록에 대한 통화를 시작하고 해당 번호를 새 전화 회의에 자동으로 참가하는 방법을 보여 줍니다.

    var notify = new sn_notify.NotifyScoped();
    var from = '+14041234567';
    var participants = ['+31612345678', '+31623456789', '+31687654321'];
    
    // set up a conference call
    var conferenceCall = notify.conferenceCall();
    
    // set up the outbound calls for all conference call participants
    for (var i in participants) {
        var to = participants[i];
        notify.call(from, to, conferenceCall);
    }

    NotifyScoped - conferenceCall(GlideRecord sourceRecord)

    새 전화 회의 GlideRecord를 작성합니다.

    표 3. 매개변수
    이름 유형 설명
    sourceRecord GlideRecord 옵션입니다. 전화 회의를 만들기 위한 요청을 시작한 기록입니다. 기록의 소스 및 테이블 필드를 채우notify_conference_call 데 사용됩니다.
    표 4. 반환
    유형 설명
    GlideRecord 새 Notify 전화 회의 [notify_conference_call] 기록.
    var notify = new sn_notify.NotifyScoped();
    var from = '+14041234567';
    var participants = ['+31612345678', '+31623456789', '+31687654321'];
    
    // set up a conference call
    var conferenceCall = notify.conferenceCall();
    
    // set up the outbound calls for all conference call participants
    for (var i in participants) {
        var to = participants[i];
        notify.call(from, to, conferenceCall);
    }

    NotifyScoped - dequeueCall(GlideRecord callRecord)

    큐에 배치된 후 통화를 다시 시작합니다(보류 중).

    이 메서드를 사용하여 queueCall() 메서드를 사용하여 큐에 넣은 호출을 다시 시작합니다.

    표 5. 매개변수
    이름 유형 설명
    호출 기록 GlideRecord 재개하려는 보류 통화가 있는 Notify 호출 [notify_call] 테이블의 GlideRecord 객체입니다.
    표 6. 반환
    유형 설명
    void

    다음 예제에서는 보류된 호출을 다시 활성화하는 방법을 보여 줍니다.

    var notifyCallGr = new GlideRecord('notify_call');
    notifyCallGr.get('active participant sys id');
     
    if (notifyCallGr.isValid) {
        sn_notify.NotifyScoped.dequeueCall(notifyCallGr);
    }

    NotifyScoped - forwardCall(GlideRecord 호출, 문자열 대상, 문자열 dtmf)

    지정된 호출을 다른 호출 수신자에게 전달합니다.

    표 7. 매개변수
    이름 유형 설명
    호출 GlideRecord 또는 문자열 착신 전환할 통화의 통화 기록 또는 전화 통신 제공자 호출 ID를 Notify합니다.
    대상 GlideRecord 또는 문자열 통화를 착신 전환할 발신자의 Notify 전화 번호 기록 또는 E.164 호환 전화 번호입니다.
    Dtmf 문자열 통화 연결 시 보낼 DTMF(Dual Tone - Multi Frequency) 코드입니다.
    표 8. 반환
    유형 설명
    void

    다음 예제에서는 통화를 다른 전화 번호로 착신 전환하는 방법을 보여 줍니다.

    var callID = 'CA92374b5aa561dab476a7001db6026edc'; // Twilio Call ID
    var phoneNumber = '+91406xxxxxxx';
    var dtmfTones = null;
     
    var notifyCallGr = new GlideRecord('notify_call');
    notifyCallGr.get('active participant sys id');
     
    if (notifyCallGr.isValid) {
        sn_notify.NotifyScoped.forwardCall(notifyCallGr(or) callID, phoneNumber, dtmfTones)
    }

    NotifyScoped - getAvailableClients(notifyNumber 문자열)

    호출을 수신하는 데 사용할 수 있는 클라이언트 세션의 목록을 반환합니다.

    표 9. 매개변수
    이름 유형 설명
    알림 번호 문자열 유효한 Notify 전화번호입니다.
    표 10. 반환
    유형 설명
    배열 지정된 전화 번호에 대한 notify_client_session 테이블의 GlideRecord입니다.

    사용 가능한 클라이언트 세션이 없는 경우 "0"을 반환합니다.

    다음 예제에서는 getAvailableClients() 메서드를 사용하여 notify_client_session 테이블로 인덱싱한 다음 사용 가능한 모든 Notify 클라이언트에서 반복하는 방법을 보여 줍니다.

    var clientSessionGr = sn_notify.NotifyScoped.getAvailableClients('+185xxxxxxxx'); 
    // Here clientSessionGr is of type GlideRecord on 'notify_client_session' table.
     
    var isLoggedInUserAvailable = false;
    while (clientSessionGr.next()) {
      if (clientSessionGr.user == gs.getUserID())
        isLoggedInUserAvailable = clientSessionGr.available;
    }
    gs.info('isLoggedInUserAvailable - ' + isLoggedInUserAvailable);

    NotifyScoped - getPhoneNumbers()

    Notify에 사용할 수 있는 모든 전화 번호와 약식 코드를 반환합니다.

    표 11. 매개변수
    이름 유형 설명
    없음
    표 12. 반환
    유형 설명
    배열 NotifyPhoneNumber 개체의 목록으로, 각 개체는 Notify에 사용할 수 있는 하나의 전화 번호를 나타냅니다.

    이 예제에서는 Notify 전화 번호를 얻은 다음 목록을 반복하는 방법을 보여 줍니다.

    // Instantiate notify
    var notify = new sn_notify.NotifyScoped();
    
    // Retrieve all available phone numbers
    var phoneNumbers = notify.getPhoneNumbers();
    
    // Iterate over phone numbers
    for (var i = 0; i < phoneNumbers.length; i++) {
      var number = phoneNumbers[i];
    
      // Perform any actions using each phone number
    
    }

    NotifyScoped - getShortCodes()

    Notify에 사용할 수 있는 모든 약식 코드를 반환합니다.

    표 13. 매개변수
    이름 유형 설명
    없음
    표 14. 반환
    유형 설명
    void

    이 예제에서는 Notify 약식 코드를 가져온 다음 목록을 반복하는 방법을 보여 줍니다.

    // Instantiate notify
    var notify = new sn_notify.NotifyScoped();
    
    // Retrieve all available shortcodes
    var shortCodes = notify.getShortCodes();
    
    // Iterate over phone numbers
    for (var i = 0; i < shortCodes.length; i++) {
      var shortCode = shortCodes[i];
      gs.log(shortCode.getNumber());
    
    //perform any actions using each shortcode
    
    }

    NotifyScoped - getTokens(GlideRecord, record)

    WebRTC 또는 모바일 클라이언트에서 사용할 활성 전화 통신 드라이버에 대한 클라이언트 토큰을 반환합니다.

    이 방법은 현재 로그인한 사용자 기록을 클라이언트로 사용합니다.

    표 15. 매개변수
    이름 유형 설명
    기록 GlideRecord 그룹 기록 또는 사용자 기록과 같은 Notify 클라이언트를 식별하는 데 사용할 GlideRecord입니다.
    표 16. 반환
    유형 설명
    문자열 지원되는 드라이버에 대한 웹 RTC 토큰Web RTC tokens for the supported drivers, as a JSON string with the following format: {driverName1: &quot;token1&quot;, driverName2: &quot;token2&quot;}, such as &quot;TwilioDirect&quot;:&quot;eyJhxxxx.eyJleHAiOiIxxxx.7fejxxx_mbLxxx&quot;

    이 예제에서는 현재 로그인한 사용자에 대한 클라이언트 토큰을 가져오는 방법을 보여 줍니다.

    // get Notify client Tokens per active Notify driver for the currently logged in user
    var json = new sn_notify.NotifyScoped().getTokens();
     
    // Parse the JSON that was return into a tokens object
    var tokens = JSON.parse(json);
    
    // Log line
    gs.log('Notify client tokens for the currently logged in user');
    
     // iterate over the driver tokens
    for (var driver in tokens) {
     	gs.log(driver + ' Driver token: ' + tokens[driver]);
    }

    이 예제에서는 모든 Notify 그룹에 대한 클라이언트 토큰을 가져오는 방법을 보여줍니다.

    // instantiate Notify
    var notify = new sn_notify.NotifyScoped.Notify();
     
    // get all Notify Groups
    var notifyGroup = new GlideRecord("notify_group");
    notifyGroup.query();
     
    // iterate over all notify groups
    while (notifyGroup.next()) {
      // generate Notify Client tokens per active Notify Driver for this group
      var json = notify.getTokens(notifyGroup);
      var tokens = JSON.parse(json);
     
      for (var driver in tokens) {
        gs.log(gs.getMessage("Notify Client token for {0} driver and Notify Group '{1}': {2}", [driver, notifyGroup.getValue('name'), tokens[driver]]));
      }
    }

    이 예제에서는 활성 전화 통신 드라이버에 대한 클라이언트 토큰을 가져오는 방법을 보여 줍니다.

    var notify = new sn_notify.NotifyScoped();
    var now_GR = new GlideRecord('sys_user');
    if (now_GR.get(gs.getUserID())) {
      gs.info(notify.getTokens(now_GR));
    }

    출력:

    {"TwilioDirect":"eyJhxxxx.eyJleHAiOiIxxxx.7fejxxx_mbLxxx"}

    NotifyScoped - getTokenTTL(문자열 소유자)

    자동으로 시간 초과되기 전에 지정된 전화 통신 드라이버에 대해 클라이언트 세션이 활성 상태로 유지되는 최대 시간을 반환합니다.

    표 17. 매개변수
    이름 유형 설명
    소유자 문자열 세션 길이를 검색할 전화 통신 드라이버의 이름입니다.

    유효한 값은 다음과 같습니다.

    • Twilio: 구형 드라이버용
    • TwilioDirect: 새 드라이버용
    표 18. 반환
    유형 설명
    정수 세션의 최대 길이(초)입니다.

    기본값: 1800초

    다음 예제에서는 이 메서드와 관련 응답을 올바르게 호출하는 방법을 보여 줍니다. 또한 잘못된 드라이버가 전달되는 경우 반환되는 내용도 보여 줍니다.

    var owner = "TwilioDirect";  // Valid driver
    var ttl = SNC.Notify.getTokenTTL(owner);
    gs.info("Token TTL for " + owner + " --> " + ttl);
     
    owner = "Abcxyz";  // Invalid driver
    ttl = SNC.Notify.getTokenTTL(owner);
    // For an invalid driver, we throw NoSuchNotifyDriverException saying that Abcxyzdriver is not available
    // and return the default value of TTL
    gs.info("Token TTL for " + owner + " --> " + ttl); 

    NotifyScoped - hasCapability(문자열, notifyPhoneNumber, 문자열 기능)

    지정된 전화 번호에 지정된 기능이 있는지 확인합니다.

    전화 번호와 연결된 전화 통신 드라이버에는 전화기의 모든 기능 목록이 포함되어 있습니다.

    주:
    기본 시스템에서 Notify JS 드라이버에는 기능으로 'show_speakers'만 있습니다. 이것은 수정할 수 있습니다.
    표 19. 매개변수
    이름 유형 설명
    알림 전화 번호 문자열 지정된 역량을 확인할 전화 번호입니다.
    역량 문자열 탐지 기능입니다. 문자열 텍스트는 전화기에 있는 텍스트와 정확히 일치해야 합니다.
    표 20. 반환
    유형 설명
    부울 지정된 전화기에 지정된 기능이 있는지 여부를 나타내는 플래그입니다.
    • true: 전화기에 기능이 있습니다.
    • false: 전화기에 해당 기능이 없습니다.

    이 예에서는 전화기에 특정 기능이 있는지 확인하는 방법을 보여 줍니다.

    // Each driver has a defined set of capabilities.
    
    var capability = 'show_speakers';
    gs.info(sn_notify.NotifyScoped.hasCapability('+185xxxxxxxx', capability)); // true
     
    capability = 'send_sms';
    gs.info(sn_notify.NotifyScoped.hasCapability('+185xxxxxxxx', capability)); // false

    NotifyScoped - kick(GlideRecord 참가자)

    현재 Notify 전화 회의에서 지정된 호출자를 제거합니다.

    표 21. 매개변수
    이름 유형 설명
    참가자 GlideRecord 전화 회의에서 제거할 호출자의 참가자 알림[notify_participant] 기록을 포함하는 GlideRecord 객체입니다.
    표 22. 반환
    유형 설명
    void

    이 예제에서는 통화에서 참가자를 제거하는 방법을 보여 줍니다.

    var participant = new GlideRecord('notify_participant');
    participant.get('<sys_id>');
    if (participant.isValid()) {
        new sn_notify.NotifyScoped().kick(participant);
    }

    NotifyScoped - modifyCall(GlideRecord, callRecord, NotifyAction, notifyAction)

    활성 Notify 전화 통화에 대해 하나 이상의 활동을 수행합니다.

    이 메서드를 사용하여 호출의 동작을 변경할 수 있습니다. 예를 들어 통화 전환, 오디오 재생 또는 강제 끊기 등이 있습니다.
    주:
    이 메서드의 범위가 지정된 구현은 사용자 지정 Notify 활동만 지원합니다. 전역 구현과 달리 NotifyAction API를 제공하지 않습니다. 사용자 지정 Notify 활동을 만드는 방법에 대한 자세한 내용은 Notify 워크플로우 활동을 참조하십시오.
    표 23. 매개변수
    이름 유형 설명
    호출 기록 GlideRecord 작업을 적용할 호출의 알림 호출 [notify_call] 기록입니다.
    알림 작업 알림 작업 호출에 대해 수행할 하나 이상의 활동을 설명하는 NotifyAction 객체입니다.
    표 24. 반환
    유형 설명
    void

    NotifyScoped - 음소거(GlideRecord participantRecord)

    지정된 전화 회의 참가자를 음소거합니다.

    표 25. 매개변수
    이름 유형 설명
    참가자 기록 GlideRecord 참가자가 음소거할 notify_participant 테이블의 GlideRecord입니다.
    표 26. 반환
    유형 설명
    void

    다음 예제에서는 호출자를 음소거하는 방법을 보여 줍니다.

    var notifyParticipantGr = new GlideRecord('notify_participant');
    notifyParticipantGr.get('active participant sys id');
     
    if (notifyParticipantGr.isValid) {
        sn_notify.NotifyScoped.mute(notifyParticipantGr);
    }

    NotifyScoped - queueCall(GlideRecord, callRecord)

    지정된 호출을 큐에 넣습니다(보류 중).

    dequeueCall() 메서드를 사용하여 대기 중인 호출을 다시 시작합니다.

    표 27. 매개변수
    이름 유형 설명
    호출 기록 GlideRecord 보류할 알림 통화 기록(notify_call 테이블)의 GlideRecord 객체입니다.
    표 28. 반환
    유형 설명
    void
    var call = new GlideRecord('notify_call');
    call.get('<call record sys_id>');
    if (call.isValid()) {
        new sn_notify.NotifyScoped().queueCall(call);
    }

    NotifyScoped - sendBulkSMS(NotifyPhoneNumber, notifyPhoneNumber, 문자열 toPhoneNumbers, 문자열 messageBody, GlideRecord 소스)

    지정된 SMS 메시지를 지정된 Notify 클라이언트 목록(전화 번호)으로 보냅니다.

    표 29. 매개변수
    이름 유형 설명
    알림 전화 번호 알림 전화 번호 SMS 메시지가 전송되는 전화 번호입니다.
    toPhoneNumbers 문자열 SMS 메시지를 보낼 전화 번호를 쉼표로 구분한 목록입니다.

    형식: E.164 호환

    메시지 본문 문자열 보낼 SMS 텍스트입니다.
    source GlideRecord 인시던트와 같이 이 SMS 메시지를 메시지로 표시한 소스 기록입니다.
    표 30. 반환
    유형 설명
    문자열 Null

    이 예에서는 SMS 메시지를 여러 전화 번호(대량 SMS)로 보내는 방법을 보여줍니다.

    var incidentGr = new GlideRecord('incident');
    incidentGr.get('active incident sys_id');
    if (incidentGr.isValid()) {
        sn_notify.NotifyScoped.sendBulkSMS('+15413970605', ['+919885XXXXXX', '+919775XXXXXX'], 'Test automation message', incidentGr);
    }

    NotifyScoped - sendSMS(NotifyPhoneNumber, notifyPhoneNumber, 문자열 toPhoneNumber, 문자열 messageBody, GlideRecord 소스)

    E.164에 따른 전화 번호로 SMS 텍스트 메시지를 보냅니다.

    이 메서드는 알림 메시지 [notify_message] 테이블에 새 기록을 만들고 원본 기록에 연결합니다.

    표 31. 매개변수
    이름 유형 설명
    알림 전화 번호 알림 전화 번호 이 SMS 메시지를 보낼 전화 번호 또는 짧은 코드를 알림 합니다.
    toPhoneNumber 문자열 SMS 메시지를 보낼 E.164 호환 전화 번호입니다.
    메시지 본문 문자열 SMS 문자 메시지입니다.
    source GlideRecord 인시던트와 같이 이 SMS 메시지를 메시지로 표시한 소스 기록입니다.
    표 32. 반환
    유형 설명
    문자열 고유 메시지 SID; 알림 메시지[notify_message] 기록에 message_id로 저장됩니다.

    다음 예제에서는 SMS 메시지를 보내는 방법을 보여 줍니다.

    var incidentGr = new GlideRecord('incident');
    incidentGr.get('active incident sys_id');
    if (incidentGr.isValid()) {
        sn_notify.NotifyScoped.sendSMS('+15413970605', '+919885XXXXXX', 'Test automation message', incidentGr);
    }

    NotifyScoped - 음소거 해제(GlideRecord participantRecord)

    지정된 전화 회의 참가자의 음소거를 취소합니다.

    표 33. 매개변수
    이름 유형 설명
    참가자 기록 GlideRecord 참가자가 음소거를 해제할 notify_participant 테이블의 GlideRecord입니다.
    표 34. 반환
    유형 설명
    void

    이 예제에서는 지정된 통화 참가자의 음소거를 해제하는 방법을 보여 줍니다.

    var notifyParticipantGr = new GlideRecord('notify_participant');
    notifyParticipantGr.get('active participant sys id');
     
    if (notifyParticipantGr.isValid) {
        sn_notify.NotifyScoped.unmute(notifyParticipantGr);
    }