Skip to content

ShlomoCode/yemot-router2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

yemot-router2

ืกืคืจื™ื” ืฉืžืืคืฉืจืช ืœืชื›ื ืช ืžืขืจื›ื•ืช ื˜ืœืคื•ื ื™ื•ืช ื‘ืงืœื•ืช ื‘ืืžืฆืขื•ืช ืžื•ื“ื•ืœ API ืฉืœ ื—ื‘ืจืช 'ื™ืžื•ืช ื”ืžืฉื™ื—'.

ืžื˜ืจืช ื”ืกืคืจื™ื” ืœืืคืฉืจ ืชืงืฉื•ืจืช ืžื•ืœ ื”ืžืขืจื›ืช ื”ื˜ืœืคื•ื ื™ืช ื‘ืฆื•ืจื” ื ืงื™ื” ื•ืงืจื™ืื”:

  • ื”ืจืฆื” ืจืฆื™ืคื” ืฉืœ ื”ืงื•ื“ ืžืชื—ื™ืœื” ื•ืขื“ ืกื•ืฃ, ืชื•ืš ืฉืžื™ืจืช ื”state ืฉืœ ื”ืฉื™ื—ื” ื‘ื™ืŸ ื”ืงืจื™ืื•ืช, ื‘ืฆื•ืจื” ืฉืงื•ืคื” ืœื—ืœื•ื˜ื™ืŸ
  • ื™ืฆื™ืจืช ื”ืชืฉื•ื‘ื•ืช ืขืœ ื™ื“ื™ ืงืจื™ืื” ืœืžืชื•ื“ื•ืช ืฉืœ ื”ืฉื™ื—ื” ื‘ืžืงื•ื ื™ืฆื™ืจื” ื™ื“ื ื™ืช ืฉืœ ื”ืกื˜ืจื™ื ื’ื™ื
  • ืืคืฉืจื•ื™ื•ืช ื ื•ื—ื•ืช ื ื•ืกืคื•ืช ื›ื’ื•ืŸ ืžื˜ืคืœ ื‘ืฉื’ื™ืื•ืช, ื”ืกืจื” ืฉืœ ืชื•ื•ื™ื ืœื ื—ื•ืงื™ื™ื, ืœื•ื’ ืื•ื˜ื•ืžื˜ื™ ืžืคื•ืจื˜ (ืื•ืคืฆื™ื•ื ืœื™)
  • ืชื™ืขื•ื“ ืžืคื•ืจื˜ ืžื•ื˜ืžืข ื•ืžื•ืฆื’ ืชื•ืš ื›ื“ื™ ืขืจื™ื›ื” โ€ซ(JSDoc)
  • ืชืžื™ื›ื” ื‘TypeScript
  • ื•ืขื•ื“ ืืคืฉืจื•ื™ื•ืช ืจื‘ื•ืช! ืคื™ืจื•ื˜ ื‘ืชื™ืขื•ื“ ๐Ÿ‘‡

ื”ืชืงื ื”

npm install yemot-router2

ื™ื•ืžืŸ ืฉื™ื ื•ื™ื™ื/ื”ื•ืจืื•ืช ืฉื“ืจื•ื’

โš™๏ธ ืžืฉื“ืจื’ื™ื ืžื’ืจืกื” ืงื•ื“ืžืช? ืจืื• changelog!

ืชื™ืขื•ื“

ืžื•ืžืœืฅ ืœื”ืฉืชืžืฉ ื‘ื›ืคืชื•ืจ "ืชื•ื›ืŸ ื”ืขื ื™ื™ื ื™ื" ื”ืื•ื˜ื•ืžื˜ื™ ื›ื“ื™ ืœื ื•ื•ื˜ ื‘ืชื™ืขื•ื“: CleanShot 2023-05-02 at 04 14 20@2x

ืืชื—ื•ืœ ื”ืจืื•ื˜ืจ ื•ืฉื™ืžื•ืฉ ื‘ืกื™ืกื™

ื”ืกืคืจื™ื” ืขื•ื‘ื“ืช ืขืœ ื™ื“ื™ ื—ื™ืงื•ื™ ืฉืœ Express Router, ื›ืš ืฉืื•ืคืŸ ื”ืฉื™ืžื•ืฉ ื”ื•ื ื“ื™ ื“ื•ืžื”. ื“ื•ื’ืžื”:

import { YemotRouter } from 'yemot-router2';
const router = YemotRouter();

router.get('/', async (call) => {
    return call.id_list_message([{
        type: 'text',
        data: 'ืฉืœื•ื ืขื•ืœื'
    }])
});

ืืช ื”ืจืื•ื˜ืจ ื™ืฉ ืœื—ื‘ืจ ืœืืคืœื™ืงืฆื™ื™ืช express ืขืœ ื™ื“ื™ app.use, ื›ืจื’ื™ืœ.

ื”ืจืื•ื˜ืจ ืžืงื‘ืœ ืคื•ื ืงืฆื™ื™ื” ืืกื™ื ื›ืจื•ื ื™ืช, ืฉื”ืืจื’ื•ืžื ื˜ ืฉื”ื™ื ืžืงื‘ืœืช ืžื”ืจืื•ื˜ืจ ื”ื•ื ืื•ื‘ื™ื™ืงื˜ Call (ื™ื‘ื•ืืจ ื‘ื”ืžืฉืš), ื”ืžื™ื™ืฆื’ ืืช ื”ืฉื™ื—ื”, ื•ื‘ืืžืฆืขื•ืช ื”ืžืชื•ื“ื•ืช ืฉืœื• ื ื™ืชืŸ ืœืงื‘ืœ ืžื™ื“ืข ืื•ื“ื•ืช ื”ืฉื™ื—ื”, ืœื”ืฉืžื™ืข/ืœื‘ืงืฉ ื ืชื•ื ื™ื ืžื”ืžื—ื™ื™ื’, ืœื”ืคื ื•ืช ืื•ืชื• ืœืฉืœื•ื—ื” ืื—ืจืช, ื•ืขื•ื“.

๐Ÿ‘จโ€๐Ÿ’ป ื“ื•ื’ืžื” ื‘ืกื™ืกื™ืช: example.js

ื˜ื™ืค: ืžื•ืžืœืฅ ืžืื•ื“ ืœื ืœื”ื’ื“ื™ืจ ื‘ืฉืœื•ื—ื” api_hangup_send=no, ืœื‘ื™ืฆื•ืขื™ ื–ื™ื›ืจื•ืŸ ื˜ื•ื‘ื™ื ื™ื•ืชืจ.

ืืคืฉืจื•ื™ื•ืช ื”ืจืื•ื˜ืจ

