Friday, October 11, 2013

Chan_dongle do not compile with asterisk 11

The symptoms are:

In file included from app.c:21:0:
/usr/include/asterisk/version.h:1:2: error: #error "Do not include 'asterisk/version.h'; use 'asterisk/ast_version.h' instead."
app.c: In function 'app_register':
app.c:162:3: warning: passing argument 2 of 'ast_register_application2' from incompatible pointer type [enabled by default]
In file included from app.c:20:0:
/usr/include/asterisk/module.h:458:5: note: expected 'int (*)(struct ast_channel *, const char *)' but argument is of type 'int (*)(struct ast_channel *, void *)'
make: *** [app.o] Error 1


Solution:
  • Download patched sources
  • autoconf and autmake should be installed
  • uzip sources
  • cd to unzipped folder
  • issue commands: aclocal, autoconf, automake -a
  • install chan_dongle as usual ./configure, make, make install.
then I got next error

# sudo make install
./config.status
config.status: creating Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
strip chan_dongle.so
/usr/bin/install -c -m 755 chan_dongle.so
/usr/bin/install: missing destination file operand after `chan_dongle.so'
Try `/usr/bin/install --help' for more information.
make: *** [install] Error 1

Error because on chan_dongle installed on 64 bit OS. In that case DESTDIR should be: DESTDIR="/usr/lib64/asterisk/modules

after that you can run asterisk console and load module:

CLI> module load chan_dongle.so

but then next error comes:

WARNING[24644]: chan_dongle.c:218 opentty: unable to open /dev/ttyUSB2: Permission denied
that because of wrong permissions.


That usually happens when asterisk running in non root mode. Set the correct permissions to /dev/ttyUSB

#chmod 666 /dev/ttyUSB*

after all chan_dongle is up and runnin, but after adding second dongle, problem with permissions comes back. The silution is to set permission automatically. Create file in /etc/udev/rules.d/92-dongle.rules
and add

KERNEL=="ttyUSB*", MODE="0666", OWNER="asterisk", GROUP="uucp"

