A
A
akv2017-02-01 14:26:08
PHP
akv, 2017-02-01 14:26:08

How to make asterisk take output from php script and compare for further execution of dial plan?

Good day everyone! I started to deal with asterisk not long ago, the question arose about setting up speech recognition and calling the desired subscriber, there is a php script that works out and returns the name. Example output in cli:

-- Executing [[email protected]:4] AGI("SIP/1001-00000088", "voice.php,/tmp/1485942576.136") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/voice.php
voice.php,/tmp/1485942576.136: иван
-- <SIP/1001-00000088>AGI Script yandex_voice.php completed, returning 0

Tell me how you can make it so that "ivan" is picked up in the dial plan and compares the value and performs an action that corresponds, as I understand it, you need to do it through gotoif, here is an example of a dial plan:
exten=1000,1,Answer()
exten=1000,2,Wait(1)
exten=1000,3,Record(/tmp/${UNIQUEID}.wav,3,20);
exten=1000,4,AGI(voice.php,/tmp/${UNIQUEID})
exten=1000,n,GotoIf($[“${?????????????????}” = “иван”]?6:3)

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
A
akv, 2017-02-05
@akv

exten => s,9,GotoIf($[${TEXT} = Ivan]?11:13))

D
Dmitry Shitskov, 2017-02-01
@Zarom

Have you tried using the AGI set variable function ?

S
silverjoe, 2017-02-02
@silverjoe

Never used AGI
You can do CURL and put the answer in a variable.
Often used system curl calling it via SHELL

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question