【问题标题】:Why SMPP bind Transmitter return error 0x34 (ESME_RINVDLNAME)为什么 SMPP 绑定发送器返回错误 0x34 (ESME_RINVDLNAME)
【发布时间】:2021-01-18 04:05:40
【问题描述】:

这是我第一次编写通过
发送短信的PHP代码 SMPP [Short Message peer to Peer] 协议来自 gethub URL: **https://github.com/onlinecity/php-smpp** 的 onlinecity php-smpp 库, 我使用下面的代码发送短信,但它唯一的响应是错误 **返回值为错误 0x34 (ESME_RINVDLNAME) 分发列表名称无效。** 所以请帮我解决这个错误
<?php
$GLOBALS['SMPP_ROOT'] = dirname(__FILE__); // assumes this file is in the root
require_once $GLOBALS['SMPP_ROOT'].'/protocol/smppclient.class.php';
require_once $GLOBALS['SMPP_ROOT'].'/protocol/gsmencoder.class.php';
require_once $GLOBALS['SMPP_ROOT'].'/transport/tsocket.class.php';

// Simple debug callback
function printDebug($str) {
    //echo date('Ymd H:i:s ').$str."\r\n";
}

try {
    // Construct transport and client, customize settings
    $transport = new TSocket('192.168.111.1',5016,false,'printDebug'); // hostname/ip (ie. localhost) and port (ie. 2775)
    //print_r($transport);
    $transport->setRecvTimeout(10000);
    $transport->setSendTimeout(10000);
    $smpp = new SmppClient($transport,'printDebug');
    print_r($smpp);
    // Activate debug of server interaction
    $smpp->debug = true;        // binary hex-output
    $transport->setDebug(true); // also get TSocket debug
    
    // Open the connection
    $transport->open();
    
    $smpp->bindTransmitter("username","password");
    

    // Prepare message
    $message = 'Hello world';
    $encodedMessage = GsmEncoder::utf8_to_gsm0338($message);
    $from = new SmppAddress(GsmEncoder::utf8_to_gsm0338('5672'),SMPP::TON_ALPHANUMERIC);
    $to = new SmppAddress('967777841622',SMPP::TON_INTERNATIONAL,SMPP::NPI_E164);
    
    // Send

    $smpp->sendSMS($from,$to,$encodedMessage);
    //print_r($smpp);
    // Close connection
//  print_r($smpp);
    $smpp->close();
    
} catch (Exception $e) {
    // Try to unbind
    try {
        $smpp->close();
    } catch (Exception $ue) {
        // if that fails just close the transport
        printDebug("Failed to unbind; '".$ue->getMessage()."' closing transport");
        if ($transport->isOpen()) $transport->close();
    }
    
    // Rethrow exception, now we are unbound or transport is closed
    throw $e; 
}

【问题讨论】:

  • 你好。我需要帮助解决这个问题??????????
  • 您好,欢迎来到 Stack Overflow。由于我没有直接的答案,我将继续关注 cmets,但我想提出一些意见。 1. 看起来你正在使用 GitHub 上 onlinecity 的 php-smpp 项目,请在问题中说明。 2.该库上次更新是 6 年前,是为 PHP 5x(非常旧)设计的,请考虑更新的代码源,因为您可能会遇到不兼容问题, 3. 再次查看您的代码,我注意到用户名和密码没有填写. 4. 展示您为解决问题所做的工作,如果您这样做,人们将更有可能提供帮助。祝你好运!
  • 首先感谢 Kodaloid 记得我添加对库的引用,其次是用户名和密码的凭据,由于它与 SMSC 的真实连接信息,我无法分享.我需要帮助来解释这个错误以及如何解决这个问题。
  • 我发现这个问题属于 SMPP 接口版本,它来自 GitHub 上的 onlinecity 的 php-smpp 项目,使用 v3.4 [0x34],但是,这个版本被 SMSC 阻止了。当我从 3.4 [0x34] int 0.3 [0x03] 更改接口版本时,代码工作正常。

标签: php smpp


【解决方案1】:

我发现这个问题属于SMPP接口版本,php-smpp project from onlinecity在GitHub上使用v3.4 [0x34],但是这个版本被SMSC阻止了。 当我将接口版本从 3.4 [0x34] 更改为 0.3 [0x03] 代码工作正常。

【讨论】:

  • 很高兴听到这个消息!如果这是您问题的解决方案,请将其标记为正确答案。柯达
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-09-27
  • 1970-01-01
  • 1970-01-01
  • 2014-05-09
  • 1970-01-01
相关资源
最近更新 更多