Support forum

Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_TopicIcon
forward messages
sp_NewPost Add Reply sp_NewTopic Add Topic
August 5, 2024
11:10 am
Henk Helmantel
Admin
Forum Posts: 1517
Member Since:
May 28, 2013
sp_UserOfflineSmall Offline

Hello Martin,

Yes, you can add this to the script like this:

private void OnMessageReceived(string fromAddress, string toAddress, string message, string messageType,
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

August 2, 2024
1:46 pm
Martin
Guest
Guests

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")

April 19, 2022
11:19 am
Henk Helmantel
Admin
Forum Posts: 1517
Member Since:
May 28, 2013
sp_UserOfflineSmall Offline

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

April 17, 2022
5:16 am
mo ragheb
Guest
Guests

i have error: the name postsendmessage does not exist in the current context.

August 10, 2020
7:14 am
Remie van de Zande
Guest
Guests

Hi thank you very much, this will do the trick 🙂

August 9, 2020
3:24 pm
Henk Helmantel
Admin
Forum Posts: 1517
Member Since:
May 28, 2013
sp_UserOfflineSmall Offline

Hello Remie,

private void OnMessageReceived(string fromAddress, string toAddress, string message, string messageType,
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

August 7, 2020
8:44 am
Remie van de Zande
Guest
Guests

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

February 19, 2018
9:20 am
Henk Helmantel
Admin
Forum Posts: 1517
Member Since:
May 28, 2013
sp_UserOfflineSmall Offline

The script below is in C#. Diafaan SMS Server supports scripts in C# or Visual Basic.NET.

Regards, Henk

February 16, 2018
9:50 pm
SMS master
Guest
Guests

Hi Henk,

Is the script on C+ or VB?

March 9, 2016
4:03 pm
Henk Helmantel
Admin
Forum Posts: 1517
Member Since:
May 28, 2013
sp_UserOfflineSmall Offline

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:

private void OnMessageReceived(string fromAddress, string toAddress, string message, string messageType,
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

March 9, 2016
2:37 pm
Chris
Guest
Guests

Hi , i'm currently testing the demo for an SMS alerting system and i would like to forward received SMS to 1 or 2 other cell phones how can i do this?

Forum Timezone: Europe/Amsterdam

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 Helmantel

Administrators: Henk Helmantel: 1517