Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7412511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:33:07+00:00 2026-05-29T06:33:07+00:00

I am using Gammu on my server to setup a SMS gateway, but I

  • 0

I am using Gammu on my server to setup a SMS gateway, but I ran into a problem, when I was moving from receiving IDs to just get any non-processed SMS’es from Gammu’s DB (in MySQL)
A bit of the inbox table looks like this

|     UDH      |       TextDecoded        | ID | Processed |
| 0500034A0201 | Some long text (156 l.)  |  1 |   false   |
| 0500034A0202 | Some continuing text     |  2 |   false   | 
|              | An SMS (less than 160 l) |  3 |   false   |

If an SMS is over 160 letters the SMS is splitted over multiple entries indicated by UDH.
The UDH is created by

  1. part of the UDH (050003) indicates it is an SMS.
  2. part of the UDH (4A02) is a unique identifier.
  3. part of the UDH (01) is the part-number of the SMS.

I can check if the SMS is fully received, if the TextDecoded (of the last entry with the long SMS (with UDH)) is less than 156 letters long or TheRecevingDateTime is later than 3 minutes.

I need to create Stored Procedures to Get a SMS (here a SMS can be over 160 letters long) and Get All New SMSes (if the Processed is false).
I have already created an example of how to Get a SMS, that looks like

DELIMITER €€
CREATE PROCEDURE `GetSMS`(IN smsid int(10))
   BEGIN
      DECLARE smsudh TEXT;
      SELECT `UDH` INTO smsudh FROM `inbox` WHERE `ID`=smsid;
      IF (STRCMP(smsudh, '') < 1) THEN
         SELECT * FROM `inbox` WHERE `ID`=smsid;
      ELSE
         SELECT * FROM `inbox` WHERE `UDH` LIKE CONCAT(LEFT(smsudh, (LENGTH(smsudh)-2)), "%") GROUP BY `ID` ORDER BY `UDH`;
      END IF;
   END €€
DELIMITER ;

But I can not figure out how to create a Stored Procedure to Get All New SMSes.

** EDIT **

  • It should get all new SMSes
  • A long SMS is received when the last entry (with UDH) is received later than 3 minutes due to TheReceivingDateTime or the TextDecoded is shorter than 156 letters
  • An SMS without UDH is just received (it should not be combined with other SMSes without UDH)

I hope you understand my question

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T06:33:08+00:00Added an answer on May 29, 2026 at 6:33 am
    SELECT id FROM (
      SELECT
        MIN(id) as id,
        MIN(UDH) as udh,
        MIN(LENGTH(TextDecoded)) as txtlen,
        MAX(TheReceivingDateTime)-DATE_ADD(MIN(TheReceivingDateTime), INTERVAL 3 MINUTE) AS rcvtimeout
      FROM inbox
      WHERE
        Processed='false'
      GROUP BY
        IF(UDH='',id,SUBSTR(UDH,1,10))
      HAVING rcvtimeout>0
        OR udh=''
        OR txtlen<156
      ) AS baseview
    ORDER BY id;
    

    Since we can’t filter by where for a time interval, we use it as a group function and filter by having

    This will give back a list of id’s, that you can run through your GetSMS

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been using the scipy.stats.invgamma.rvs function to randomly select values from an inverse
Using the http://www.ifans.com/forums/showthread.php?t=132024 post from another question i am allowing the user to enter
Using online interfaces to a version control system is a nice way to have
Using PyObjC , you can use Python to write Cocoa applications for OS X.
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using C# and System.Data.SqlClient, is there a way to retrieve a list of parameters
Using VS2008, C#, .Net 2 and Winforms how can I make a regular Button
Using JDeveloper , I started developing a set of web pages for a project

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.