I'm using the Golang SMPP protocol to send SMS messages. The messages are being sent successfully, but the source address displayed on the recipient's phone is "Unknown address".
Here is my code -- main.go
package main
import (
"log"
"github.com/fiorix/go-smpp/smpp"
"github.com/fiorix/go-smpp/smpp/pdu/pdufield"
"github.com/fiorix/go-smpp/smpp/pdu/pdutext"
)
func main() {
tx := &smpp.Transmitter{
Addr: "server:port",
User: "userId",
Passwd: "password",
}
// Create persistent connection, wait for the first status.
conn := <-tx.Bind()
if conn.Status() != smpp.Connected {
log.Fatal(conn.Error())
}
sm, err := tx.Submit(&smpp.ShortMessage{
Src: "MyCompany",
Dst: "25*********",
Text: pdutext.Raw("Sample sms"),
Register: pdufield.NoDeliveryReceipt,
})
if err != nil {
log.Fatal(err)
}
log.Println("Message ID:", sm.RespID())
}
-- go.mod
module sms
go 1.21.0
require github.com/fiorix/go-smpp v0.0.0-20210403173735-2894b96e70ba
require golang.org/x/text v0.3.6 // indirect
Image Example I followed: https://pkg.go.dev/github.com/fiorix/go-smpp/smpp#example-Transmitter
According to SMPP specifications, the source address (often referred to as the "sender ID") can be up to 11 alphanumeric characters. The string "MyCompany" in your example is longer than the allowed length, which might be causing the issue.
Try using a shorter alphanumeric string for the source address: