<div dir="ltr">In browsing through the source to mod_curl, I found an option that allows me to use curl without invoking a shell. I made some minor changes to the script, changing the url to this:<div><br></div><div><div>url = &quot;<a href="https://user:password@api.flowroute.com/v2/messages">https://user:password@api.flowroute.com/v2/messages</a>&quot;</div></div><div><br></div><div>... adding some escaping after the message is composed...</div><div><br></div><div><div>message = message .. &quot;.&quot;</div><div>-- Add JSON string escapes to the message</div><div>message = string.gsub(message, &quot;([\\\&quot;&#39;])&quot;, &quot;\\%1&quot;)</div></div><div><br></div><div>...and using the mod_curl API call to send the text to Flowroute:</div><div><br></div><div><div>api:execute(&quot;curl&quot;, url .. &quot; content-type application/json post &#39;&quot; .. data .. &quot;&#39;&quot;)</div></div><div><br></div><div>Works, easy, efficient.</div><div><br></div><div>-- </div><div>Steve</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 2, 2016 at 3:26 PM, Steven Schoch <span dir="ltr">&lt;<a href="mailto:schoch+freeswitch.org@xwin32.com" target="_blank">schoch+freeswitch.org@xwin32.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>I got it working! The goal was to run a script to inform users via a text message when they get a voicemail.</div><div>This script looks for a &quot;vm-notify-sms&quot; param in the user&#39;s directory information. It sends the text from user&#39;s outbound caller-ID number, which is set in the standard FS configuration. I&#39;m using the SMS API from Flowroute.com.</div><div><br></div><div>--[[ This script is called by configuration in autoload_configs/lua.conf.xml.</div><div>     It is called on a &quot;vm:maintenance&quot; event.</div><div>]]</div><div><br></div><div>-- The following is specifc to the Flowroute SMS API,</div><div>-- documented at <a href="https://developer.flowroute.com/docs/messaging" target="_blank">https://developer.flowroute.com/docs/messaging</a></div><div>url = &quot;<a href="https://api.flowroute.com/v2/messages" target="_blank">https://api.flowroute.com/v2/messages</a>&quot;</div><div>authentication = &quot;user:password&quot;</div><span class=""><div><br></div><div>action = event:getHeader(&quot;VM-Action&quot;)</div><div>if action ~= &quot;leave-message&quot; then return end</div></span><span class=""><div>user = event:getHeader(&quot;VM-User&quot;)</div><div>domain = event:getHeader(&quot;VM-Domain&quot;)</div></span><span class=""><div>caller_id_name = event:getHeader(&quot;VM-Caller-ID-Name&quot;)</div><div>caller_id_number = event:getHeader(&quot;VM-Caller-ID-Number&quot;)</div></span><div>--[[ We don&#39;t care about these:</div><div>file_path = event:getHeader(&quot;VM-File-Path&quot;)</div><div>flags = event:getHeader(&quot;VM-Flags&quot;)</div><div>folder = event:getHeader(&quot;VM-Folder&quot;)</div><span class=""><div>uuid = event:getHeader(&quot;VM-UUID&quot;)</div></span><div>--]]</div><span class=""><div>message_len = event:getHeader(&quot;VM-Message-Len&quot;)</div></span><div>timestamp = event:getHeader(&quot;VM-Timestamp&quot;)</div><div>api = freeswitch.API();</div><div>from = api:execute(&quot;user_data&quot;, user .. &quot;@&quot; .. domain ..  &quot; var outbound_caller_id_number&quot;)</div><div>to = api:execute(&quot;user_data&quot;, user .. &quot;@&quot; .. domain .. &quot; param vm-notify-sms&quot;)</div><div>if to == &quot;&quot; then return end</div><div><br></div><div>if caller_id_name == &#39;&#39;</div><div>        or caller_id_name == &#39;UNKNOWN&#39;</div><div>        or caller_id_name == &#39;UNASSIGNED&#39;</div><div>        or caller_id_name == &#39;WIRELESS CALLER&#39;</div><div>        or caller_id_name == &#39;TOLL FREE CALL&#39;</div><div>        or caller_id_name == &#39;Anonymous&#39;</div><div>        or caller_id_name == &#39;Unavailable&#39;</div><div>        then caller_id_name = nil end</div><div>if caller_id_number == &#39;&#39;</div><div>        then caller_id_number = nil end</div><div>message = &quot;Voicemail &quot;</div><div>if caller_id_name</div><div>        then message = message .. &quot;from &quot; .. caller_id_name .. &quot; (&quot; ..  caller_id_number .. &quot;)&quot;</div><div>        elseif caller_id_number</div><div>        then message = message .. &quot;from &quot; .. caller_id_number end</div><div>message = message .. &quot; at &quot; .. os.date(&quot;%I:%M %p&quot;, timestamp)</div><div>message = message .. &quot; length &quot; .. message_len .. &quot; seconds&quot;</div><div>message = message .. &quot; to box &quot; .. user</div><div>message = message .. &quot;.&quot;</div><div>-- Blindly send the text</div><div>data = &#39;{ &quot;to&quot;: &quot;&#39; .. to .. &#39;&quot;, &quot;from&quot;: &quot;&#39; .. from .. &#39;&quot;, &quot;body&quot;: &quot;&#39; .. message .. &#39;&quot;}&#39;</div><div>--[[</div><div>     Until either Freeswitch has the ability to pass authentication data</div><div>     to the mod_curl API (FS-9223), or the Flowroute API has the ability</div><div>     to take authentication data in the POST body (they are working on it),</div><div>     we are forced to spawn a shell to use the curl from our OS.</div><div>]]</div><div>-- api.execute(&quot;curl&quot;, url .. &quot; auth &quot; .. authentication .. &quot; post &quot; .. data)</div><div>os.execute(&quot;curl -u &quot; .. authentication .. &quot; -H &#39;Content-Type: application/json&#39; -X POST -d &#39;&quot; .. data .. &quot;&#39; &quot;  .. url)</div><div><br></div></div></div></div>
</blockquote></div><br></div>