Re: Portech MV-37x patch

Ariel Wainer <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
On 13/11/14 12:01, Stipe Tolj wrote:
> Am 13.11.2014 14:48, schrieb Anton Osennikov:
>> 13.11.2014 17:50, Stipe Tolj пишет:
>>> Am 12.11.2014 18:42, schrieb Anton Osennikov:
>>>>
>>>> Hello.
>>>>
>>>> Here was another try to solve the same problem, for ALLVoIP
>>>> AV3402 device. The device looks the same: same additional command,
>>>> same
>>>> additional response.
>>>>
>>>> http://www.mail-archive.com/[email protected]/msg11934.html
>>>
>>> Hi Anton,
>>>
>>> thanks a lot for the input here.
>>>
>>> Just to get you right, adding your patch to support \r escape codes
>>> would solve both plaform requirements in terms of adding more input on
>>> the AT command interface?
>>
>> It does so for ALLVoIP AV3402 device. We successfully use this patch
>> with this device for several months now.
>>
>> I hope the patch will also work for Portech MV-37x devices, since
>> additional prompts and responses are very similar.
>>
>> Here's log with "module1" command embedded into smsc-password:
>>
>> smsc-password = "23*****74\r\nmodule1"
> thanks Anton.
>
> Ariel, does this work for the Portech platform too?
>
> Stipe
>


The patch failed to apply automatically, probably my fault:
# patch  <  ../escape.patch
can't find file to patch at input line 3
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|--- gwlib/cfg.c 2014-10-03 18:32:38.000000000 +0600
|+++ /var/tmp/kannel-patch//cfg.c        2014-10-03 18:32:26.000000000 +0600
--------------------------
File to patch: gwlib/cfg.c
patching file gwlib/cfg.c
Hunk #1 FAILED at 358.
1 out of 1 hunk FAILED -- saving rejects to file gwlib/cfg.c.rej


I manually changed the function parse_value to add the 2 cases, it ended
up looking like this, I think it's ok:

static void parse_value(Octstr *value)
{
    Octstr *temp;
    long len;
    int c;

    octstr_strip_blanks(value);

    len = octstr_len(value);
    if (octstr_get_char(value, 0) != '"' ||
        octstr_get_char(value, len - 1) != '"')
        return;

    octstr_delete(value, len - 1, 1);
    octstr_delete(value, 0, 1);

    temp = octstr_duplicate(value);
    octstr_truncate(value, 0);

    while (octstr_len(temp) > 0) {
        c = octstr_get_char(temp, 0);
        octstr_delete(temp, 0, 1);

        if (c != '\\' || octstr_len(temp) == 0)
            octstr_append_char(value, c);
        else {
            c = octstr_get_char(temp, 0);
            octstr_delete(temp, 0, 1);

            switch (c) {
            case '\\':
            case '"':
                octstr_append_char(value, c);
                break;

            case 'r':
                octstr_append_char(value, '\r');
                break;

            case 'n':
                octstr_append_char(value, '\n');
                break;


            default:
                octstr_append_char(value, '\\');
                octstr_append_char(value, c);
                break;
            }
        }
    }

    octstr_destroy(temp);
}


Adding \r\nmodule to my smsc-password didn't work for me. Maybe I
applied the patch wrong or this session requieres a different CR/LF escape.

The relevant log:

2014-11-13 11:59:18 [21070] [0] DEBUG: AT2[pt0]: start called
2014-11-13 11:59:19 [21070] [6] DEBUG: AT2[pt0]: <--
2014-11-13 11:59:19 [21070] [6] DEBUG: AT2[pt0]: <-- >
2014-11-13 11:59:19 [21070] [6] DEBUG: AT2[pt0]: --> voip^M
2014-11-13 11:59:20 [21070] [6] DEBUG: AT2[pt0]: <-- sername: voip>
2014-11-13 11:59:20 [21070] [6] DEBUG: AT2[pt0]: --> 1234\r\nmodule1^M
2014-11-13 11:59:20 [21070] [6] DEBUG: AT2[pt0]: <-- password:
***************
2014-11-13 11:59:20 [21070] [6] DEBUG: AT2[pt0]: <-- bad username or
password!!!
2014-11-13 11:59:20 [21070] [6] DEBUG: AT2[pt0]: <-- [0]exit...
2014-11-13 11:59:23 [21070] [6] DEBUG: AT2[pt0]: --> AT^M
2014-11-13 11:59:26 [21070] [6] INFO: AT2[pt0]: init device
2014-11-13 11:59:26 [21070] [6] DEBUG: AT2[pt0]: --> ATZ^M
2014-11-13 11:59:30 [21070] [6] ERROR: AT2[pt0]: Wrong or no answer to
ATZ, ignoring
2014-11-13 11:59:30 [21070] [6] ERROR: AT2[pt0]: Initialization of
device failed. Attempt #0 on -1 max.
2014-11-13 11:59:30 [21070] [6] INFO: AT2[pt0]: Closing device

-- 
Ariel Wainer
Contenta Mobile
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.