I am using FusionPBX as SIP server(registar). FusionPBX works fine for call and SIMPLE message routing, but I need to modify it so that I can send SIP/SIMPLE messages to registered users from FusionPBX.
I found on freeswitch docs site that it can be achieved from lua scripts or xml files.
Here is lua code from freeswitch docs:
local event = freeswitch.Event("CUSTOM", "SMS::SEND_MESSAGE");
event:addHeader("proto", "sip");
event:addHeader("dest_proto", "sip");
event:addHeader("from", "1004@192.168.0.81");
event:addHeader("from_full", "sip:1004@192.168.0.81");
event:addHeader("to", "sip:1019@192.168.0.81");
event:addHeader("subject", "sip:1019@192.168.0.81");
event:addHeader("type", "text/html");
event:addHeader("hint", "the hint");
event:addHeader("replying", "true");
event:addHeader("sip_profile", "external");
event:addBody("Hello from Seven Du! Have fun!");
-- freeswitch.consoleLog("info", event:serialize());
event:fire();
I've tried this code with various changes but haven't achieved successful message sending from FusionPBX.
In my example I have LAN 10.10.0.0/16 where
This will help me to implement message delivery even if some agent isn't registered, because with this functionality undelivered messages can be delivered from FusionPBX to agent when agent registers again. I already implemented parts to save undelivered messages and this part is only missing.
I found on freeswitch docs site that it can be achieved from lua scripts or xml files.
Here is lua code from freeswitch docs:
local event = freeswitch.Event("CUSTOM", "SMS::SEND_MESSAGE");
event:addHeader("proto", "sip");
event:addHeader("dest_proto", "sip");
event:addHeader("from", "1004@192.168.0.81");
event:addHeader("from_full", "sip:1004@192.168.0.81");
event:addHeader("to", "sip:1019@192.168.0.81");
event:addHeader("subject", "sip:1019@192.168.0.81");
event:addHeader("type", "text/html");
event:addHeader("hint", "the hint");
event:addHeader("replying", "true");
event:addHeader("sip_profile", "external");
event:addBody("Hello from Seven Du! Have fun!");
-- freeswitch.consoleLog("info", event:serialize());
event:fire();
I've tried this code with various changes but haven't achieved successful message sending from FusionPBX.
In my example I have LAN 10.10.0.0/16 where
- FusionPBX has 10.10.10.100 IP address
- Softphone 1 (SIP agent 1) has 10.10.20.1 IP address and SIP extension 101
- Softphone 2 (SIP agent 2) has 10.10.20.2 IP address and SIP extension 102
This will help me to implement message delivery even if some agent isn't registered, because with this functionality undelivered messages can be delivered from FusionPBX to agent when agent registers again. I already implemented parts to save undelivered messages and this part is only missing.