Hi,

I wrote this function to call Kannel and process messages back:

private function call_kannel($url, $data){
$url = $url . "?" . $data;

$st = @file($url);
list($version, $status_code, $msg) = explode(' ', $http_response_header[0], 3);

switch((int) $status_code){
case 202:
// Accepted for delivery / Queued for later delivery
return 1;
break;
case 503:
// Temporal failure, try again later
throw new Exception("Serveur temporal failure.");
break;
default:
$deb = substr($status_code, 0, 1);
if($deb == 4){
// Requete invalide
return 2;
}else{
// Erreur inconnue
return 3;
}
}
}

I do not know if it can help you.

See you dear friend french ;)

Cyril

PS : can you contact me to say what carier you use to send SMS?


info.ubichip a écrit :
Hello,

I would like to achieve the following schema to send sms:

app ---> kannel gw 1---> php code

I would like the php code is seen as another kannel gw by the kannel gw #1.
In the php code, I wrote some code answering "0: Accepted for delivery" or
"Sent." but the GW1 saw it as NACK and so make it as failed in the kannel
database.

I take a look in the kannel source and I found that in the
/gw/smsc/smsc_http.c :


static void kannel_parse_reply(SMSCConn *conn, Msg *msg, int status,
                               List *headers, Octstr *body)
{
    /* Test on three cases:
     * 1. an smsbox reply of an remote kannel instance
     * 2. an smsc_http response (if used for MT to MO looping)
     * 3. an smsbox reply of partly successful sendings */
    if ((status == HTTP_OK || status == HTTP_ACCEPTED)
        && (octstr_case_compare(body, octstr_imm("Sent.")) == 0 ||
            octstr_case_compare(body, octstr_imm("Ok.")) == 0 ||
            octstr_ncompare(body, octstr_imm("Result: OK"),10) == 0)) {
        bb_smscconn_sent(conn, msg, NULL);
    } else {
        bb_smscconn_send_failed(conn, msg,
                    SMSCCONN_FAILED_MALFORMED, octstr_duplicate(body));
    }
}

So I assume kannel saw a good transmission when it receive a HTTP OK and a
message like "Sent." or "Ok."

Does I forget something ?

Does someone got similar issue ?

Regards



Reply via email to