For outbound go to advanced > default settings, click the add button on top, category = sms, subcategory = carriers, type = array, value = bulkvs
Add another one, category = sms, subcategory = bulkvs_api_url, type = text, value =
https://portal.bulkvs.com/api/v1.0/messageSend
Add another one, category = sms, subcategory = bulkvs_secret_key, type = text, value = Your Basic Auth Header, which you can find under API tab in your portal.
Add another one, category = sms, subcategory = bulkvs_delivery_status_webhook_url, type = text, value = https://
The last one isn't really needed, i just kept on getting errors when i was trying to avoid it so i left it and just enter https.....
Go to /etc/freeswitch/chatplan/default.xml, It should look like the following, I made it to send a auto reply if the device is not registered, you don't need that.
Code:
<?xml version="1.0" encoding="utf-8"?>
<include>
<context name="default">
<extension name="demo">
<condition field="to" expression="^(.*)$">
<!-- <action application="lua" data="test.lua"/> -->
<!-- <action application="reply" data="Hello, you said: ${_body}"/> -->
</condition>
</extension>
</context>
<context name="public">
<extension name="ten-digit">
<condition field="to" expression="^(\d{10}.*)$">
<action application="set" data="final_delivery=true"/>
<action application="lua" data="app.lua sms outbound"/>
</condition>
</extension>
<extension name="other">
<condition field="${sofia_contact(profile/${to})}" expression="error\/user_not_registered">
<action application="set" data="final_delivery=true"/>
<action application="reply" data="User is not registered, Please try again later"/>
</condition>
<condition field="to" expression="^(.*)$">
<action application="set" data="final_delivery=true"/>
<action application="send"/>
</condition>
</extension>
</context>
</include>
Go to /usr/share/freeswitch/scripts/app/sms/index.lua, somewhere around line 400 you'll find if statements for all the carriers that come by default, add the following elseif statements between the other carriers:
Code:
elseif (carrier == "bulkvs") then
if to:len() < 11 then
to = "1" .. to;
end
if outbound_caller_id_number:len() < 11 then
outbound_caller_id_number = "1" .. outbound_caller_id_number;
end
cmd ="curl -X POST \"" .. api_url .."\" -H \"accept: application/json\" -H \"Content-Type: application/json\" -H \"Authorization: Basic " .. secret_key .. "\" -d '{\"From\": \"" .. outbound_caller_id_number .. "\", \"To\":[ \"" .. to .. "\"], \"Message\": \"" .. body .. "\", \"delivery_status_webhook_url\": \"" .. delivery_status_webhook_url .. "\"}'";
It isn't the best code, but it does the job for me, so i thought I'll put it out here, hopefully it'll help someone.