ื”ืจืื•ื˜ืจ ืžืงื‘ืœ ืืช ื”ืคื•ื ืงืฆื™ื•ืช ื”ื‘ืื•ืช, ื›ื•ืœืŸ ืื•ืคืฆื™ื•ื ืœื™ื•ืช:

  • timeout: โ€ซ ื–ืžืŸ ื”ืžืชื ื” ืœืงื‘ืœืช ื ืชื•ืŸ ืžื”ืžืฉืชืžืฉ (ื‘ืžื™ืœื™ืฉื ื™ื•ืช). ื‘ืžื™ื“ื” ื•ืœื ื”ืชืงื‘ืœ ื”ื ืชื•ืŸ ื‘ื–ืžืŸ ื”ื "ืœ, ื”ืฉื™ื—ื” ืชื™ืžื—ืง ืžื”activeCalls ื•ื’ื ืื ื”ืžืฉืชืžืฉ ื™ืงื™ืฉ ื”ืฉืจืช ื™ืงื‘ืœ ืื•ืชื• ื›ืฉื™ื—ื” ื—ื“ืฉื”.
    โ€ซืžืงื‘ืœ ืžืกืคืจ ืžื™ืœื™ืฉื™ื ื™ื•ืช, ืื• ืžื—ืจื•ื–ืช ื”ืงื‘ื™ืœื” ืข"ื™ ืกืคืจื™ื™ืช ืกืคืจื™ื™ืช ms.
    โ€ซืžื›ืกื” ื’ื ืžืงืจื™ ืงืฆื” ืฉืœื ื”ืชืงื‘ืœื” ืžื™ืžื•ืช ื”ืงืจื™ืื” ืขื hangup=yes.
    โ€ซื™ืฉ ืœืฉื™ื ืœื‘ ืœื ืœื”ื’ื“ื™ืจ ืขืจืš ื ืžื•ืš ืฉืžื—ื™ื™ื’ ืœื’ื™ื˜ื™ืžื™ ืฉืœื ื”ืงื™ืฉ ืžื™ื“ ืชืฉื•ื‘ื” ืขืœื•ืœ ืœื”ื™ืชืงืœ ื‘-timeout.
  • printLog (ื‘ื•ืœื™ืื ื™): ื”ืื ืœื”ื“ืคื™ืก ืœื•ื’ ืžืคื•ืจื˜ ืขืœ ื›ืœ ืงืจื™ืื” ืœืฉืจืช, ื ื™ืชื•ืง ืฉื™ื—ื” ื•ื›ื•ืœื™. ืฉื™ืžื•ืฉื™ ืœืคื™ืชื•ื—.
  • uncaughtErrorHandler: (ืคื•ื ืงืฆื™ื”) โ€ซ ืคื•ื ืงืฆื™ื” ืœื˜ื™ืคื•ืœ ื‘ืฉื’ื™ืื•ืช ืœื ืžื˜ื•ืคืœื•ืช ื‘ืชื•ืš ืฉื™ื—ื”, ืฉื™ืžื•ืฉื™ ืœื“ื•ื’ืžื” ืœืฉืžื™ืจืช ืœื•ื’ + ื”ืฉืžืขืช ื”ื•ื“ืขื” ืœืžืฉืชืžืฉ, ื‘ืžืงื•ื ืงืจื™ืกื” ืฉืœ ื”ืฉืจืช, ื•ื”ืžืฉืชืžืฉ ื™ืฉืžืข "ืื™ืŸ ืžืขื ื” ืžืฉืจืช API". ืจืื” ื“ื•ื’ืžื” ื‘example.js.

ื‘ื ื•ืกืฃ ื ื™ืชืŸ ืœื”ืขื‘ื™ืจ ืื•ืคืฆื™ื•ืช ืฉืœ ืืงืกืคืจืก ืจืื•ื˜ืจ ืขืฆืžื• - ืจืื” ืคื™ืจื•ื˜ ื‘ืชื™ืขื•ื“ express.js.

ืžืชื•ื“ื•ืช ืื•ื‘ื™ื™ืงื˜ ื”Call

read(messages, mode, options?)

ืžืชื•ื“ื” ืœืงื‘ืœืช ื ืชื•ืŸ ืžื”ืžื—ื™ื™ื’, ืžื—ื–ื™ืจื” Promise ืขื ื”ืชืฉื•ื‘ื” (ื‘ืžืงืจื” ืฉืœ ื‘ืงืฉืช ื”ืงืœื˜ื”, ื™ื—ื–ื•ืจ ื ืชื™ื‘ ื”ืงื•ื‘ืฅ).
ืคื™ืจื•ื˜ ื ื•ืกืฃ ืขืœ read: https://f2.freeivr.co.il/post/78283

ื”ืืจื’ื•ืžื ื˜ messages

ื”ื”ื•ื“ืขื•ืช ืฉื™ื•ืฉืžืขื• ืœืžื—ื™ื™ื’ ืœืคื ื™ ืงื‘ืœืช ื”ื ืชื•ืŸ.
ืžืขืจืš ืฉืœ ืื•ื‘ื™ื™ืงื˜ื™ "ื”ื•ื“ืขื”" (ืจืื” ืคื™ืจื•ื˜ ื‘ื”ืžืฉืš), ืฉื™ื•ืฉืžืขื• ืœืžืฉืชืžืฉ ื‘ืจืฆืฃ.

ื”ืืจื’ื•ืžื ื˜ mode

ืžื’ื“ื™ืจ ืืช ืกื•ื’ ื”ื ืชื•ืŸ ืฉืžื‘ืงืฉื™ื ืžื”ืžื—ื™ื™ื’:

tap = ื”ืงืฉื•ืช

stt = ื–ื™ื”ื•ื™ ื“ื™ื‘ื•ืจ

record = ื”ืงืœื˜ื”

ื”ืืจื’ื•ืžื ื˜ options

ื‘ืคืจืžื˜ืจ ื”ื–ื”, ื ื™ืชืŸ ืœื”ืขื‘ื™ืจ ืืคืฉืจื•ื™ื•ืช ื ื•ืกืคื•ืช, ื›ื’ื•ืŸ ืกืš ื”ืงืฉื•ืช ืžื™ื ื™ืžืœื™, ืžืงืกื™ืžืœื™, ื•ื›ื•'.

ื”ืงืฉื•ืช

let options = {
    /* ืฉื ื”ืขืจืš ื‘ื™ืžื•ืช
    ื‘ืจื™ืจืช ืžื—ื“ืœ, ื ืงื‘ืข ืื•ื˜ื•ืžื˜ื™ืช,
    val_1, val_2, val_3 ...
    */
    val_name: "val_x",
    
    /* ื”ืื ืœื‘ืงืฉ ืืช ื”ืขืจืš ืฉื•ื‘ ืื ืงื™ื™ื. */
    re_enter_if_exists: false,
    
    /* ื›ืžื•ืช ื”ืกืคืจื•ืช ื”ืžืงืกื™ืžืœื™ืช ืฉื”ืžืฉืชืžืฉ ื™ื•ื›ืœ ืœื”ืงื™ืฉ */
    max_digits: "*",
    
    /* ื›ืžื•ืช ืกืคืจื•ืช ืžื™ื ื™ืžืœื™ืช */
    min_digits: 1,
    
    /* ืฉื ื™ื•ืช ืœื”ืžืชื ื” */
    sec_wait: 7,
    
    /* ืฆื•ืจืช ื”ื”ืฉืžืขื” ืœืžืฉืชืžืฉ ืืช ื”ืงืฉื•ืชื™ื•
    ื‘ืื ืžืขื•ื ื™ื™ื ื™ื ื‘ืžืงืœื“ืช ืฉื•ื ื” ืžืžืงืœื“ืช ืกืคืจื•ืช, ื›ื’ื•ืŸ EmailKeyboard ืื• HebrewKeyboard, ื™ืฉ ืœื”ื›ื ื™ืก ื›ืืŸ ืืช ืกื•ื’ ื”ืžืงืœื“ืช
    [ืจืื• example.js]
    ื”ืื•ืคืฆื™ื•ืช ื”ืงื™ื™ืžื•ืช:
    "Number" | "Digits" | "File" | "TTS" | "Alpha" | "No" | "HebrewKeyboard" |
    "EmailKeyboard" | "EnglishKeyboard" | "DigitsKeyboard" | "TeudatZehut" |
    "Price" | "Time" | "Phone" | "No"
    ืคื™ืจื•ื˜ ืขืœ ื›ืœ ืื•ืคืฆื™ื” ื ื™ืชืŸ ืœืžืฆื•ื ื‘ืชื™ืขื•ื“ ืžื•ื“ื•ืœ API ืฉืœ ื™ืžื•ืช ื”ืžืฉื™ื—, ืชื—ืช"ื”ืขืจืš ื”ืฉื™ืฉื™ (ื”ืงืฉื”)".
    */
    
    typing_playback_mode: "No",
    
    /* ื”ืื ืœื—ืกื•ื ื”ืงืฉื” ืขืœ ื›ื•ื›ื‘ื™ืช */
    block_asterisk_key: false,
    
    /* ื”ืื ืœื—ืกื•ื ื”ืงืฉื” ืขืœ ืืคืก */
    block_zero_key: false,
    
    /* ื”ื—ืœืคืช ืชื•ื•ื™ื*/
    replace_char: "",
    
    /* ืกืคืจื•ืช ืžื•ืชืจื•ืช ืœื”ืงืฉื” - ืžืขืจืš
    [1, 2, 3 ...]
    */
    digits_allowed: [],
    
    /* ื›ืžื” ืคืขืžื™ื ืœื”ืฉืžื™ืข ืืช ื”ืฉืืœื” ืœืคื ื™ ืฉืœื™ื—ืช ืชืฉื•ื‘ืช "None" (ื›ืœื•ืžืจ ืชืฉื•ื‘ื” ืจื™ืงื”). ื‘ืจื™ืจืช ืžื—ื“ืœ ืคืขื ืื—ืช */
    amount_attempts: "",
    
    /*
    ื”ืื ืœืืคืฉืจ ืชืฉื•ื‘ื” ืจื™ืงื” - ืื• ืฉืœืื—ืจ ื–ืžืŸ ื”ื”ืžืชื ื” ื™ื•ืฉืžืข "ืœื ื”ื•ืงืฉื” ื‘ื—ื™ืจื”" ื•ื™ื“ืจื•ืฉ ืœื”ืงื™ืฉ
    ื‘ืจื™ืจืช ืžื—ื“ืœ ืœื ืžืืคืฉืจ ืชืฉื•ื‘ื” ืจื™ืงื”
    */
    allow_empty: false,
    
    /*
    ื”ืขืจืš ืฉื™ื™ืฉืœื— ื›ืฉืœื ื”ื•ืงืฉื” ืชืฉื•ื‘ื”. ื‘ืจื™ืจืช ืžื—ื“ืœ "None"
    ื ื™ืชืŸ ืœื”ืขื‘ื™ืจ ื’ื ืขืจื›ื™ื ืฉืื™ื ื ืžื—ืจื•ื–ืช, ืœื“ื•ื’ืžื” null ื•ื”ืขืจืš ืฉื™ืชืงื‘ืœ ืžื”read ื™ื”ื™ื” null ื•ืœื 'null'
    */
    empty_val: "None",
    
    /* ื”ืื ืœื—ืกื•ื ืฉื™ื ื•ื™ ืฉืคืช ืžืงืœื“ืช */
    block_change_keyboard: false,
}

