playSMS Forum

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.

1 Like

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.