J'utilise jamaa-smpp
pour envoyer un message. Cela fonctionne mais l'ID de l'expéditeur était 00000 au lieu du nom que je voulais. J'ai mis le TON
et le NPI
pour activer l'expéditeur alphanumérique dans le sm de soumission comme indiqué dans le code ci-dessous mais il est toujours 00000. Je ne peux pas lier le sm au client lors de l'envoi du message.
public partial class WebForm1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void ss_Click(object sender, EventArgs e) { var sm = new SubmitSm(); sm.SourceAddress.Ton = JamaaTech.Smpp.Net.Lib.TypeOfNumber.Aphanumeric; sm.SourceAddress.Npi = JamaaTech.Smpp.Net.Lib.NumberingPlanIndicator.ISDN; sm.DestinationAddress.Ton = JamaaTech.Smpp.Net.Lib.TypeOfNumber.International; sm.DestinationAddress.Npi = JamaaTech.Smpp.Net.Lib.NumberingPlanIndicator.ISDN; TextMessage msg = new TextMessage(); msg.DestinationAddress ="96565565655556"; //Receipient number msg.SourceAddress = "NYCOMPANYNAME"; //Originating number msg.Text = "text text text text"; msg.RegisterDeliveryNotification = true; //I want delivery notification for this message SmppClient client = GetSmppClient(); client.BeginSendMessage(msg, SendMessageCompleteCallback, client); } private void client_ConnectionStateChanged(object sender, ConnectionStateChangedEventArgs e) { switch (e.CurrentState) { case SmppConnectionState.Closed: //Connection to the remote server is lost //Do something here e.ReconnectInteval = 60000; //Try to reconnect after 1 min break; case SmppConnectionState.Connected: //A successful connection has been established break; case SmppConnectionState.Connecting: //A connection attemp is still on progress break; } } private SmppClient GetSmppClient() { SmppClient client = new SmppClient(); System.Threading.Thread.Sleep(9000); SmppConnectionProperties properties = client.Properties; properties.SystemID = "id"; properties.Password = "pass"; properties.Port = xxxxx; //IP port to use properties.Host = "x.x.x.x"; //SMSC host name or IP Address properties.SystemType = "SMPP"; properties.DefaultServiceType = "SMPP"; client.AutoReconnectDelay = 3000; client.KeepAliveInterval = 15000; client.Start(); System.Threading.Thread.Sleep(9000); return client; } private static void SendMessageCompleteCallback(IAsyncResult result) { try { SmppClient client = (SmppClient)result.AsyncState; client.EndSendMessage(result); } catch (Exception e) { } } }
Je m'attends à ce que le nom de l'expéditeur soit MYCOMPANYNAME au lieu de 00000000.
3 Réponses :
vous devez définir le 'NPI' sur unknown et 'ton' sur alphanumérique et
client.Properties.SourceAddress = "COMPANYNAME"; client.SourceAddress.Ton = JamaaTech.Smpp.Net.Lib.TypeOfNumber.Alphanumeric; client.SourceAddress.Npi=JamaaTech.Smpp.Net.Lib.NumberingPlanIndicator.Unknown;
pas msg.SourceAddress = "MYCOMPANYNAME";
J'espère que cela vous aidera. Veuillez indiquer si vous trouvez cette réponse utile.
j'ai essayé la correction et l'expéditeur était "inconnu" est qu'un problème de code ou certains paramètres du côté SMSC
veuillez régler le «NPI» sur inconnu et «ton» sur alphanumérique. N'oubliez pas que la longueur du nom de votre entreprise doit être de 11 caractères au maximum.
J'ai défini le NPI sur inconnu et il est toujours anonyme
veuillez partager votre dernier code pour examen et meilleure compréhension
le code mis à jour est:
{ protected void send_Click(object sender, EventArgs e) { var sm = new SubmitSm(); sm.SourceAddress.Npi = JamaaTech.Smpp.Net.Lib.NumberingPlanIndicator.Unknown; sm.SourceAddress.Ton = JamaaTech.Smpp.Net.Lib.TypeOfNumber.Aphanumeric sm.DestinationAddress.Ton = JamaaTech.Smpp.Net.Lib.TypeOfNumber.International; sm.DestinationAddress.Npi = JamaaTech.Smpp.Net.Lib.NumberingPlanIndicator.Unknown; TextMessage msg = new TextMessage(); msg.DestinationAddress ="123456789"; //Receipient number msg.Text = "test test"; msg.RegisterDeliveryNotification = true; //I want delivery notification for this message SmppClient client = GetSmppClient(); client.BeginSendMessage(msg, SendMessageCompleteCallback, client); } private void client_ConnectionStateChanged(object sender, ConnectionStateChangedEventArgs e) { switch (e.CurrentState) { case SmppConnectionState.Closed: e.ReconnectInteval = 60000; //Try to reconnect after 1 min break; case SmppConnectionState.Connected: break; case SmppConnectionState.Connecting: break; } } private SmppClient GetSmppClient() { SmppClient client = new SmppClient(); System.Threading.Thread.Sleep(9000); SmppConnectionProperties properties = client.Properties; properties.SystemID = "xxxxxx"; properties.Password = "xxxxxx"; properties.Port = 10000; //IP port to use properties.Host = "xx.xx.xx.xx"; //SMSC host name or IP Address properties.SystemType = "SMPP"; properties.DefaultServiceType = "SMPP"; properties.SourceAddress = "MYCOMPANY"; properties.AddressNpi = NumberingPlanIndicator.Unknown; properties.AddressTon = TypeOfNumber.Aphanumeric; properties.DefaultEncoding = DataCoding.Latin1; client.AutoReconnectDelay = 3000; client.KeepAliveInterval = 15000; client.Start(); System.Threading.Thread.Sleep(9000); return client; } private static void SendMessageCompleteCallback(IAsyncResult result) { try { SmppClient client = (SmppClient)result.AsyncState; client.EndSendMessage(result); } catch (Exception e) { } }
}
TextMessage msg = new MyTextMessage();
bonjour s'il te plait aide
Veuillez noter que tous les SMSC ne prennent pas en charge les adresses d'expéditeur alphanumériques. Il se peut que vous ne puissiez pas faire ce que vous voulez.