ื”ืงืœื˜ื”

ืขืจื›ื™ ื‘ืจื™ืจืช ืžื—ื“ืœ - ื”ืงืœื˜ื•ืช:

const options = {
    /* ื ืชื™ื‘ ืœืฉืžื™ืจืช ื”ื”ืงืœื˜ื” - ืฉืœื•ื—ื” ื‘ืœื‘ื“, ื‘ืจื™ืจืช ืžื—ื“ืœ ืฉืœื•ื—ื” ื ื•ื›ื—ื™ืช, ืื• api_dir ืื ืžื•ื’ื“ืจ */
    path: '',

    /* ืฉื ืงื•ื‘ืฅ (ืœืœื ืกื™ื•ืžืช) ืœืฉืžื™ืจืช ื”ื”ืงืœื˜ื”, ื‘ืจื™ืจืช ืžื—ื“ืœ - ืžืžื•ืกืคืจ ืื•ื˜ื•ืžื˜ื™ืช ื›ืงื•ื‘ืฅ ื”ื’ื‘ื•ื” ื‘ืฉืœื•ื—ื” */
    file_name: '',

    /*
    ื‘ืจื™ืจืช ืžื—ื“ืœ ืžืฉืžื™ืข ืชืคืจื™ื˜ ืœืื™ืฉื•ืจ ื”ื”ืงืœื˜ื”/ื”ืงืœื˜ื” ืžื—ื“ืฉ, ื ื™ืชืŸ ืœื”ื’ื“ื™ืจ ืฉืžื™ื“ ื‘ื”ืงืฉื” ืขืœ ืกื•ืœืžื™ืช ื”ื”ืงืœื˜ื” ืชืื•ืฉืจ
    */
    no_confirm_menu: false,

    /* ื”ืื ืœืฉืžื•ืจ ืืช ื”ื”ืงืœื˜ื” ื‘ืื ื”ืžืฉืชืžืฉ ื ื™ืชืง ื‘ืืžืฆืข ื”ืงืœื˜ื” */
    save_on_hangup: false,

    /*
    ื‘ืžื™ื“ื” ื•ื”ื•ื’ื“ืจ ืฉื ืงื•ื‘ืฅ ืœืฉืžื™ืจื” (file_name) ื•ื›ื‘ืจ ืงื™ื™ื ืงื•ื‘ืฅ ื›ื–ื”,
    ื”ืื ืœืฉื ื•ืช ืืช ืฉื ื”ืงื•ื‘ืฅ ื”ื™ืฉืŸ ื•ืœืฉืžื•ืจ ืืช ื”ื—ื“ืฉ ื‘ืฉื ืฉื ื‘ื—ืจ (ื‘ืจื™ืจืช ืžื—ื“ืœ), ืื• ืœืฆืจืฃ ืืช ื”ื”ืงืœื˜ื” ื”ื—ื“ืฉื” ืœืกื•ืฃ ื”ืงื•ื‘ืฅ ื”ื™ืฉืŸ
    */
    append_to_existing_file: false,

    /* ื›ืžื•ืช ืฉื ื™ื•ืช ืžื™ื ื™ืžืœื™ืช ืœื”ืงืœื˜ื”, ื‘ืจื™ืจืช ืžื—ื“ืœ ืื™ืŸ ืžื™ื ื™ืžื•ื */
    min_length: '',

    /* ื›ืžื•ืช ืฉื ื™ื•ืช ืžืงืกื™ืžืœื™ืช ืœื”ืงืœื˜ื”, ื‘ืจื™ืจืช ืžื—ื“ืœ ืœืœื ื”ื’ื‘ืœื” */
    max_length: ''
};

ื–ื™ื”ื•ื™ ื“ื™ื‘ื•ืจ

ืขืจื›ื™ ื‘ืจื™ืจืช ืžื—ื“ืœ - ื–ื™ื”ื•ื™ ื“ื™ื‘ื•ืจ:

