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
PostSendResultUpdate
sp_NewPost Add Reply sp_NewTopic Add Topic
March 23, 2021
2:23 pm
Henk Helmantel
Admin
Forum Posts: 1287
Member Since:
May 28, 2013
sp_UserOfflineSmall Offline

One option is to set the ErrorCode parameter to the number of message parts and the ErrorString parameter to the string 'MessagerParts'. You can then use the ErrorString value in the trigger to make the selection whether the MessageParts variable must be updated.

Database triggers can be resource intensive if they are overused. It might slow down the database transactions if the number of messages in the database is getting too high.

Regards, Henk

March 23, 2021
8:41 am
RogerW
Guest
Guests

Thanks Henk,
the database trigger is a good idea. Actually we already use a trigger to update MessageOut.MessageFrom due to UserId.
The same could be done for MessageLog.MessageParts.
I have to see what happens in the situation as there is a real ErrorCode set into the ErrorCode-field.....
There are eg. ErrorCode=24, ErrorText=invalid msisdn: 000-1234567

Regards RogerW

March 22, 2021
5:00 pm
Henk Helmantel
Admin
Forum Posts: 1287
Member Since:
May 28, 2013
sp_UserOfflineSmall Offline

That is correct, Diafaan SMS Server only updates a few fields in the send log when the status changes: StatusCode, StatusText, ErrorCode and ErrorText. You can use the ErrorCode or ErrorText to store the number of message parts that your provider sends you in the delivery report. It might then be possible to use a database trigger to update the MessageLog.MessageParts field in your database, but that depends on the database that you use.

Regards, Henk

March 22, 2021
3:23 pm
RogerW
Guest
Guests

Hi,
ok, if I understand you right, it's possible to set MessageParts only based on my own calculation as the message is sent.
If I get it from the provider in the "Delivery report", as I do, then I can only set it into some other field that is
available in PostSendResultUpdate.
Thats ok for me, although it would have been nice to set the number received from the actual sender into MessageParts.
That is always the correct number of MessageParts.

(Not Unicode) As I understand it, there are two MessageParts as the number of chars exceed 160. But after that one has to use 153 chars for all MessageParts to count the total of MessageParts.

Regards RogerW.

March 22, 2021
3:04 pm
Henk Helmantel
Admin
Forum Posts: 1287
Member Since:
May 28, 2013
sp_UserOfflineSmall Offline

I had missed that you use the 'messagePacket.Add("MessageParts",messageParts);' statement in the 'PostSendResultUpdate' method. This will not work, the statement only works in the 'PostSendResult' method.

In both GSM modems and in SMPP, the delivery reports do not contain the number of message parts and Diafaan SMS Server does not use it in the 'PostSendResultUpdate' method. The number of messages parts is only recorded after the message is sent, it can therefore be set only in the 'PostSendResult' method.

Regards, Henk

March 22, 2021
9:54 am
RogerW
Guest
Guests

Hi,
there is the same problem using
messagePacket.Add("MessageParts", messageParts);
or
messagePacket.Add("MessageParts", messageParts.ToString());

That's what I first tested.

Kind regards RogerW.

March 22, 2021
9:29 am
RogerW
Guest
Guests

Hi
some extra info, as
messagePacket.Add("MessageParts", int.Parse(messageParts));
is left out, MessageLog.MessageParts is null in database, so something is done as its available.
Updating MessageLog.MessageParts manually sets the column to eg. 3, so there is a datatype allowing
other values than 0/1 in the database.
The updating is done as a Delivery report is read by Diafaan, and explained above, the MessageParts is
correctly >1 in those reports I'm investigating.
Very strange behavior, that I always get a "1" there, although it should be a larger value.

Regards RogerW

March 19, 2021
9:00 pm
Henk Helmantel
Admin
Forum Posts: 1287
Member Since:
May 28, 2013
sp_UserOfflineSmall Offline

Hello Roger,

The "MessageParts" value in the message packet must be the string representation of the integer:

messagePacket.Add("MessageParts", messageParts);

Regards, Henk

March 19, 2021
3:28 pm
RogerW
Guest
Guests

Hi,
I have the code below. As the length of the message is over 160 chars, then I can see
"Success: Message delivered to mobile phone. --- Segments: 2"
ie. messageParts is correctly 2.
But I cant get in a value into the "MessageLog.MessageParts" by this row
messagePacket.Add("MessageParts", int.Parse(messageParts));

The value of "MessageLog.MessageParts" is always 1. This happens also as I try to put any value
messagePacket.Add("MessageParts", 3);

What am I doing wrong?

Kind regards RogerW

private void PostSendResultUpdate(string messageId, StatusCode status, string statusText,
string errorCode, string errorText, DateTime receiveTime, string messageParts)
{
Hashtable messagePacket = new Hashtable();

messagePacket.Add("PacketName", "MessageOutResultUpdate");
messagePacket.Add("MessageId", messageId);
messagePacket.Add("StatusCode", ((int) status).ToString());
messagePacket.Add("StatusText", string.Format("{0} --- Segments: {1}", statusText, messageParts)); //Add segments to statustext
messagePacket.Add("ErrorCode", errorCode);
messagePacket.Add("ErrorText", errorText);
messagePacket.Add("MessageParts", int.Parse(messageParts));
if (status == StatusCode.Received) messagePacket.Add("ReceiveTime", receiveTime.Ticks.ToString());
host.PostMessagePacket(messagePacket);
}

Forum Timezone: Europe/Amsterdam

Most Users Ever Online: 494

Currently Online:
5 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Member Stats:

Guest Posters: 605

Members: 0

Moderators: 0

Admins: 1

Forum Stats:

Groups: 2

Forums: 3

Topics: 1011

Posts: 3457

Newest Members:

, Henk Helmantel

Administrators: Henk Helmantel: 1287