V
V
Vitaly Gusev2020-06-18 11:00:24
MySQL
Vitaly Gusev, 2020-06-18 11:00:24

Why doesn't MYSQL partially work from the dial plan in asterisk?

Good afternoon!

There is a defined context:
exten => _XXXXXX,1,NoOp(${CALLERID(all)})
same => n,MYSQL(Connect connid localhost MEGAUSER SUPER SECRETPASSWORD asterisk)
same => n,MYSQL(Query resultid ${connid} SELECT channelname FROM union WHERE codeid = '${EXTEN:0:2}' AND minnum <= '${EXTEN:2}' AND maxnum >= '${EXTEN:2}')
same => n,MYSQL(Fetch fetchid $ {resultid} SATCHAN)
same => n,MYSQL(Clear ${resultid})
same => n,MYSQL(Query resultid ${connid} SELECT selfcode FROM union WHERE channelname = '${SATCHAN}')
same => n, MYSQL(Fetch fetchid ${resultid} SELFCODE)
same => n,MYSQL(Clear ${resultid})
same => n,
same => n,MYSQL(Fetch fetchid ${resultid} RECUP)
same => n,MYSQL(Clear ${resultid})
same => n,MYSQL(Query resultid ${connid} SELECT callerid FROM sip WHERE name = '$ {CALLERID(num)}')
same => n,MYSQL(Fetch fetchid ${resultid} RUSNAME)
same => n,MYSQL(Clear ${resultid})
same => n,MYSQL(Disconnect ${connid})
same => n,NoOp(${SATCHAN})
same => n,NoOp(${SELFCODE})
same => n,NoOp(${RECUP})
same => n,NoOp(${RUSNAME})
same => n,Set(CALLERID(all)=${RUSNAME})
same => n,Set(CALLERID(num)=${SELFCODE}${CALLERID{num}})
same => n,GotoIf($["${ RECUP}" = "1"]?startrec:recoff)
same => n(startrec),Set(CALLFILENAME=${UNIQUEID}_${EPOCH})
same => n,Set(CDR(userfield)=recfil/${CALLFILENAME}.gsm)
same => n,MixMonitor(/records/recfil/${CALLFILENAME}.gsm)
same => n(recoff),Dial( SIP/${SATCHAN}/${EXTEN:2})
same => n,StopMonitor
same => n,Hangup()

In this code block, two MySQL database queries to the union table are not processed. At the same time, requests are checked through phpmyadmin and they work fine there. And the following two queries to the sip table work fine. The union table 100% exists, the field names have already been checked 100 times, but to hell (((

Please, poke my nose into the error !!!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2020-06-18
@guvijur

UNION is one of the MySQL keywords. To be used as a table or field name, it must be enclosed in backticks (`).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question