const options = {
    /*
    ืฉืคืช ื”ื“ื™ื‘ื•ืจ
    ื‘ืจื™ืจืช ืžื—ื“ืœ ืขื‘ืจื™ืช ืื• ืžื” ืฉื”ื•ื’ื“ืจ ื‘lang ื‘ืฉืœื•ื—ื”,
    ืจืฉื™ืžืช ื”ืฉืคื•ืช ื”ื–ืžื™ื ื•ืช ืœื”ื’ื“ืจื”: https://did.li/m1lrl
    */
    lang: '',

    /*
    ื”ืื ืœื—ืกื•ื ื”ืงืฉื” ื‘ืžืฆื‘ ื–ื™ื”ื•ื™ ื“ื™ื‘ื•ืจ
    ื‘ืจื™ืจืช ืžื—ื“ืœ ืžืืคืฉืจ ืœื”ืงื™ืฉ ืชื•ืš ื›ื“ื™ ื”ื“ื™ื‘ื•ืจ, ื›ืœื•ืžืจ ื”ืžื—ื™ื™ื’ ื‘ื•ื—ืจ ืื ืœื”ืงื™ืฉ ืื• ืœื“ื‘ืจ
    */
    block_typing: false,

    /*
    ืžืงืกื™ืžื•ื ืกืคืจื•ืช ืฉืืคืฉืจ ืœื”ืงื™ืฉ, ื‘ืื ืœื ื ื—ืกืžื” ื”ื”ืงืฉื” ืชื•ืš ื›ื“ื™ ื“ื™ื‘ื•ืจ
    ื‘ืจื™ืจืช ืžื—ื“ืœ ืœื ืžื•ื’ื‘ืœ
    */
    max_digits: '',

    /*
    ื”ืื ืœื”ืฉืชืžืฉ ื‘ืžื ื•ืข ื”ื“ื™ื‘ื•ืจ ืฉืœ ื”ืงืœื˜ื•ืช - ื ืฆืจืš ืขื‘ื•ืจ ื–ื™ื”ื•ื™ ื˜ืงืกื˜ ืืจื•ืš
    ื‘ืื ืžืคืขื™ืœื™ื ื”ื’ื“ืจื” ื–ื•, ืœื ื ื™ืชืŸ ืœืงืœื•ื˜ ื”ืงืฉื•ืช ืชื•ืš ื›ื“ื™ ื“ื™ื‘ื•ืจ
    */
    use_records_recognition_engine: false,

    /*
    ืื—ืจื™ ื›ืžื” ืฉื ื™ื•ืช ืฉืœ ืฉืงื˜ ืœืกื™ื™ื ืืช ื”ื”ืงืœื˜ื”,
    ืจืœื•ื•ื ื˜ื™ ืจืง ืื ืžืฉืชืžืฉื™ื ื‘ืžื ื•ืข ื–ื™ื”ื•ื™ ื˜ืงืกื˜ื™ื ืืจื•ื›ื™ื (use_records_recognition_engine)
    */
    quiet_max: '',

    /*
    * ืžืกืคืจ ืฉื ื™ื•ืช ืžืจื‘ื™ ืœื”ืงืœื˜ื”, ื‘ืจื™ืจืช ืžื—ื“ืœ: ืœืœื ื”ื’ื‘ืœื”
    */
    length_max: ''
};

go_to_folder(target)

ืžืชื•ื“ื” ืœื”ืขื‘ืจืช ื”ืฉื™ื—ื” ืœืฉืœื•ื—ื” ืžืกื•ื™ืžืช ื‘ืžืขืจื›ืช ื”ื ื•ื›ื—ื™ืช.

ื ื™ืชืŸ ืœื›ืชื•ื‘ ื ืชื™ื‘ ื™ื—ืกื™ ืœืฉืœื•ื—ื” ื”ื ื•ื›ื—ื™ืช ืื• ืœืฉืœื•ื—ื” ื”ืจืืฉื™ืช, ืคื™ืจื•ื˜ ืขืœ ื”ืื•ืคืฆื™ื•ืช ื”ื–ืžื™ื ื•ืช ื ื™ืชืŸ ืœืงืจื•ื ื›ืืŸ.

ื ื™ืชืŸ ื’ื ืœื”ืขื‘ื™ืจ ื‘ืคืจืžื˜ืจ folder ืืช ื”ืกื˜ืจื™ื ื’ hangup, ื•ื›ืš ืœื ืชืง ืืช ื”ืฉื™ื—ื”, ืื• ืœื”ืฉืชืžืฉ ื‘ืงื™ืฆื•ืจ call.hangup().

restart_ext()

ื”ืคืขืœื” ืžื—ื“ืฉ ืฉืœ ื”ืฉืœื•ื—ื” ื”ื ื•ื›ื—ื™ืช.

ืงื™ืฆื•ืจ ืœืชื—ื‘ื™ืจ ื”ื‘ื:

call.go_to_folder(`/${call.ApiExtension}`);

hangup()

ื ื™ืชื•ืง ื”ืฉื™ื—ื”. ืงื™ืฆื•ืจ ืœืชื—ื‘ื™ืจ ื”ื‘ื:

call.go_to_folder('hangup');

id_list_message(messages, options?)

ื‘ืžืชื•ื“ื” ื–ื• ื ื™ืชืŸ ืœื”ืฉืžื™ืข ืœืžืฉืชืžืฉ ื”ื•ื“ืขื” ืื—ืช, ืื• ืžืกืคืจ ื”ื•ื“ืขื•ืช ื‘ืจืฆืฃ.
ื”ืžืชื•ื“ื” ืžืงื‘ืœืช ืžืขืจืš ืฉืœ ื”ื•ื“ืขื•ืช (ืื•ื‘ื™ื™ืงื˜ message) ื•ืžืฉืžื™ืขื” ืื•ืชืŸ ืœืžืฉืชืžืฉ.

โš ๏ธ ืฉื™ื ืœื‘! โš ๏ธ

ืœืื—ืจ ื”ืฉืžืขืช ื”ื”ื•ื“ืขื•ืช, ื”ืฉื™ื—ื” ืชืฆื ืื•ื˜ื•ืžื˜ื™ืช ืžื”ืฉืœื•ื—ื”!

ื‘ืื ืžืขื•ื ื™ื™ื ื™ื ืœืฉืจืฉืจ ืคืขื•ืœื” ื ื•ืกืคืช ืœืื—ืจ ื”ื”ืฉืžืขื”, ืœื“ื•ื’ืžื” ืœื”ืฉืžื™ืข ื”ื•ื“ืขื” ื•ืื– ืœื‘ืฆืข read (ืงื‘ืœืช ื ืชื•ื ื™ื ื ื•ืกืคื™ื), ื™ืฉ ืœื”ื’ื“ื™ืจ ื‘ืืจื’ื•ืžื ื˜ ื”options ืืช prependToNextAction ืœtrue.

routing_yemot(number)

ืžืชื•ื“ื” ืœื”ืขื‘ืจืช ื”ืฉื™ื—ื” ืœืžืขืจื›ืช ืื—ืจืช ื‘ื™ืžื•ืช ื”ืžืฉื™ื— ืœืœื ืขืœื•ืช ื™ื—ื™ื“ื•ืช, ื‘ืืžืฆืขื•ืช "ืจืื•ื˜ื™ื ื’ ื™ืžื•ืช".

ื”ืคื•ื ืงืฆื™ื” ืžืงื‘ืœืช ืืจื’ื•ืžื ื˜ ื™ื—ื™ื“ - ืกื˜ืจื™ื ื’ ืฉืœ ืžืกืคืจ ืžืขืจื›ืช ื‘ื™ืžื•ืช ืœื”ืขื‘ืจืช ื”ืฉื™ื—ื”.

ื ื™ืชืŸ ื’ื ืœื ืชื‘ ืืช ื”ืฉื™ื—ื” ืžืžืขืจื›ืช ื‘ืฉืจืช ื”ืคืจื™ื•ื•ื˜ ืœืžืขืจื›ืช ื‘ืฉืจืช ื”ืจื’ื™ืœ ื•ืœื”ื™ืคืš.

send(data)

ื ื™ืชืŸ ืœื”ืฉืชืžืฉ ื‘ืžืชื•ื“ื” ื–ื• ื›ื“ื™ ืœืฉืœื•ื— ืกื˜ืจื™ื ื’ ื—ื•ืคืฉื™ ืœื—ืœื•ื˜ื™ืŸ, ืœื“ื•ื’ืžื” ืขื‘ื•ืจ ืคื•ื ืงืฆื™ื•ื ืœื™ื•ืช ืฉืขื“ื™ื™ืŸ ืœื ื ืชืžื›ืช ื‘ืกืคืจื™ื™ื”.

ื‘ืžืชื•ื“ื” ื–ื• ื™ืฉ ืœื”ืขื‘ื™ืจ ืืช ื”ืกื˜ืจื™ื ื’ ื‘ื“ื™ื•ืง ื›ืคื™ ืฉืžืขื•ื ื™ื™ื ื™ื ืฉื”ืฉืจืช ืฉืœ ื™ืžื•ืช ื™ืงื‘ืœ ืื•ืชื•, ื•ื”ื•ื ืœื ืขื•ื‘ืจ ื•ืœื™ื“ืฆื™ื” ืื• ืขื™ื‘ื•ื“.

