DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • Enhance Your Communication Strategy: Deliver Multimedia Messages With AWS Pinpoint
  • What Is Artificially Inflated Traffic?
  • Revolutionizing Customer Engagement: Unleashing the Magic of Communication APIs
  • Supercharge Your Communication With Twilio and Ballerina

Trending

  • After 9 Years, Microsoft Fulfills This Windows Feature Request
  • Comparing Managed Postgres Options on The Azure Marketplace
  • Mastering Deployment Strategies: Navigating the Path to Seamless Software Releases
  • How To Build AI-Powered Prompt Templates Using the Salesforce Prompt Builder

Sending Concatenated SMS with UDH using kannel

By 
Kirti Mandwade user avatar
Kirti Mandwade
·
Jun. 24, 15 · Code Snippet
Likes (1)
Comment
Save
Tweet
Share
7.0K Views

Join the DZone community and get the full member experience.

Join For Free
 
A normal SMS can contain upto 160 characters in GSM 7bit encoding.
For sending long messages that have more then 160 characters that message has to be splitted in multiple SMS with a UDH header added to them and sent one by one.
Whats a  UDH:

UDH - User Data Header
It keeps the information about the message.
UDH is made up of 6 parts:

05 - This tells the length of UDH which is 5 bytes(total bytes fllowing this byte).
00 - IEL (Information Element Identifier). This indicates that this message is concatenated. This value will remain same
03 - This tells the length of incoming information field (ie more three bytes will be there in UDH).
AA- This is unique identifier of message.It remains same for all parts of message. It can be any unique byte. For eg F3
BB- This tells the total number of message parts. For example If you have a long message divided in  two parts then this will be : 02
CC - The sequence number of this message. For example if you are sending first part of message then it will become 01 , if you are sending second part it will be 02.
So whole UDH will look like
Example UDH  : 050003F30201

Sending A message with udh
As UDH is in hexadecimal format, while sending message with UDH then text should also be converted to hex format.
The code snippet shows simple example to send Message with UDH using XML POST in kannel




public class kannelSend{

public static void sendMessage(String inputXMLConnect) throws IOException {
		 String url = "http://localhost:13003/cgi-bin/sendsms";  

		CloseableHttpClient httpClient = HttpClients.createDefault();
		HttpPost httpPost = null;
		CloseableHttpResponse response = null;
		InputStream in;
		StringEntity entity = null;

		entity = new StringEntity(inputXMLConnect, ContentType.create(
				"text/xml"));
		entity.setChunked(true);

		try {
			httpPost = new HttpPost(url);

			httpPost.setEntity(entity);
			
			
			response = httpClient.execute(httpPost);

			

			LOG.info(response.getStatusLine());
			in = response.getEntity().getContent();
			String body = IOUtils.toString(in);

				EntityUtils.consume(entity);
		} catch (Exception e) {
			LOG.error(e.getMessage(), e);

		}
		finally{
			response.close();

			httpClient.close();
		}


public static void main(String[] args) throws IOException {
	 String inputXMLConnect = "0000001234496e207468652063656c6c756c61722070686f6e6520696e6475737472792c206d6f62696c652070686f6e657320616e64207468656972206e6574776f726b7320736f6d6574696d657320737570706f727420636f6e636174656e617465642073686f7274206d657373616765207365727669636520746f206f766572636f6d6520746865206c696d69746174696f6e206f6e20746865206e050003F202016031abc123send";


	 
	 
	 submitKannelMessage(inputXMLConnect);
	 
	 inputXMLConnect = "00000123756d626572206f66206368617261637465727320746861742063616e2062652073656e7420696e20612073696e676c6520534d532074657874206d657373616765207472616e736d697373696f6e2028776869636820697320757375616c6c7920313630292e050003F202026031abc123send";

	 submitKannelMessage(inputXMLConnect);


}
}



SMS

Opinions expressed by DZone contributors are their own.

Related

  • Enhance Your Communication Strategy: Deliver Multimedia Messages With AWS Pinpoint
  • What Is Artificially Inflated Traffic?
  • Revolutionizing Customer Engagement: Unleashing the Magic of Communication APIs
  • Supercharge Your Communication With Twilio and Ballerina

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!