smsgsmpdu

Is there any good and stable online SMS to PDU converter?


I'm looking for a nice online converter which could work with several modems. The problem i'm dealing with - i can't send sms in pdu mode (with Cinterion BGS-2T). Tried with my own library (still working on it) and several online converters such as:

  1. http://www.smartposition.nl/resources/sms_pdu.html
  2. http://m2msupport.net/m2msupport/module-tester/
  3. http://hardisoft.ru/soft/otpravka-sms-soobshhenij-v-formate-pdu-teoriya-s-primerami-na-c-chast-1/

User data seems to be encoded well (same result everywhere), but the first part of TPDU (with PDU-Type, TP-MR, ...) may be a little bit variable (but never works, damn).

Few moments:

  1. The modem definitely supports pdu mode.
  2. There is cash on balance.
  3. Modem responses on "AT+CMGS" with ">" and it responses on PDU string with "\r\nOK\r\n", but didn't responds with "+CMGS" (and of course i'm not receiving my sms).

If it necessary here is part of my own code:

void get_pdu_string(sms_descriptor* sms, char dst[]) {
    char tempnum[8] = "";
    char* pTemp = dst;
    uint8_t i = 0;

    // SMSC
    //*pTemp++ = 0x00;
    // PDU-Type
    *pTemp++ = (0<<TP_MTIH) | (1<<TP_MTIL);       // MTI = 01 - outbox sms
    // TP-MR
    *pTemp++ = 0x00;                     // unnecessary
    // TP-DA
    *pTemp++ = strlen(sms->to_number);   // address number length
    *pTemp++ = 0x91;                     // address number format (0x91 - international)
    gsm_number_swap(sms->to_number,tempnum);
    i = (((*(pTemp-2) & 0x01) == 0x01)? (*(pTemp-2)+1) : *(pTemp-2))>>1;
    strncpy(pTemp, tempnum, i );    // address number
    pTemp += i;
    // TP-PID
    *pTemp++ = 0;
    // TP-DCS
    switch(sms->encoding) {
        case SMS_7BIT_ENC:
            *pTemp++ = 0x00;
            break;
        case SMS_UCS2_ENC:
            *pTemp++ = 0x08;
            break;
    }
    if (sms->flash == 1)
        *(pTemp-1) |= 0x10;
    // TP-VP
    // skip if does not need
    // TP-UDL
    switch(sms->encoding) {
        case SMS_7BIT_ENC:
            *pTemp++ = strlen(sms->msg);
            break;
        case SMS_UCS2_ENC:
            *pTemp++ = strlen(sms->msg) << 1;
            break;
    }
    // TP-UD
    switch(sms->encoding) {
        case SMS_7BIT_ENC: {
            char packed_msg[140] = "";
            char* pMsg = packed_msg;
            gsm_7bit_enc(sms->msg, packed_msg);
            while(*pMsg != 0)
                *pTemp++ = *pMsg++;
        } break;

        case SMS_UCS2_ENC: {
            wchar_t wmsg[70] = L"";
            wchar_t* pMsg = wmsg;
            strtoucs2(sms->msg, wmsg, METHOD_TABLE);
            while(*pMsg != 0) {
                *pTemp++ = (char) (*pMsg >> 8);
                *pTemp++ = (char) (*pMsg++);
            }
        } break;
    }
    *pTemp = 0x1A;
    return;
}

Example of my routine work:

To: 380933522620
Message: Hello! Test SMS in GSM-7

Encoded PDU string:
00 01 00 0C 81 83 90 33 25 62 02 00 00 18 C8 32 9B FD 0E 81 A8 E5 39 1D 34 6D 4E 41 69 37 E8 38 6D B6 6E 1A

Details about PDU string:
1. 00 - skipped SMSC
2. 01 - PDU-Type
3. 00 - TP-MR
4. 0C - length of To number.
5. 81 - type of number (unknown, also tried 0x91 which is international)
6. 83 90 33 25 62 02 - To number
7. 00 - TP-PID
8. 00 - TP-DCS (GSM 7bit, default SMS class)
9. 18 - TP-UD (24 letters)
10. C8 32 ... B6 6E - packed message
11. 1A - ctrl+z


Solution

  • Problem is fixed. I was sending message not as hex string but as binary, silly me :(