Support forum
Hello Martin,
Yes, you can add this to the script like this:
string messageId, string smsc, string pdu, string gateway,
DateTime sendTime, DateTime receiveTime)
{
if (fromAddress == "+316123123123") {
PostSendMessage("+316789789789", fromAddress, fromAddress + ", " + message, messageType, "", "", "", 0);
PostSendMessage("+316987987987", fromAddress, fromAddress + ", " + message, messageType, "", "", "", 0);
}
else if (fromAddress == "+316321321321") {
PostSendMessage("+316456456456 ", fromAddress, fromAddress + ", " + message, messageType, "", "", "", 0);
PostSendMessage("+316654654654", fromAddress, fromAddress + ", " + message, messageType, "", "", "", 0);
}
else {
PostSendMessage("+316147147147", fromAddress, fromAddress + ", " + message, messageType, "", "", "", 0);
}
}
Regards, Henk
1:46 pm
Hi!
Is it possible to add the sender to the body of the forwarded message?
Example:
Sender +316123123123 (message = "some text 12345") Forward to: +316789789789 & +316987987987 (message = "+316123123123, some text 12345")
Sender +316321321321 (message = "some text 67890") Forward to: +316456456456 & +316654654654 (message = "+316321321321, some text 67890")
Hello Mo,
There are two likely causes for this error:
1. You use this code in the Scripting Gateway, this won't work, the code only works in the Scripting Connector.
or
2. If you are using the code in the Scripting Connector then you have probably removed the 'PostSendMessage' function from the default script.
To use the code in this topic, you only have to:
- Create a new Scripting Connector.
- Click on 'Edit C# script' in the settings to open the scripting editor.
- Replace the 'OnMessageReceived' function with the examples in this topic, make sure to leave the rest of the default script intact.
Regards, Henk
5:16 am
i have error: the name postsendmessage does not exist in the current context.
7:14 am
Hi thank you very much, this will do the trick 🙂
Hello Remie,
string messageId, string smsc, string pdu, string gateway,
DateTime sendTime, DateTime receiveTime)
{
if (fromAddress == "+316123123123") {
PostSendMessage("+316789789789", fromAddress, message, messageType, "", "", "", 0);
PostSendMessage("+316987987987", fromAddress, message, messageType, "", "", "", 0);
}
else if (fromAddress == "+316321321321") {
PostSendMessage("+316456456456 ", fromAddress, message, messageType, "", "", "", 0);
PostSendMessage("+316654654654", fromAddress, message, messageType, "", "", "", 0);
}
else {
PostSendMessage("+316147147147", fromAddress, message, messageType, "", "", "", 0);
}
}
Regards, Henk
8:44 am
Hello Henk,
I've succefully managed to add your code in the script.
But I would like it in a way that I can determine the receivers of the forwarded SMS based on the sender.
Example:
Sender +316123123123 Forward to: +316789789789 & +316987987987
Sender +316321321321 Forward to: +316456456456 & +316654654654
All other senders Forward to: +316147147147
Would you be so kind and help me with this.
Many thanks/ Alvast bedankt
Remie
The script below is in C#. Diafaan SMS Server supports scripts in C# or Visual Basic.NET.
Regards, Henk
Hello Chris,
You can use the Scripting Connector and adapt the 'OnMessageReceived' function in the standard script to forward received messages to one or more other mobile phones. The following code snippet forwards a received SMS message to numbers +44111111111 and +44222222222:
string messageId, string smsc, string pdu, string gateway,
DateTime sendTime, DateTime receiveTime)
{
PostSendMessage("+44111111111", fromAddress, message, messageType, "", "", "", 0);
PostSendMessage("+44222222222", fromAddress, message, messageType, "", "", "", 0);
}
Regards, Henk
Most Users Ever Online: 529
Currently Online:
6 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Member Stats:
Guest Posters: 681
Members: 0
Moderators: 0
Admins: 1
Forum Stats:
Groups: 2
Forums: 3
Topics: 1160
Posts: 3961
Newest Members:
, Henk HelmantelAdministrators: Henk Helmantel: 1517