Any idea ? whay SELECT is breaking the line to (New STack), I need to use email variable in the mail-s string but due to this I cannot use it, same SQL and mail-s works OK from bash.
[service-noti-email-60010]
exten=> s,1,Noop( checking the callerid ${CALLERID(num)})
same=>n,Set(email=${SHELL(mysql -sN customerinfo -u admin -pPASSWORD -h IPADDRESS -e ‘select email from account where phone=’"${CALLERID(num)}"’ ')})
same=> n,TrySystem(echo “Incoming Call - From: ${CALLERID(name)} ${CALLERID(number)} received at ${STRFTIME(${EPOCH},%l:%M:%S %p %Z on %A %B %e)}” | mail -s “Phone - Incoming Call to MailRoom 6108” “${email}”hello@example.com)
Executing [s@service-noti-email-60010:1] NoOp(“PJSIP/1001_1-0000014e”, " checking the callerid 1001") in new stack Executing [s@service-noti-email-60010:2] Set(“PJSIP/1001_1-0000014e”, "email=aamir
– ") in new stack
– Executing [s@service-noti-email-60010:3] TrySystem(“PJSIP/1001_1-0000014e”, "echo ‘Incoming Call - From: Test 1001 received at Sun Aug 15 19:05:50 2021’ | mail -s “Phone - Incoming Call to IT 6108” -r “aamir
– " hello@exampl.net”) in new stack
– Auto fallthrough, channel ‘PJSIP/1001_1-0000014e’ status is ‘UNKNOWN’
phoneCLI>
“in new stack” is part of the log message, not the command; it is not relevant to your problem. Your problem appears to be that you have excess characters at the end of the value of the email variable, probably a linefeed.
While I use short options on commands I type in shell, anything that somebody else may look at (even me, years later) I use the long options to save the ‘next guy’ a trip to the man page.