Modified: freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.cpp (16489 => 16490)
--- freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.cpp 2010-01-23 20:35:40 UTC (rev 16489)
+++ freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.cpp 2010-01-24 00:31:23 UTC (rev 16490)
@@ -1483,6 +1483,7 @@
#endif //WIN32
uint32_t controldevprotocol = PROTOCOL_AT; //FIXME TODO
uint32_t running = 1; //FIXME TODO
+ const char *gsmopen_serial_sync_period = "300"; //FIXME TODO
@@ -1654,6 +1655,8 @@
playback_boost = val;
} else if (!strcasecmp(var, "no_sound")) {
no_sound = val;
+ } else if (!strcasecmp(var, "gsmopen_serial_sync_period")) {
+ gsmopen_serial_sync_period = val;
}
@@ -1736,6 +1739,10 @@
ERRORA("interface param 'no_sound' MUST be a number, now no_sound='%s'\n", GSMOPEN_P_LOG, no_sound);
continue;
}
+ if (!switch_is_number(gsmopen_serial_sync_period)) {
+ ERRORA("interface param 'gsmopen_serial_sync_period' MUST be a number, now gsmopen_serial_sync_period='%s'\n", GSMOPEN_P_LOG, gsmopen_serial_sync_period);
+ continue;
+ }
if (interface_id && interface_id < GSMOPEN_MAX_INTERFACES) {
@@ -1841,6 +1848,7 @@
#else
globals.GSMOPEN_INTERFACES[interface_id].no_sound = 1;
#endif // defined(GSMOPEN_ALSA) || defined(GSMOPEN_PORTAUDIO)
+ globals.GSMOPEN_INTERFACES[interface_id].gsmopen_serial_sync_period = atoi(gsmopen_serial_sync_period);
@@ -1875,6 +1883,7 @@
DEBUGA_GSMOPEN("speexecho=%d\n", GSMOPEN_P_LOG, globals.GSMOPEN_INTERFACES[interface_id].speexecho);
DEBUGA_GSMOPEN("speexpreprocess=%d\n", GSMOPEN_P_LOG, globals.GSMOPEN_INTERFACES[interface_id].speexpreprocess);
#endif// GSMOPEN_PORTAUDIO
+ DEBUGA_GSMOPEN("gsmopen_serial_sync_period=%d\n", GSMOPEN_P_LOG, globals.GSMOPEN_INTERFACES[interface_id].gsmopen_serial_sync_period);
/* init the serial port */
if (globals.GSMOPEN_INTERFACES[interface_id].controldevprotocol != PROTOCOL_NO_SERIAL) {
globals.GSMOPEN_INTERFACES[interface_id].controldevfd =
@@ -2007,6 +2016,7 @@
DEBUGA_GSMOPEN("speexecho=%d\n", GSMOPEN_P_LOG, globals.GSMOPEN_INTERFACES[i].speexecho);
DEBUGA_GSMOPEN("speexpreprocess=%d\n", GSMOPEN_P_LOG, globals.GSMOPEN_INTERFACES[i].speexpreprocess);
#endif// GSMOPEN_PORTAUDIO
+ DEBUGA_GSMOPEN("gsmopen_serial_sync_period=%d\n", GSMOPEN_P_LOG, globals.GSMOPEN_INTERFACES[i].gsmopen_serial_sync_period);
}
}
@@ -2909,7 +2919,7 @@
switch_sleep(100); //give other threads a chance
time(&now_timestamp);
- if ((now_timestamp - tech_pvt->gsmopen_serial_synced_timestamp) > 30) { //TODO find a sensible period. 5min? in config?
+ if ((now_timestamp - tech_pvt->gsmopen_serial_synced_timestamp) > tech_pvt->gsmopen_serial_sync_period) { //TODO find a sensible period. 5min? in config?
gsmopen_serial_sync(tech_pvt);
gsmopen_serial_getstatus_AT(tech_pvt);
}