Diff
Modified: freeswitch/branches/gmaruzz/mod_celliax/celliax.h (14624 => 14625)
--- freeswitch/branches/gmaruzz/mod_celliax/celliax.h 2009-08-24 20:52:11 UTC (rev 14624)
+++ freeswitch/branches/gmaruzz/mod_celliax/celliax.h 2009-08-24 20:59:09 UTC (rev 14625)
@@ -59,8 +59,10 @@
#define PROTOCOL_NO_SERIAL 3
#define AT_BUFSIZ 8192
+//FIXME FIXME FIXME #define AT_MESG_MAX_LENGTH 2048 /* much more than 10 SMSs */
#define AT_MESG_MAX_LENGTH 2048 /* much more than 10 SMSs */
-#define AT_MESG_MAX_LINES 256 /* 256 lines, so it can contains the results of AT+CLAC, that gives all the AT commands the phone supports */
+//FIXME FIXME FIXME #define AT_MESG_MAX_LINES 256 /* 256 lines, so it can contains the results of AT+CLAC, that gives all the AT commands the phone supports */
+#define AT_MESG_MAX_LINES 20 /* 256 lines, so it can contains the results of AT+CLAC, that gives all the AT commands the phone supports */
#define SAMPLERATE_SKYPIAX 16000
#define SAMPLES_PER_FRAME SAMPLERATE_SKYPIAX/50
@@ -189,10 +191,12 @@
char result[AT_MESG_MAX_LINES][AT_MESG_MAX_LENGTH];
};
-struct owner_struct {
-int _state;
+struct ciapa_struct {
+int state;
int hangupcause;
};
+typedef struct ciapa_struct ciapa_t;
+
struct private_object {
unsigned int flags;
switch_codec_t read_codec;
@@ -384,7 +388,7 @@
FILE *phonebook_writing_fp;
struct timeval ringtime;
- struct owner_struct *owner;
+ ciapa_t *owner;
};
typedef struct private_object private_t;
@@ -477,13 +481,13 @@
//#define PUSHA_UNLOCKA(x) pthread_cleanup_push(celliax_unlocka_log, (void *) x);
//#define POPPA_UNLOCKA(x) pthread_cleanup_pop(0);
-#define PUSHA_UNLOCKA(x) ERRORA("PUSHA_UNLOCKA: %p\n", SKYPIAX_P_LOG, (void *)x);
-#define POPPA_UNLOCKA(x) ERRORA("POPPA_UNLOCKA: %p\n", SKYPIAX_P_LOG, (void *)x);
-#define LOKKA(x) ERRORA("LOKKA: %p\n", SKYPIAX_P_LOG, (void *)x);
-#define UNLOCKA(x) ERRORA("UNLOCKA: %p\n", SKYPIAX_P_LOG, (void *)x);
+#define PUSHA_UNLOCKA(x) if(option_debug > 100) ERRORA("PUSHA_UNLOCKA: %p\n", SKYPIAX_P_LOG, (void *)x);
+#define POPPA_UNLOCKA(x) if(option_debug > 100) ERRORA("POPPA_UNLOCKA: %p\n", SKYPIAX_P_LOG, (void *)x);
+#define LOKKA(x) if(option_debug > 100) ERRORA("LOKKA: %p\n", SKYPIAX_P_LOG, (void *)x);
+#define UNLOCKA(x) if(option_debug > 100) ERRORA("UNLOCKA: %p\n", SKYPIAX_P_LOG, (void *)x);
#define celliax_queue_control(x, y) ERRORA("celliax_queue_control: %p, %d\n", SKYPIAX_P_LOG, (void *)x, y);
#define ast_setstate(x, y) ERRORA("ast_setstate: %p, %d\n", SKYPIAX_P_LOG, (void *)x, y);
-
+int celliax_serial_read(private_t * tech_pvt);
Modified: freeswitch/branches/gmaruzz/mod_celliax/celliax_protocol.c (14624 => 14625)
--- freeswitch/branches/gmaruzz/mod_celliax/celliax_protocol.c 2009-08-24 20:52:11 UTC (rev 14624)
+++ freeswitch/branches/gmaruzz/mod_celliax/celliax_protocol.c 2009-08-24 20:59:09 UTC (rev 14625)
@@ -1398,8 +1398,9 @@
//if (celliax_present(SkypiaxHandles))
if (1) {
while (running) {
- celliax_sleep(1000000); //1 sec
- DEBUGA_SKYPE("ciao!\n", SKYPIAX_P_LOG);
+ //celliax_sleep(1000000); //1 sec
+ //DEBUGA_SKYPE("ciao!\n", SKYPIAX_P_LOG);
+ celliax_serial_read(tech_pvt);
}
} else {
ERRORA("Skype is not running, maybe crashed. Please run/restart Skype and relaunch Skypiax\n", SKYPIAX_P_LOG);
@@ -1459,7 +1460,7 @@
/* set controldevice_speed */
rt = cfsetispeed(&tp, tech_pvt->controldevice_speed);
if (rt == -1) {
- ERRORA("serial error: %s", SKYPIAX_P_LOG, strerror(errno));
+ ERRORA("serial error: %s, speed was: %d", SKYPIAX_P_LOG, strerror(errno), tech_pvt->controldevice_speed);
}
rt = cfsetospeed(&tp, tech_pvt->controldevice_speed);
if (rt == -1) {
@@ -1501,6 +1502,22 @@
return (fd);
}
+int celliax_serial_read(private_t * tech_pvt)
+{
+ if (tech_pvt->controldevprotocol == PROTOCOL_AT)
+ return celliax_serial_read_AT(tech_pvt, 0, 100000, 0, NULL, 1); // a 10th of a second timeout
+#ifdef CELLIAX_FBUS2
+ if (tech_pvt->controldevprotocol == PROTOCOL_FBUS2)
+ return celliax_serial_read_FBUS2(tech_pvt);
+#endif /* CELLIAX_FBUS2 */
+#ifdef CELLIAX_CVM
+ if (tech_pvt->controldevprotocol == PROTOCOL_CVM_BUSMAIL)
+ return celliax_serial_read_CVM_BUSMAIL(tech_pvt);
+#endif /* CELLIAX_CVM */
+ return -1;
+}
+
+
int celliax_serial_sync(private_t * tech_pvt)
{
if (tech_pvt->controldevprotocol == PROTOCOL_AT)
@@ -2227,7 +2244,7 @@
if (tech_pvt->owner && tech_pvt->interface_state == CALLFLOW_CALL_DIALING) {
DEBUGA_PBX("just received a remote ANSWER\n", SKYPIAX_P_LOG);
- if (tech_pvt->owner->_state != SKYPIAX_STATE_UP) {
+ if (tech_pvt->owner->state != SKYPIAX_STATE_UP) {
celliax_queue_control(tech_pvt->owner, SKYPIAX_CONTROL_RINGING);
DEBUGA_PBX("just sent SKYPIAX_CONTROL_RINGING\n", SKYPIAX_P_LOG);
DEBUGA_PBX("going to send SKYPIAX_CONTROL_ANSWER\n", SKYPIAX_P_LOG);
@@ -3418,7 +3435,7 @@
int res;
if (tech_pvt->owner) {
- if (tech_pvt->owner->_state != SKYPIAX_STATE_UP && tech_pvt->owner->_state != SKYPIAX_STATE_DOWN) {
+ if (tech_pvt->owner->state != SKYPIAX_STATE_UP && tech_pvt->owner->state != SKYPIAX_STATE_DOWN) {
DEBUGA_SKYPE("No getstatus, we're neither UP nor DOWN\n", SKYPIAX_P_LOG);
return 0;
}
Modified: freeswitch/branches/gmaruzz/mod_celliax/mod_celliax.c (14624 => 14625)
--- freeswitch/branches/gmaruzz/mod_celliax/mod_celliax.c 2009-08-24 20:52:11 UTC (rev 14624)
+++ freeswitch/branches/gmaruzz/mod_celliax/mod_celliax.c 2009-08-24 20:59:09 UTC (rev 14625)
@@ -1099,7 +1099,8 @@
char *skype_user = NULL;
uint32_t interface_id = 0, to = 0, max = 0;
- uint32_t controldevice_speed = 115200;
+ uint32_t controldevice_speed = B115200;
+ int controldevprotocol = PROTOCOL_AT;
tech_pvt = NULL;
@@ -1246,6 +1247,7 @@
switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].context, context);
switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].controldevice_name, controldevice_name);
globals.SKYPIAX_INTERFACES[interface_id].controldevice_speed = controldevice_speed;
+ globals.SKYPIAX_INTERFACES[interface_id].controldevprotocol = controldevprotocol;
DEBUGA_SKYPE
("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].X11_display=%s\n",