Comments (1)
please add this method to your transmitter.go :
func (t *Transmitter) SubmitLongMsg8bit(sm *ShortMessage) ([]ShortMessage, error) {
maxLen := 134 // 140-6 (UDH)
rawMsg := sm.Text.Encode()
countParts := int((len(rawMsg)-1)/maxLen) + 1
ri := uint8(t.r.Intn(128))
UDHHeader := make([]byte, 6)
UDHHeader[0] = 5
UDHHeader[1] = 0
UDHHeader[2] = 3
UDHHeader[3] = ri
UDHHeader[4] = uint8(countParts)
responses := []ShortMessage{}
for i := 0; i < countParts; i++ {
UDHHeader[5] = uint8(i + 1) // current message part
p := pdu.NewSubmitSM(sm.TLVFields)
f := p.Fields()
f.Set(pdufield.SourceAddr, sm.Src)
f.Set(pdufield.DestinationAddr, sm.Dst)
if i != countParts-1 {
f.Set(pdufield.ShortMessage, pdutext.Raw(append(UDHHeader, rawMsg[i*maxLen:(i+1)*maxLen]...)))
} else {
f.Set(pdufield.ShortMessage, pdutext.Raw(append(UDHHeader, rawMsg[i*maxLen:]...)))
}
f.Set(pdufield.RegisteredDelivery, uint8(sm.Register))
if sm.Validity != time.Duration(0) {
f.Set(pdufield.ValidityPeriod, convertValidity(sm.Validity))
}
f.Set(pdufield.ServiceType, sm.ServiceType)
f.Set(pdufield.SourceAddrTON, sm.SourceAddrTON)
f.Set(pdufield.SourceAddrNPI, sm.SourceAddrNPI)
f.Set(pdufield.DestAddrTON, sm.DestAddrTON)
f.Set(pdufield.DestAddrNPI, sm.DestAddrNPI)
f.Set(pdufield.ESMClass, 0x40)
f.Set(pdufield.ProtocolID, sm.ProtocolID)
f.Set(pdufield.PriorityFlag, sm.PriorityFlag)
f.Set(pdufield.ScheduleDeliveryTime, sm.ScheduleDeliveryTime)
f.Set(pdufield.ReplaceIfPresentFlag, sm.ReplaceIfPresentFlag)
f.Set(pdufield.SMDefaultMsgID, sm.SMDefaultMsgID)
f.Set(pdufield.DataCoding, uint8(sm.Text.Type()))
//set the optional parameters in the submit pdu from sm
optParams := p.TLVFields()
for tag, value := range sm.TLVFields {
err := optParams.Set(tag, value)
if err != nil {
return nil, err
}
}
resp, err := t.do(p)
if err != nil {
return nil, err
}
sm.resp.Lock()
sm.resp.p = resp.PDU
sm.resp.Unlock()
// checking for errors in the responses will be left to the client
responses = append(responses, *sm)
}
return responses, nil
}
from go-smpp.
Related Issues (20)
- Check connected client(s) HOT 1
- Using tx.Submit in thread HOT 2
- Easier way to manager delivery receipts - missing receipted_message_id and PDU Sequence Management HOT 1
- [QUESTION] - How to register multiple delivery for transceiver
- [BUG] - message encoding not working for long unicode message
- timeout waiting for response - RESOLVED using RespTimeout parameter HOT 5
- Converting the hex in text field of delivery receipt to original UCS2 text submitted
- Use GSM(packed) to encode and then decode, there is an extra '@' character HOT 4
- Concatenated / Multipart
- Multipart Message using UCS2
- server example
- getValidityPeriod format YYMMDDhhmmssUTCR
- disconnect when receive data_sm HOT 2
- error in var udhList []UDH
- Using multiple tranceiver.Submit via go routines
- Error sending SMS with Golang SMPP protocol: Unknown address HOT 1
- How to reconnect when receive error not connected with error Connection reset by peer?
- wrong decode and encode for pdufield.UDHList HOT 1
- Utf support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-smpp.