ื›ื“ื™ ืœื”ืฉืชืžืฉ ืœื‘ืงืฉืช ืžื™ื“ืข - ืœื“ื•ื’ืžื” ืžืขื‘ืจ ืœืกืœื™ืงืช ืืฉืจืื™, ื™ืฉ ืœืฉืœื‘ ืขื ืงืจื™ืื•ืช ืœ

await call.blockRunningUntilNextRequest();

values

ืžื›ื™ืœ ืืช ื›ืœ ื”ืคืจืžื˜ืจื™ื ืฉื ืฉืœื—ื• ืžื™ืžื•ืช -

ืื ื”ื‘ืงืฉื” ื ืฉืœื—ื” ื‘-โ€ซHTTP GET, ื™ื›ื™ืœ ืืช ื”โ€ซquery string,

ืื ื”ื‘ืงืฉื” ื ืฉืœื—ื” ื‘-โ€ซHTTP POST โ€ซ(api_url_post=yes), ื™ื›ื™ืœ ืืช ื”โ€ซbody

ืื•ื‘ื™ื™ืงื˜ message

ื›ืœ ืื•ื‘ื™ื™ืงื˜ ื”ื•ื“ืขื” ืฆืจื™ืš ืœื”ื™ื•ืช ื‘ืžื‘ื ื” ื”ื‘ื:

{ type: string, data: string }

ื›ืืฉืจ type ื”ื•ื ืกื•ื’ ื”ื•ื“ืขื” ืžืชื•ืš ื”ื˜ื‘ืœื” ืฉืœื”ืœืŸ, ื•data ื”ื•ื ื”ืžื™ื“ืข ืขืฆืžื• - string,
ืžืœื‘ื“ ื›ืืฉืจ ื”type ื”ื•ื zmanim/music_on_hold, ืฉืื– ื”data ื™ื”ื™ื” ืื•ื‘ื™ื™ืงื˜ - ืžืคื•ืจื˜ ืžืชื—ืช ืœื˜ื‘ืœื”:

ืกื•ื’ื™ ื”ื•ื“ืขื•ืช ื ืชืžื›ื™ื:

ืกื•ื’ ืชื™ืื•ืจ ืžืงื•ืฆืจ ื“ื•ื’ืžื” ื”ืขืจื•ืช
text ื”ืงืจืืช ื˜ืงืกื˜ ื“ื•ื’ืžื” ืœื˜ืงืกื˜ ื“ื•ื’ืžื” ืฉื™ื ืœื‘ ืœืื–ื”ืจื” ืžืชื—ืช ืœื˜ื‘ืœื” ืœื’ื‘ื™ ืชื•ื•ื™ื ืฉืœื ื ื™ืชืŸ ืœื”ืงืจื™ื
file ื”ืฉืžืขืช ืงื•ื‘ืฅ ืื•ื“ื™ื• /1/002, ื ื™ืชืŸ ืœื›ืชื•ื‘ ืจืง ืืช ืฉื ื”ืงื•ื‘ืฅ 002 ืื ื”ืงื•ื‘ืฅ ื ืžืฆื ื‘ืชืงื™ื™ื” ื”ื ื•ื›ื—ื™ืช ืื™ืŸ ืœื›ืชื•ื‘ ืกื™ื•ืžืช ืงื•ื‘ืฅ. ื ื™ืชืŸ ืœื”ืฉืžื™ืข ืžืžืื’ืจ ื’ืœื•ื‘ืœื™.
speech ื”ืงืจืื” ืื•ื˜ื•ืžื˜ื™ืช ืฉืœ ืงื•ื‘ืฅ TTS ื ืชื™ื‘ ืœืงื•ื‘ืฅ TTS ืื• ืฉื ืงื•ื‘ืฅ TTS ื‘ืชืงื™ื” ื”ื ื•ื›ื—ื™ืช ืœืœื ื”ืกื™ื•ืžืช
digits ื”ืฉืžืขืช ืกืคืจื•ืช 105 - ื™ืฉืžื™ืข "ืื—ืช ืืคืก ื—ืžืฉ" ืฉื™ืžื•ืฉื™ ื‘ืขื™ืงืจ ืœื”ืงืจืืช ืžืกืคืจ ื˜ืœืคื•ืŸ
number ื”ืฉืžืขืช ืžืกืคืจ 105 - ื™ืฉืžื™ืข "ืžืื” ื•ื—ืžืฉ" -
alpha ื”ืฉืžืขืช ืื•ืชื™ื•ืช ื‘ืื ื’ืœื™ืช abc, ื™ืฉืžื™ืข "ืื™ื™, ื‘ื™, ืกื™" ืœื ืชื•ืžืš ื‘ืขื‘ืจื™ืช
zmanim ื”ืฉืžืขืช ืฉืขื” ืื•ื‘ื™ื™ืงื˜. ืคื™ืจื•ื˜ ื‘ื ืคืจื“ ๐Ÿ‘‡ -
system_message ื”ืฉืžืขืช ื”ื•ื“ืขืช ืžืขืจื›ืช M1005 ืื• 1005 ืจืฉื™ืžืช ื”ื•ื“ืขื•ืช ื”ืžืขืจื›ืช
music_on_hold ื”ืฉืžืขืช ืžื•ื–ื™ืงื” ื‘ื”ืžืชื ื” { musicName: 'ztomao', maxSec: 10 } ื”ืคืจืžื•ืจ maxSec ืจืฉื•ืช. ืจืื” ื›ืืŸ ืกื•ื’ื™ ืžื•ื–ื™ืงื” ื–ืžื™ื ื™ื ื•ื”ื•ืจืื•ืช ืœื™ืฆื™ืจืช ื—ื“ืฉ.
date ื”ืฉืžืขืช ืชืืจื™ืš ืขื‘ืจื™ ืคื•ืจืžื˜ DD/MM/YYYY - 28/07/2022 -
dateH ื”ืฉืžืขืช ืชืืจื™ืš ืœื•ืขื–ื™ ืคื•ืจืžื˜ ืชืืจื™ืš ืœื•ืขื–ื™ DD/MM/YYYY, ื™ืฉืžื™ืข ืืช ื”ืชืืจื™ืš ื”ืขื‘ืจื™ ื”ืžืชืื™ื -
go_to_folder ื ืชื™ื‘ ื™ื—ืกื™ ืœืฉืœื•ื—ื” ื”ื ื•ื›ื—ื™ืช ืื• ืœืฉืœื•ื—ื” ื”ืจืืฉื™ืช, ืจืื” ื›ืืŸ ื”ืขื‘ืจืช ื”ืฉื™ื—ื” ืœืฉืœื•ื—ื” ืื—ืจืช ืœื ืžื•ืžืœืฅ, ืขื“ื™ืฃ ืœื”ืฉืชืžืฉ ื‘ call.go_to_folder. ืœื ื ื™ืชืŸ ืœืฉืจืฉืจ ื”ื•ื“ืขื•ืช ื ื•ืกืคื•ืช ืœืื—ืจ ืกื•ื’ ื–ื”.

ืชื•ื•ื™ื ืœื ื—ื•ืงื™ื™ื ื‘ื”ืงืจืืช ื˜ืงืกื˜

โš ๏ธ ืฉื™ืžื• ืœื‘! โš ๏ธ

ืœื ื ื™ืชืŸ ืœื”ื—ื–ื™ืจ ืœื™ืžื•ืช ืืช ื”ืชื•ื™ื:

ื ืงื•ื“ื”,ืžืงืฃ,ื’ืจืฉ,ื’ืจืฉื™ื™ื,&

