Re: random charset in kannel ?

Alexander Malysh <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Hi,

seems you are right, thanks for the good tip, it was very easy to find.

Please try attached patch.

Thanks,
Alex



Am 29.09.2011 um 17:15 schrieb Alvaro Cornejo:

> Hi
> 
> This seems a bug.
> 
> I noticed an issue similar some time ago but didn't get as far as you
> did and just modify my application in order to replace all accented
> chars.
> 
> I'm coping devel list so they can verify if it is really a bug.
> 
> Regards
> 
> Alvaro
> 
> 
> |-----------------------------------------------------------------------------------------------------------------|
> Envíe y Reciba Datos y mensajes de Texto (SMS) hacia y desde cualquier
> celular y Nextel
> en el Perú, México y en mas de 180 paises. Use aplicaciones 2 vias via
> SMS y GPRS online
>               Visitenos en www.perusms.NET www.smsglobal.com.mx y
> www.pravcom.com
> 
> 
> 
> On Thu, Sep 29, 2011 at 6:45 AM, Bertrand Dupont
> <[email protected]> wrote:
>> Hi all,
>> I still have my random accents problem when sending my SMS, and I think I've
>> found the circumstances in wich it appends : it's when kannel is requeuing
>> the sms.
>> For all SMS received without accents, I found in my kannel log that the sms
>> have been sent a first time with correct PDU (I mean if I decode the PDU,
>> I've got my accents) but as modem was not available, ("send command status :
>> -1" in the log ) Kannel is requeing the sms and when the sms is sent (with
>> success) for the second time, the PDU I've in the log doesn't contain
>> anymore accent.
>> Does anyone know how work the requeing process ?
>> I've try to inspect the source code and found that smsc_at.c was calling
>> this function :
>> bb_smscconn_send_failed(privdata->conn, msg,SMSCCONN_FAILED_TEMPORARILY,
>> octstr_create("ERROR"));
>> then this function in bb_smscconn.c is calling the following function :
>> gwlist_produce(outgoing_sms, sms);
>> and finally this function is calling in list.c
>> gwlist_append(List *list, void *item)
>> wich seems to "add" the sms item to the bearbox queue I supposed. But I
>> can't see any charset parameters or something like that.
>> 
>> Does anyone already face this issue ?
>> Thanks for your help
>> Regards,
>> Bertrand
>
at2_charset.patch (application/octet-stream, 1.1 KB)
diff --git a/gw/smsc/smsc_at.c b/gw/smsc/smsc_at.c
index 11b7a76..6fb5547 100644
--- a/gw/smsc/smsc_at.c
+++ b/gw/smsc/smsc_at.c
@@ -2458,6 +2458,7 @@ static Octstr *at2_pdu_encode(Msg *msg, PrivAT2data *privdata)
         octstr_append(buffer, msg->sms.msgdata);
     } else {
         int offset = 0;
+        Octstr *msgdata;
 
         /*
          * calculate the number of fill bits needed to align
@@ -2468,11 +2469,13 @@ static Octstr *at2_pdu_encode(Msg *msg, PrivAT2data *privdata)
             offset = (((nbits / 7) + 1) * 7 - nbits) % 7; /* Fill bits */
         }
 
-        charset_utf8_to_gsm(msg->sms.msgdata);
+        msgdata = octstr_duplicate(msg->sms.msgdata);
+        charset_utf8_to_gsm(msgdata);
         
-        if ((temp = at2_encode7bituncompressed(msg->sms.msgdata, offset)) != NULL)
+        if ((temp = at2_encode7bituncompressed(msgdata, offset)) != NULL)
             octstr_append(buffer, temp);
         O_DESTROY(temp);
+        octstr_destroy(msgdata);
     }
 
     /* convert PDU to HEX representation suitable for the AT2 command set */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.