From 5b98e04e498567f785048c096759ebe56141eb57 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Mon, 2 Apr 2012 09:26:11 +0200 Subject: [PATCH] gsmopen: works04 --- src/mod/endpoints/mod_gsmopen/Makefile | 8 ++++--- src/mod/endpoints/mod_gsmopen/gsmopen.h | 11 +++++++++ src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp | 24 +++++++++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_gsmopen/Makefile b/src/mod/endpoints/mod_gsmopen/Makefile index 610dfc13ae..06109af5ae 100644 --- a/src/mod/endpoints/mod_gsmopen/Makefile +++ b/src/mod/endpoints/mod_gsmopen/Makefile @@ -1,9 +1,11 @@ MODNAME=mod_gsmopen SVNDEF := -D'GSMOPEN_SVN_VERSION="$(shell svnversion -n .)"' #LOCAL_CFLAGS += $(SVNDEF) -I/usr/src/gsmlib-1.10 -LOCAL_CFLAGS += $(SVNDEF) -DNO_GSMLIB -DNO_ALSA -I../../../../libs/spandsp/src -I../../../..//libs/tiff-3.8.2/libtiff +LOCAL_CFLAGS += $(SVNDEF) -DNO_GSMLIB -DNO_ALSA -I../../../../libs/spandsp/src -I../../../..//libs/tiff-3.8.2/libtiff -Ilibctb-0.16/include/ #LOCAL_LDFLAGS=-lasound -L/usr/src/gsmlib-1.10/gsmlib/.libs -lgsmme -LOCAL_LDFLAGS=-L../../../../libs/spandsp/src -lspandsp -LOCAL_OBJS=gsmopen_protocol.o +LOCAL_LDFLAGS=-L../../../../libs/spandsp/src -lspandsp -lctb-0.16 + +LOCAL_OBJS=gsmopen_protocol.o #OUR_OBJS += /usr/src/gsmlib-1.10/gsmlib/libgsmme.la +#OUR_OBJS += libctb-0.16/lib/libctbd-0.16.a include ../../../../build/modmake.rules diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen.h b/src/mod/endpoints/mod_gsmopen/gsmopen.h index a335070604..e8cd61a0a0 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen.h +++ b/src/mod/endpoints/mod_gsmopen/gsmopen.h @@ -135,6 +135,17 @@ #define GSMOPEN_SVN_VERSION SWITCH_VERSION_REVISION #endif /* GSMOPEN_SVN_VERSION */ +#include "ctb-0.16/ctb.h" + +#include +#include +#include + +#include +#include + +using namespace std; + typedef enum { TFLAG_IO = (1 << 0), TFLAG_INBOUND = (1 << 1), diff --git a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp index e7ad4d046b..fed0996dea 100644 --- a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp +++ b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp @@ -2152,7 +2152,31 @@ static switch_status_t load_config(int reload_type) #endif// GSMOPEN_PORTAUDIO DEBUGA_GSMOPEN("gsmopen_serial_sync_period=%d\n", GSMOPEN_P_LOG, (int)globals.GSMOPEN_INTERFACES[i].gsmopen_serial_sync_period); DEBUGA_GSMOPEN("controldevice_audio_name=%s\n", GSMOPEN_P_LOG, globals.GSMOPEN_INTERFACES[i].controldevice_audio_name); +/***********************************/ + ctb::IOBase* device = NULL; + + + ctb::SerialPort* serialPort = new ctb::SerialPort(); + + //if( serialPort->Open( devname.c_str(), baudrate, + if( serialPort->Open( "/dev/ttyUSB3", 115200, "8N1", ctb::SerialPort::NoFlowControl ) >= 0 ) { + + device = serialPort; + + if( device->Write( "AT+CLAC\r\n", 9 ) != 7 ) { + + ERRORA("BIZARRE\n", GSMOPEN_P_LOG); + + } + + } else { + + ERRORA("port NOT open\n", GSMOPEN_P_LOG); + } + + +/***********************************/ } } }