ื”ืขื‘ืจืช ืื—ื“ ืžื”ืชื•ื™ื ื”ื "ืœ ื™ื’ืจื•ื ืœื–ืจื™ืงืช ืฉื’ื™ืื”, ืืœื ืื ื›ืŸ ื ืืคืฉืจ ื”ืกืจืช ืชื•ื•ื™ื ืœื ื—ื•ืงื™ื™ื ืฉืงื˜ื”:

ื›ืืฉืจ ืžืขื‘ื™ืจื™ื ื˜ืงืกื˜ ืœื”ืงืจืื” ('type: 'text) ื ื™ืชืŸ ืœื”ื’ื“ื™ืจ ื”ืกืจื” ืฉืœ ืชื•ื•ื™ื ืœื ื—ื•ืงื™ื™ื, ื›ืœื•ืžืจ ืฉื‘ืžืงื•ื ืœื–ืจื•ืง ืฉื’ื™ืื” ื”ื ืคืฉื•ื˜ ื™ื•ืกืจื• ืžื”ืชืฉื•ื‘ื” ืฉืชื•ื—ื–ืจ ืœื™ืžื•ืช.

ื”ื”ื’ื“ืจื” ื”ื™ื removeInvalidChars, ืื•ืชื” ื ื™ืชืŸ ืœื”ื’ื“ื™ืจ ื‘ืฉืชื™ ืจืžื•ืช, ื‘ืจืžืช ื”ื•ื“ืขื” ื‘ื•ื“ื“ืช, ืื• ื‘ืจืžืช ื›ืœ ื”read/id_list_message.

ื“ื•ื’ืžืื•ืช:

  • ื‘ืจืžืช ื”ื”ื•ื“ืขื” ื”ืžืกื•ื™ืžืช - ื”ืขื‘ืจืช ื”ืคืจืžื˜ืจ removeInvalidChars ื‘ืื•ื‘ื™ื™ืงื˜ ื”ื”ื•ื“ืขื”:
{
  type: "text",
  data: "ื˜ืงืกื˜. ื‘ืขื™ื™ืชื™.",
  removeInvalidChars: true
}
  • ื‘ืจืžืช ื›ืœ ื”read/id_list_message - ื”ืขื‘ืจืช ื”ืคืจืžื˜ืจ removeInvalidChars ื‘ืื•ื‘ื™ื™ืงื˜ ื”ืืคืฉืจื•ื™ื•ืช.

ื“ื•ื’ืžื” ืœread:

const resp = await call.read(messagesWidthInvalidChars, 'tap', { removeInvalidChars: true });

ื“ื•ื’ืžื” ืœid_list_message:

call.id_list_message(messagesWidthInvalidChars, { removeInvalidChars: true });

ืžื‘ื ื” ื”data ื‘zmanim

{
    time: string, // optional, default: "T" (current time)
    zone: string, // optional, default: "IL/Jerusalem",
    difference: string // optional, default: 0
};

ื”ืขืจืš time

ืกื•ื’ ื”ื–ืžืŸ ืฉืจื•ืฆื™ื ืœื”ืฉืžื™ืข.

ื‘ืจื™ืจืช ืžื—ื“ืœ: "T" = ื”ืฉืขื” ื”ื ื•ื›ื—ื™ืช. ื”ืฉืžืขืช ืฉืขื” - THH:MM, ืื• ื–ืžืŸ ื”ืœื›ืชื™ - ื ื™ืชืŸ ืœืจืื•ืช ื›ืืŸ ืืช ืจืฉื™ืžืช ื”ื–ืžื ื™ื ืฉื ื™ืชืŸ ืœื—ืฉื‘ ืžื”ื ื–ืžืŸ.

ื”ืขืจืš zone

ืื–ื•ืจ ื”ื–ืžืŸ ืฉืขื‘ื•ืจื• ื™ืฉ ืœื—ืฉื‘ ืืช ื”ื–ืžื ื™ื.

ื‘ืจื™ืจืช ืžื—ื“ืœ: IL/Jerusalem.

ื ื™ืชืŸ ืœืจืื•ืช ื›ืืŸ ืืช ืจืฉื™ืžืช ืื–ื•ืจื™ ื”ื–ืžืŸ ื”ืงื™ื™ืžื™ื ื‘ืžืขืจื›ืช.

ื”ืขืจืš difference

ืขืจืš ื–ื” ืžืฉืžืฉ ืœื”ื•ืกืคื”/ื”ืกืจื” ืžืœืื›ื•ืชื™ืช ืฉืœ ื–ืžืŸ ืขืœ ื”ื–ืžืŸ ืฉืžืฉืžื™ืขื™ื.

ื‘ืื ืœื ื™ื•ืขื‘ืจ ืคืจืžื˜ืจ ื–ื”, ื™ื•ืฉืžืข ื”ื–ืžืŸ ืœืœื ืฉื™ื ื•ื™.

ื”ืขืจืš difference ืžื›ื™ืœ ืงื•ื“ื ืืช ืกื•ื’ ื”ืคืขื•ืœื” - ืคืœื•ืก (+) ืœื”ื•ืกืคืช ื–ืžืŸ, ืื• ืžื™ื ื•ืก (-) ืœื”ืคื—ืชืช ื–ืžืŸ, ื•ืื– ืืช ื”ื–ืžืŸ ืขืœ ืคื™ ื”ืฆื•ืจื” ื”ื‘ืื”: Y - ืฉื ื” M - ื—ื•ื“ืฉ D - ื™ื•ื H - ืฉืขื” m - ื“ืงื” S - ืฉื ื™ื” s - ืืœืคื™ืช ืฉื ื™ื” ืœืžืฉืœ, ืขื‘ื•ืจ 20 ื“ืงื•ืช ืื—ื•ืจื” ื™ืฉ ืœื”ื’ื“ื™ืจ m20-, ืขื‘ื•ืจ 3 ืฉืขื•ืช ืงื“ื™ืžื” ื™ืฉ ืœืจืฉื•ื H3+. ืขื‘ื•ืจ ื™ื•ืžื™ื™ื ืื—ื•ืจื” ื™ืฉ ืœืจืฉื•ื D1-.

ืœื“ื•ื’ืžื”, ืขื‘ื•ืจ ื”ืฉืžืขืช ื–ืžืŸ ืฉืงื™ืขืช ื”ื—ืžื” ืžื—ืจ ื‘ืขื™ืจ ื‘ื ื™ ื‘ืจืง:

const messages = [{
    type: 'zmanim',
    data: {
        time: 'sunset',
        zone: 'IL/Bney_Brak',
        difference: '+1D'
    }
}];

ืžื‘ื ื” ื”data ื‘-music_on_hold

{
    musicName: string,
    maxSec: number // optional
};

ื›ืืŸ ืกื•ื’ื™ ืžื•ื–ื™ืงื” ื–ืžื™ื ื™ื ื•ื”ื•ืจืื•ืช ืœื™ืฆื™ืจืช ื—ื“ืฉื”.

ื‘ืจื™ืจื•ืช ืžื—ื“ืœ


ืฉื™ืžื• ืœื‘:

ืืคืฉืจื•ืช ื–ื• ื–ืžื™ื ื” ื‘ื’ืจืกื” 6.0 ื•ืžืขืœื”

ืืคืฉืจื•ืช ื–ื• ื”ื™ื ื” ืื•ืคืฆื™ื•ื ืœื™ืช ืœื—ืœื•ื˜ื™ืŸ, ื ื™ืชืŸ ืœื”ืžืฉื™ืš ืœื”ืขื‘ื™ืจ ืื•ื‘ื™ื™ืงื˜ ืืคืฉืจื•ื™ื•ืช ื‘ื›ืœ read/id_list_message ื›ืžื• ืงื•ื“ื