6 comments:

  1. Don't work, a get error
    [root@IVR ~]# cd asterisk-chan-dongle-asterisk11
    [root@IVR asterisk-chan-dongle-asterisk11]# aclocal
    configure.in:10: warning: AC_ARG_PROGRAM was called before AC_CANONICAL_TARGET
    ../../lib/autoconf/general.m4:1795: AC_CANONICAL_TARGET is expanded from...
    ../../lib/autoconf/general.m4:1819: AC_CANONICAL_SYSTEM is expanded from...
    configure.in:10: the top level
    [root@IVR asterisk-chan-dongle-asterisk11]# autoconf
    configure.in:10: warning: AC_ARG_PROGRAM was called before AC_CANONICAL_TARGET
    ../../lib/autoconf/general.m4:1795: AC_CANONICAL_TARGET is expanded from...
    ../../lib/autoconf/general.m4:1819: AC_CANONICAL_SYSTEM is expanded from...
    configure.in:10: the top level
    [root@IVR asterisk-chan-dongle-asterisk11]# automake -a
    configure.in:10: warning: AC_ARG_PROGRAM was called before AC_CANONICAL_TARGET
    ../../lib/autoconf/general.m4:1795: AC_CANONICAL_TARGET is expanded from...
    ../../lib/autoconf/general.m4:1819: AC_CANONICAL_SYSTEM is expanded from...
    configure.in:10: the top level
    configure.in: installing `./install-sh'
    configure.in: installing `./missing'
    automake: no `Makefile.am' found for any configure output
    [root@IVR asterisk-chan-dongle-asterisk11]# cd ..
    [root@IVR ~]# cd chan_dongle-1.1.r14
    [root@IVR chan_dongle-1.1.r14]# ./config
    -bash: ./config: No existe el fichero o el directorio
    [root@IVR chan_dongle-1.1.r14]# ./configure
    checking build system type... x86_64-unknown-linux-gnu
    checking host system type... x86_64-unknown-linux-gnu
    checking target system type... x86_64-unknown-linux-gnu
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    checking for gawk... gawk
    checking whether make sets $(MAKE)... yes

    ReplyDelete
  2. [root@IVR chan_dongle-1.1.r14]# make
    gcc -g -O2 -O6 -I. -D_GNU_SOURCE -I/usr/include -I/usr/include -DHAVE_CONFIG_H -fvisibility=hidden -fPIC -Wall -Wextra -MD -MT app.o -MF .app.o.d -MP -o app.o -c app.c
    En el fichero incluído de app.c:21:
    /usr/include/asterisk/version.h:1:2: error: #error "Do not include 'asterisk/version.h'; use 'asterisk/ast_version.h' instead."
    app.c: In function âapp_status_execâ:
    app.c:37: aviso: falta el inicializador
    app.c:37: aviso: (cerca de la inicialización de âargs.resourceâ)
    app.c: In function âapp_send_sms_execâ:
    app.c:82: aviso: falta el inicializador
    app.c:82: aviso: (cerca de la inicialización de âargs.deviceâ)
    app.c: In function âapp_registerâ:
    app.c:162: aviso: se pasa el argumento 2 de âast_register_application2â desde un tipo de puntero incompatible
    make: *** [app.o] Error 1
    [root@IVR chan_dongle-1.1.r14]#

    ReplyDelete
  3. Hi the think is copy all the files that are in in the path folder in the chan-dongle folder
    Example: [root@localhost chan_dongle-1.1.r14]# cp -r ../asterisk-chan-dongle-asterisk11/* .
    For me works great
    [root@localhost chan_dongle-1.1.r14]# cp -r ../asterisk-chan-dongle-asterisk11/* .
    [root@localhost chan_dongle-1.1.r14]# ./configure
    checking build system type... x86_64-unknown-linux-gnu
    checking host system type... x86_64-unknown-linux-gnu
    checking target system type... x86_64-unknown-linux-gnu
    checking for a BSD-compatible install... /usr/bin/install -c
    xxxxxx
    xxxxxxxxxx info .......
    DASTERISK_VERSION_NUM=110000 -DHAVE_CONFIG_H -fvisibility=hidden -fPIC -Wall -Wextra -MD -MT pdiscovery.o -MF .pdiscovery.o.d -MP -o pdiscovery.o -c pdiscovery.c
    gcc -shared -Xlinker -x -o chan_dongle.so app.o at_command.o at_parse.o at_queue.o at_read.o at_response.o chan_dongle.o channel.o char_conv.o cli.o helpers.o manager.o memmem.o ringbuffer.o cpvt.o dc_config.o pdu.o mixbuffer.o pdiscovery.o
    root@localhost chan_dongle-1.1.r14]# make
    .........
    [root@localhost chan_dongle-1.1.r14]# make install
    ./config.status
    config.status: creating Makefile
    config.status: creating config.h
    config.status: config.h is unchanged
    config.status: executing depfiles commands
    strip chan_dongle.so
    /usr/bin/install -c -m 755 chan_dongle.so /usr/lib/asterisk/modules

    ReplyDelete
  4. Thank you very much, great help...

    ReplyDelete
  5. Thank you! Save my life.

    ReplyDelete
  6. Anonymous2/9/16 05:49

    [root@elastix2 chan_dongle-1.1.r14]# make
    gcc -g -O2 -O6 -I. -D_GNU_SOURCE -I/usr/include -I/usr/include -DHAVE_CONFIG_H -fvisibility=hidden -fPIC -Wall -Wextra -MD -MT app.o -MF .app.o.d -MP -o app.o -c app.c
    In file included from app.c:21:
    /usr/include/asterisk/version.h:1:2: error: #error "Do not include 'asterisk/version.h'; use 'asterisk/ast_version.h' instead."
    app.c: In function âapp_status_execâ:
    app.c:37: warning: missing initializer
    app.c:37: warning: (near initialization for âargs.resourceâ)
    app.c: In function âapp_send_sms_execâ:
    app.c:82: warning: missing initializer
    app.c:82: warning: (near initialization for âargs.deviceâ)
    app.c: In function âapp_registerâ:
    app.c:162: warning: passing argument 2 of âast_register_application2â from incompatible pointer type
    make: ** [app.o] Erro 1

    ReplyDelete