onlinecity / php-smpp

PHP 5 based SMPP client library
232 stars 160 forks source link

Could not parse delivery receipt #70

Closed rayidi closed 7 years ago

rayidi commented 7 years ago

Hi there,

To receive delivery reports from the smpp vendor, while submitting the sms I've used the below piece of code.

SmppClient::$sms_registered_delivery_flag = SMPP::REG_DELIVERY_SMSC_BOTH;

While parsing for the delivery report, I'm getting below error.

PHP Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Could not parse delivery receipt: id:117062714244798261 sub:001 dlvrd:001 submit date:1706271624 done date:1706271624 stat:DELIVRD err:0000 text:Hllo world 000101393137303133313033303330000500414d41525654000400000000000000007b69643a313137303632373134323434373938323631207375623a30303120646c7672643a303031207375626d697420646174653a3137303632373136323420646f6e6520646174653a3137303632373136323420737461743a44454c49565244206572723a3030303020746578743a481b656c6c6f20776f726c640423000303000014540004000000011418000400000000' in /var/www/amaravti.net/smpp/inc/smppclient.class.php:1067 Stack trace:

0 /var/www/domain.net/smpp/inc/smppclient.class.php(536): SmppDeliveryReceipt->parseDeliveryReceipt()

1 /var/www/domain.net/smpp/inc/smppclient.class.php(260): SmppClient->parseSMS(Object(SmppPdu))

2 /var/www/domain.net/smpp/receiver.php(24): SmppClient->readSMS()

3 {main}

thrown in /var/www/domain.net/smpp/inc/smppclient.class.php on line 1067

What i'm missing here?

rayidi commented 7 years ago

I've fixed this issue by changing the below line from

$numMatches = preg_match('/^id:([^ ]+) sub:(\d{1,3}) dlvrd:(\d{3}) submit date:(\d{10,12}) done date:(\d{10,12}) stat:([A-Z ]{7}) err:(\d{2,3}) text:(.*)$/si', $this->message, $matches);

to

$numMatches = preg_match('/^id:([^ ]+) sub:(\d{1,3}) dlvrd:(\d{3}) submit date:(\d{10,12}) done date:(\d{10,12}) stat:([A-Z ]{7}) err:(\d{2,4}) text:(.*)$/si', $this->message, $matches);

mjindal92 commented 4 years ago

Hello @rayidi ,

Still i am getting same issue after change numMatches.

Fatal error: Uncaught InvalidArgumentException: Could not parse delivery receipt: id:0959366982 submit date:1911210611 done date:1911210611 stat:DELIVRD err:000

Can you please provide me any other solution?

Thanks