How speed up the sms dispatching

Hi,

When I submit 20.000 SMS to Playsms through the API, many of them are being sent out to kannel with delay, I can see a lot of messages in queue.

I noticed that when Playsms is updating the DLRs, the sms sending is very slow.

I think the processes about smssend, dlr and billing are not working in multitasking mode.

Can you help me?

Recentely, I did an important hack in playsms, changing outgoing_prefix2smsc function where it is called, or even excluding such call. This is because it is called in order to perform a search in outgoing route, starting from 8 digits, down to 1. It is called twice, one looking for general user, another for userΒ΄s father.
If this works or no depends on how routing and rating are being used. On my case, have flat rates.

2 Likes

Hi
Can you share it ?
and help us to do it?
thank you

function outgoing_mobile2smsc($mobile, $uid = 0) {
$mobile = core_sanitize_numeric($mobile);
if (strlen($mobile) > 8) {
$prefix = substr($mobile, 0, 8);
} else {
$prefix = $mobile;
}

    for ($i = 8; $i > 0; $i--) {
            $c_prefix = substr($mobile, 0, $i);
            if ($smsc = outgoing_prefix2smsc($c_prefix, $uid)) {
                    $ret = $smsc;
                    break;
            } else if ($smsc = outgoing_prefix2smsc($c_prefix)) {
                    $ret = $smsc;
                    break;
            }
    }

    return $ret;

}

The for command performs too many searches in DB, looking for prefixes from 8 down to 1 digit. If your routing/rating doesnΒ΄t use such way, fix it.

It is my case, where users have fixed smscs, they donΒ΄t depend on prefixes. I created the function instead:

function outgoing_uid2smsc($uid) {

    $db_query = "SELECT smsc FROM " . _DB_PREF_ . "_featureOutgoing WHERE uid='" . $uid . "'";
    $db_result = dba_query($db_query);
    while ($db_row = dba_fetch_array($db_result)) {
            $smsc = $db_row['smsc'];
    }

    return $smsc;

}

It is called before queue creation. If you give a smsc to queue creation, smsc will be not searched when smses are getting sent.

Through a log debug, I’ve found the following queries that could be replaced from a single one:
playsms.log:dba__query # q:SELECT id,dst,prefix,rate FROM playsms_featureSimplerate WHERE prefix=β€˜39400000000’
playsms.log:dba__query # q:SELECT id,dst,prefix,rate FROM playsms_featureSimplerate WHERE prefix=β€˜3940000000’
playsms.log:dba__query # q:SELECT id,dst,prefix,rate FROM playsms_featureSimplerate WHERE prefix=β€˜394000000’
playsms.log:dba__query # q:SELECT id,dst,prefix,rate FROM playsms_featureSimplerate WHERE prefix=β€˜39400000’
playsms.log:dba__query # q:SELECT id,dst,prefix,rate FROM playsms_featureSimplerate WHERE prefix=β€˜3940000’
playsms.log:dba__query # q:SELECT id,dst,prefix,rate FROM playsms_featureSimplerate WHERE prefix=β€˜394000’
playsms.log:dba__query # q:SELECT id,dst,prefix,rate FROM playsms_featureSimplerate WHERE prefix=β€˜39400’
playsms.log:dba__query # q:SELECT id,dst,prefix,rate FROM playsms_featureSimplerate WHERE prefix=β€˜3940’
playsms.log:dba__query # q:SELECT id,dst,prefix,rate FROM playsms_featureSimplerate WHERE prefix=β€˜394’
playsms.log:dba__query # q:SELECT id,dst,prefix,rate FROM playsms_featureSimplerate WHERE prefix=β€˜394000000’
playsms.log:dba__query # q:SELECT id,dst,prefix,rate FROM playsms_featureSimplerate WHERE prefix=β€˜39400000’
playsms.log:dba__query # q:SELECT id,dst,prefix,rate FROM playsms_featureSimplerate WHERE prefix=β€˜3940000’
playsms.log:dba__query # q:SELECT id,dst,prefix,rate FROM playsms_featureSimplerate WHERE prefix=β€˜394000’
playsms.log:dba__query # q:SELECT id,dst,prefix,rate FROM playsms_featureSimplerate WHERE prefix=β€˜39400’
playsms.log:dba__query # q:SELECT id,dst,prefix,rate FROM playsms_featureSimplerate WHERE prefix=β€˜3940’
playsms.log:dba__query # q:SELECT id,dst,prefix,rate FROM playsms_featureSimplerate WHERE prefix=β€˜394’
playsms.log:dba__query # q:SELECT id,dst,prefix,rate FROM playsms_featureSimplerate WHERE prefix=β€˜39’
playsms.log:dba__query # q:SELECT id,dst,prefix,rate FROM playsms_featureSimplerate WHERE prefix=β€˜3’

SELECT id,dst,prefix,rate FROM playsms_featureSimplerate WHERE prefix=left(β€˜39400000000’, length(prefix));

Hello.
I think best way is send bulk SMS in array to destination.
1K Bulk SMS with Single sending : 1000 Request.
1K Bulk SMS with 100 Array sending : 10Request

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.