-
Notifications
You must be signed in to change notification settings - Fork 0
/
extensions.conf
111 lines (77 loc) · 3.44 KB
/
extensions.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
[OUTBOUND_DIALER]
exten => s,1,NoOp(============ ${CONTEXT} =============)
exten => s,n,Dial(PJSIP/12067044413@piecebyte-pjsip)
[main-menu]
exten => 111,1,NoOp(<---------------- ${CONTEXT} --------------> )
same => n,Background(codesaaz-menu) ; Play codesaaz-menu.wav
same => n,WaitExten()
exten => 1,1,Goto(bot-menu,1,1) ; Go to bot menu
exten => 2,1,Goto(call-menu,1,1) ; Go to call menu
exten => 3,1,Goto(music-menu,1,1) ; Go to music menu
exten => 4,1,Goto(radio-menu,1,1) ; Go to radio menu
[bot-menu]
exten => 1,1,NoOp(<---------------- ${CONTEXT} --------------> )
same => n,GoTo(google-speech,${EXTEN},1) ; Assuming there's a bot interaction here
[call-menu]
exten => 1,1,NoOp(<---------------- ${CONTEXT} --------------> )
same => n,Read(NUMBER_TO_CALL,please-enter-the-number-to-call-like-03457134872,12) ; Read the number from the user and store it in the NUMBER_TO_CALL variable, limited to 11 digits
same => n,Dial(PJSIP/${NUMBER_TO_CALL}@piecebyte-pjsip) ; Dial the number stored in the NUMBER_TO_CALL variable using PJSIP
[music-menu]
exten => 1,1,NoOp(<---------------- ${CONTEXT} --------------> )
same => n,MusicOnHold(default) ; Play music on hold
[radio-menu]
exten => 1,1,NoOp(<---------------- ${CONTEXT} --------------> )
same => n,MusicOnHold(default) ; Play music on hold
[google-speech]
exten => 111,1,NoOp(============ ${CONTEXT} =============)
exten => 111,n,Set(__AGI_SERVER_IP=127.0.0.1)
exten => 111,n,Set(__AGI_SERVER_PORT=9000)
exten => 111,n,Set(__AGI_SERVER=agi://${AGI_SERVER_IP}:${AGI_SERVER_PORT})
exten => 111,n,Set(__SOUND_FOLDER=/var/lib/asterisk/sounds/en)
exten => 111,n,Set(__LANG_CODE=en-GB)
exten => 111,n,Set(__LANG_NAME=en-GB-Wavenet-F)
exten => 111,n,Goto(record-answer,111,1)
exten => h,1,Goto(grace_fully_hangup,s,1)
[record-answer]
exten => 111,1,NoOp(=========== ${CONTEXT} ===========)
exten => 111,n,Set(__RECORDING_FILE_NAME=${EPOCH})
; ADDED THIS LINE
exten => 111,n,Playback(ask_question&interrupt-ai)
exten => 111,n(record),Record(${SOUND_FOLDER}/${RECORDING_FILE_NAME}:wav,8,300)
exten => 111,n,AGI(${AGI_SERVER}/speechToText.agi)
exten => 111,n,Goto(play-prompt,111,1)
exten => h,1,Goto(grace_fully_hangup,s,1)
[play-prompt]
exten => 111,1,NoOp(=========== ${CONTEXT} ===========)
exten => 111,n,AGI(${AGI_SERVER}/textToSpeech.agi)
exten => 111,n,Wait(1)
exten => 111,n,Background(${SOUND_FOLDER}/${ANSWER_FILE})
exten => 111,n,Goto(record-answer,${EXTEN},record)
exten => _X,1,Goto(record-answer,111,record)
exten => h,1,Goto(grace_fully_hangup,s,1)
[grace_fully_hangup]
exten => s,1,NoOp(=========== ${CONTEXT} ===========)
exten => s,n,StopMonitor()
exten => s,n,Hangup
[PIECEBYTE]
exten => _X.,1,NoOp( ____________ ${CONTEXT} _____________ )
;exten => _X.,n,Playback(hello-world)
exten => _X.,n,Background(tt-monkeys)
exten => 1,1,NoOp(${EXTEN})
exten => 1,n,Dial(PJSIP/12067044413@piecebyte-pjsip)
[invoso]
exten => 22,1,NoOp(Handling extension 22)
same => n,Set(__MIN_LENGTH=1)
same => n,Set(__MAX_LENGTH=5)
same => n,Set(__i=${MIN_LENGTH})
same => n,Set(__RETRIES=0)
same => n,While($[${i} >= MIN_LENGTH & ${i} <= MAX_LENGTH])
same => n,Read(CARD_NO,please-enter-your-digit,1)
same => n,Wait(2)
same => n,Set(i=${i}+1)
same => n,EndWhile()
same => n,Set(RETRIES=${RETRIES}+1)
same => n,GotoIf($[${LEN(CARD_NO)}>${MIN_LENGTH} & ${LEN(CARD_NO)} = ${MAX_LENGTH} & ${RETRIES} < 3]?play-success:retry)
same => n(play-success),Playback(hello-world)
same => n,Hangup()
same => n(retry),Goto(invoso,${EXTEN},1)