ื ื™ืชืŸ ืœื”ื’ื“ื™ืจ ื‘ืจื™ืจื•ืช ืžื—ื“ืœ ื‘ื“ืจื›ื™ื ื”ื‘ืื•ืช:

  • ื‘ืจื™ืจื•ืช ืžื—ื“ืœ ืฉืœ ื”ืžืขืจื›ืช - ืฉื”ืŸ ื›ืžื• ื‘ืจื™ืจื•ืช ื”ืžื—ื“ืœ ืฉืœ ื™ืžื•ืช (defaults.js)
  • ืจืžืช ืจืื•ื˜ืจ
  • ืจืžืช ืฉื™ื—ื”
  • ืกืคืฆื™ืคื™ืช ืœืงืจื™ืืช read/id_list_message ืžืกื•ื™ื™ืžืช

ื”ืืคืฉืจื•ื™ื•ืช ื™ืžื•ื–ื’ื• ืขื ืกื“ืจ ืงื“ื™ืžื•ื™ื•ืช. ื”ืกื“ืจ ื”ื•ื: ื‘ืจื™ืจื•ืช ื”ืžื—ื“ืœ ืฉืœ ื”ืกืคืจื™ื™ื” ืฉื ืžืฆืืช ื‘- lib/defaults.js, ื‘ืจืžืช ืžื•ืคืข ืจืื•ื˜ืจ, ื‘ืจืžืช ืžื•ืคืข ืฉื™ื—ื”, ื‘ืจืžืช ืงืจื™ืื” ืกืคืฆื™ืคื™ืช.

ื›ืœ ืืคืฉืจื•ืช ืžืงื‘ืœืช ืงื“ื™ืžื•ืช ื•ื“ื•ืจืกืช ืืช ื–ื• ืฉืœืคื ื™ื”.

ื“ื•ื’ืžื”:

const router = YemotRouter({
    printLog: true,
    defaults: {
        removeInvalidChars: true,
        read: {
            timeout: 30000
        }
    }
});

// ืืคืฉืจ ื’ื ื›ืš:
// router.defaults.read.timeout = 30000;

router.get('/', async (call) => {
    // ื”timeout ื™ื”ื™ื” 30 ืฉื ื™ื•ืช
    await call.read([{ type: 'text', data: 'ื”ื™ื™, ืชืงื™ืฉ 1' }], 'tap', {
        max_digits: 1,
        digits_allowed: [1]
    });

    // ื”timeout ื™ื”ื™ื” 40 ืฉื ื™ื•ืช
    call.defaults.read.timeout = 40000;
    await call.read([{ type: 'text', data: 'ื”ื™ื™, ืชืงื™ืฉ 1' }], 'tap', {
        max_digits: 1,
        digits_allowed: [1]
    });

    // ื”timeout ื™ื”ื™ื” 60 ืฉื ื™ื•ืช
    await call.read([{ type: 'text', data: 'ื”ื™ื™, ืชืงื™ืฉ 1' }], 'tap', {
        max_digits: 1,
        digits_allowed: [1],
        timeout: 60000
    });
});

ื‘ื“ื•ื’ืžื” ืžืืชื—ืœื™ื ืืช ื”ืจืื•ื˜ืจ ืขื ื”ื’ื“ืจื” ืฉืœ timeout ืฉืœ 1000 ืฉื ื™ื•ืช, ืœืื—ืจ ืžื›ืŸ ื‘ืชื•ืš ื”ืฉื™ื—ื” ืžืฉื ื™ื ืื•ืชื• ืœ2000, ื•ืœืื—ืจ ืžื›ืŸ ืžื‘ืฆืขื™ื ืงืจื™ืื” ื‘ื•ื“ื“ืช ืขื ืื•ื‘ื™ื™ืงื˜ ืื•ืคืฆื™ื•ืช ืขื timeout ืฉืœ 3000, ื•ื”ื•ื ื’ื•ื‘ืจ ืขืœ ื”ื”ื’ื“ืจื•ืช ื”ืงื•ื“ืžื•ืช ืฉื”ื™ื• ื‘ืจืžื” ื™ื•ืชืจ ื’ื‘ื•ื”ื”.

ืฉื™ืžื• ืœื‘! ื ื™ืชืŸ ืœื”ื’ื“ื™ืจ ืืช ื”ืื•ืคืฆื™ื•ืช ื”ื‘ืื•ืช ื‘ืจืžืช ืงืจื™ืื” ื‘ื•ื“ื“ืช ื‘ืœื‘ื“ ื•ืœื ื‘ืจืžืช ืฉื™ื—ื”/ืจืื•ื˜ืจ:

  • val_name (read)
  • prependToNextAction (id_list_message)

Events

ื ื™ืชืŸ ืœื”ืื–ื™ืŸ ืœืื™ืจื•ืขื™ื ื‘ืจืžืช ืจืื•ื˜ืจ ืขืœ ื™ื“ื™ ื”ืื–ื ื” ืœrouter.events:

  • new_call - ื›ืืฉืจ ืฉื™ื—ื” ื—ื“ืฉื” ื ื›ื ืกืช ืœืžืขืจื›ืช
  • call_continue - ื”ืชืงื‘ืœื” ืชืฉื•ื‘ื” ืœืงืจื™ืืช read
  • call_hangup - โ€ซื›ืืฉืจ ืฉื™ื—ื” ืžื ื•ืชืงืช ืขืœ ื™ื“ื™ ื”ืžื—ื™ื™ื’ (ื”ืชืงื‘ืœื” ื‘ืงืฉื” ืขื hangup=yes)

ืฉื™ืžื•ืฉื™ ืœื“ื•ื’ืžื” ื›ื“ื™ ืœื˜ืคืœ ื‘ืงืจื™ืื•ืช ืขื hangup=yes ื’ื ืžื—ื•ืฅ ืœืฉืœื•ื—ื”.

TypeScript

ื”ืขืจื•ืช ืœืฉื™ืžื•ืฉ ื‘ืกืคืจื™ื” ืขื ื˜ื™ื™ืคืกืงืจื™ืคื˜:

โ€app.use(router)

ื‘ืฉื™ืžื•ืฉ ื‘ืจืื•ื˜ืจ ืขื ืืงืกืคืจืก -

const router = YemotRouter()
app.use(router)

ืชื•ืฆื’ ืฉื’ื™ืืช ื˜ื™ื™ืค. ื”ืคื™ืชืจื•ืŸ ื›ืจื’ืข:

const { Router } = require('express')
const router = YemotRouter()
app.use(router.asExpressRouter)

ื”ื’ื“ืจืช โ€empty_val ืฉืื™ื ื• ืžืกื•ื’ string

ื›ืจื’ืข ื”DTS ืœื ืžื•ื’ื“ืจ ืœื”ืกื™ืง ืืช ื”ื˜ื™ื™ืค ืื•ื˜ื•ืžื˜ื™ืช, ื•ื™ืฉ ืœื”ื’ื“ื™ืจ ืื•ืชื• ื™ื“ื ื™ืช ืขื as, ื“ื•ื’ืžื”:

const res = await call.read([{ type: 'text', data: 'please type one' }], 'tap', {
    allow_empty: true,
    empty_val: null,
}) as string | null;

ื ืกืคื—: ืžืงืจื™ ืงืฆื” - ืœืžื ื•ืกื™ื ื‘ืฉื™ืžื•ืฉ ื‘ืกืคืจื™ื”

ื”ืจืฆืช ืงื•ื“ ืœืื—ืจ ื”ื—ื–ืจืช ืชืฉื•ื‘ื” ืœืžื—ื™ื™ื’

โš ๏ธ ืฉื™ืžื• ืœื‘ - ืงื˜ืข ื–ื” ืžื•ืจื›ื‘ ืžืขื˜ ืœื”ื‘ื ื”, ื•ื ืฆืจืš ืจืง ืื ืžืขื•ื ื™ื™ื ื™ื ืœื”ื—ื–ื™ืจ ืชืฉื•ื‘ื” ืœืžื—ื™ื™ื‘ ื•ืœืชืช ืœื• ืœืฆืืช ืžื”ืฉืœื•ื—ื” (id_list_message), ื•ืœืื—ืจ ืžื›ืŸ ืœื”ืจื™ืฅ ืงื•ื“ "ื›ื‘ื“", ื•ืœื ื ืฆืจื›ืช ืื ื ื•ืชื ื™ื ืœืžืื–ื™ืŸ ืœื”ืžืชื™ืŸ ืœืื™ืฉื•ืจ ื‘ื™ืฆื•ืข ื”ืคืขื•ืœื” (ื‘ืืžืฆืขื•ืช read).

ื‘ืขืช ื”ื—ื–ืจืช ืชืฉื•ื‘ื” ืฉืื™ื ื” read ื•ืœื ื’ื•ืจืžืช ืœืฉืจืช ืฉืœ ื™ืžื•ืช ืœื—ื–ื•ืจ ืœืจืื•ื˜ืจ - id_list_message ืื• go_to_folder, ื ื–ืจืงืช ืฉื’ื™ืื” ืขืœ ื™ื“ื™ ื”ืกืคืจื™ื” - ืฉืชื•ืคืกืช ืื•ืชื” ื‘ื—ื–ืจื” ื‘ืจืžื” ื™ื•ืชืจ ื’ื‘ื•ื”ื”, ื•ื›ืš ืจื™ืฆืช ื”ืคื•ื ืงืฆื™ื” ื ื”ืจื’ืช ื›ื“ื™ ืœื—ืกื•ืš ื‘ื–ื™ื›ืจื•ืŸ ื•ื›ืŸ ืœื ืงื•ืช ืืช ื”ืฉื™ื—ื” ืžื”activeCalls - ื›ื“ื™ ืฉื‘ื›ื ื™ืกื” ื—ื•ื–ืจืช ืœืฉืœื•ื—ื” ื”ืคื•ื ืงืฆื™ื” ืชืจื•ืฅ ืžื”ื”ืชื—ืœื” ื•ืœื ืชืžืฉื™ืš.

ืœื›ืŸ ืื ืžื ืกื™ื ืœื”ื—ื–ื™ืจ ืชืฉื•ื‘ื” ืœืžืฉืชืžืฉ ื•ืœืื—ืจ ืžื›ืŸ ืœื”ืจื™ืฅ ืืช ื”ืงื•ื“ ื”"ื›ื‘ื“" ื›ืžื• ืฉืขื•ืฉื™ื ื‘ืฉืจืช nodejs + express ืจื’ื™ืœ, ืœื“ื•ื’ืžื”:

function runBigJob(req, res) {
    res.status(202).send('ok, we got your request, we will send you an email when the job is done')
    doBigJob()
}

ืื• ื‘ืžืงืจื” ืฉืœ ื”ืจืื•ื˜ืจ - ืงื•ื“ (ืฉื’ื•ื™) ื›ื–ื”:

async function runBigJob(call) {
    call.id_list_message([{
        type: 'text',
        data: 'ื‘ืกื“ืจ, ื‘ืงืฉืชืš ืชื˜ื•ืคืœ ื‘ื”ืงื“ื'
    }])
    await doBigJob()
}

ืงื•ื“ ื›ื–ื” ืœื ื™ืขื‘ื•ื“ ื›ื™ื•ื•ืŸ ืฉื”ืงืจื™ืื” ืœcall.id_list_messsage ื–ื•ืจืงืช ืฉื’ื™ืื” ืฉื”ื•ืจื’ืช ืืช ืจื™ืฆืช ื”ืคื•ื ืงืฆื™ื”, ื•ืœื›ืŸ ื”ืงื•ื“ ืฉืœืื—ืจื™ื” ืœื ื™ืจื•ืฅ.

ื›ื“ื™ ืœื”ืจื™ืฅ ืงื•ื“ ืœืื—ืจ ื”ื—ื–ืจืช ื”ืชืฉื•ื‘ื”, ื™ืฉ ืœืชืคื•ืก ืืช ื”ืฉื’ื™ืื” ืฉื ื–ืจืงืช (ื‘ืžืงืจื” ืฉื”ื™ื ืฉื’ื™ืืช ExitError ืคื ื™ืžื™ืช ื›ื "ืœ):

import { ExitError } from 'yemot-router2';
async function runBigJob (call) {
    try {
        call.id_list_message([{
            type: 'text',
            data: 'ื‘ืกื“ืจ, ื‘ืงืฉืชืš ืชื˜ื•ืคืœ ื‘ื”ืงื“ื'
        }]);
    } catch (error) {
        if (error.isExitError) return;
        throw error;
    };
    await doBigJob();
}

ืžื—ื™ืงื” ื™ื“ื ื™ืช ืฉืœ ื”ืฉื™ื—ื” ืžื”activeCalls

ืื™ืŸ ืฆื•ืจืš ืœื–ืจื•ืง ื™ื“ื ื™ืช ืืช ExitError ื›ื“ื™ ืœืžื—ื•ืง ืืช ื”ืฉื™ื—ื” ืžื”activeCalls, ื›ื™ื•ื•ืŸ ืฉื”ื™ื ื ืžื—ืงืช ืื•ื˜ื•ืžื˜ื™ืช ืขืœ ื™ื“ื™ ื”ืกืคืจื™ื” ื‘ืกื™ื•ื ื”ืจื™ืฆื” ืฉืœ ื”ืคื•ื ืงืฆื™ื”.
ืขื ื–ืืช, ื‘ืื ื”ืงื•ื“ ื”ื ื•ืกืฃ ื”ืžื•ืจืฅ ืืžื•ืจ ืœืงื—ืช ื–ืžืŸ, ืžื•ืžืœืฅ ืœื ืงื•ืช ื™ื“ื ื™ืช ื‘ืื•ืคืŸ ืžื™ื™ื“ื™ (ืžื™ื™ื“ ืœืื—ืจ ื”ื—ื–ืจืช ื”ืชืฉื•ื‘ื” ื‘id_list_message) ืืช ื”ืฉื™ื—ื” ืžื”activeCalls - ืื—ืจืช ืœื ื™ื”ื™ื” ื ื™ืชืŸ ืœื”ื™ื›ื ืก ืœืฉืœื•ื—ื” ืขื“ ืœืกื™ื•ื ื‘ื™ืฆื•ืข ื”ืคืขื•ืœื” ื”ื›ื‘ื“ื”:

const router = YemotRouter({ printLog: true });
router.get('/', async (call) => {
    try {
        call.id_list_message([{
            type: 'text',
            data: 'ื‘ืกื“ืจ, ื‘ืงืฉืชืš ืชื˜ื•ืคืœ ื‘ื”ืงื“ื'
        }]);
    } catch (error) {
        if (error.isExitError) return;
        throw error;
    };
    router.deleteCall(call.callId);
    await doBigJob();
});

ื“ืจืš ื ื•ืกืคืช ืœื”ืจืฆืช ืงื•ื“ ื›ื‘ื“

ืื•ืคืฆื™ื” ื ื•ืกืคืช ื”ื™ื ืœื”ืจื™ืฅ ืืช ื”ืงื•ื“ ื‘ืฆื•ืจื” ืžื ื•ืชืงืช ืžื”ืคื•ื ืงืฆื™ื”, ื›ืœื•ืžืจ ืงืจื™ืื” ืœืงื•ื“ ื”"ื›ื‘ื“" ื‘ืชื•ืš ืคื•ื ืงืฆื™ื™ื” ืื ื•ื ื™ืžื™ืช ืœืคื ื™ ื”ื—ื–ืจืช ื”ืชืฉื•ื‘ื”:

(() => {
    await doBigJob();
})();
call.id_list_message(...);