Revision
14627
Author
gmaruzz
Date
2009-08-24 17:02:22 -0500 (Mon, 24 Aug 2009)

Log Message

celliax: react to RING and CLIP, almost take the incoming call

Modified Paths

Diff

Modified: freeswitch/branches/gmaruzz/mod_celliax/celliax_protocol.c (14626 => 14627)


--- freeswitch/branches/gmaruzz/mod_celliax/celliax_protocol.c	2009-08-24 21:00:10 UTC (rev 14626)
+++ freeswitch/branches/gmaruzz/mod_celliax/celliax_protocol.c	2009-08-24 22:02:22 UTC (rev 14627)
@@ -1398,9 +1398,24 @@
 	//if (celliax_present(SkypiaxHandles)) 
 	if (1) {
 		while (running) {
+			int res;
 			//celliax_sleep(1000000); //1 sec
 			//DEBUGA_SKYPE("ciao!\n", SKYPIAX_P_LOG);
-			celliax_serial_read(tech_pvt);
+			res=celliax_serial_read(tech_pvt);
+            if (res == -1) {    //manage the graceful interface shutdown
+              tech_pvt->controldev_dead = 1;
+              close(tech_pvt->controldevfd);
+              ERRORA("celliax_serial_monitor failed, declaring %s dead\n", SKYPIAX_P_LOG,
+                     tech_pvt->controldevice_name);
+            } else if (tech_pvt->controldevprotocol != PROTOCOL_NO_SERIAL
+                       && tech_pvt->interface_state == SKYPIAX_STATE_RING) {
+              if (option_debug)
+                WARNINGA("INCOMING RING, let's take the incoming call\n", SKYPIAX_P_LOG);
+              //FIXME if (!celliax_new(p, AST_STATE_RING, tech_pvt->context)) {
+                //FIXME ERRORA("celliax_new failed! BAD BAD BAD\n", CELLIAX_P_LOG);
+              //FIXME }
+            }
+
 		}
 	} else {
 		ERRORA("Skype is not running, maybe crashed. Please run/restart Skype and relaunch Skypiax\n", SKYPIAX_P_LOG);

Modified: freeswitch/branches/gmaruzz/mod_celliax/mod_celliax.c (14626 => 14627)


--- freeswitch/branches/gmaruzz/mod_celliax/mod_celliax.c	2009-08-24 21:00:10 UTC (rev 14626)
+++ freeswitch/branches/gmaruzz/mod_celliax/mod_celliax.c	2009-08-24 22:02:22 UTC (rev 14627)
@@ -1248,7 +1248,116 @@
 				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;
+/*********************/
+#ifdef NOTDEF
+  .interface_state = SKYPIAX_STATE_DOWN;
+  .phone_callflow = CALLFLOW_CALL_IDLE;
+  .dsp_silence_threshold = 512;
+  .context = "default";
+  .language = "en";
+  .exten = "s";
+  .controldevice_name = "none";
+  .controldevfd = 0;
+  .next = NULL;
+  .owner = NULL;
+  .dsp = NULL;
+  .fbus2_outgoing_list = NULL;
+  .seqnumfbus = FBUS2_SEQNUM_MAX;
+  .controldev_thread = AST_PTHREADT_NULL;
+  .arraycounter = 0;
+#ifndef GIOVA48
+  .celliax_sound_rate = 8000;
+#else // GIOVA48
+  .celliax_sound_rate = 48000;
+#endif // GIOVA48
+  .celliax_sound_capt_fd = -1;
+  .need_acoustic_ring = 0;
+  .celliax_serial_synced_timestamp = 0;
+  .celliax_serial_sync_period = 300;
+  .audio_play_reset_timestamp = 0;
+  .audio_capture_reset_timestamp = 0;
+  .controldevice_speed = B38400;
+  .capture_boost = 0;
+  .playback_boost = 0;
+  .stripmsd = 0;
+  .controldev_dead = 0;
+  .dtmf_inited = 0;
+#endif// NOTDEF
+  //at_dial_pre_number = "AT+CKPD=\"";
+switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_dial_pre_number, "ATD");
+  //.at_dial_post_number = "S\"";
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_dial_post_number , ";");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_dial_expect , "OK");
+  globals.SKYPIAX_INTERFACES[interface_id].at_early_audio = 0;
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_hangup , "ATH");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_hangup_expect , "OK");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_answer , "ATA");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_answer_expect , "OK");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_send_dtmf , "AT+VTS");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_preinit_1 , "");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_preinit_1_expect , "");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_preinit_2 , "");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_preinit_2_expect , "");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_preinit_3 , "");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_preinit_3_expect , "");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_preinit_4 , "");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_preinit_4_expect , "");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_preinit_5 , "");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_preinit_5_expect , "");
+  globals.SKYPIAX_INTERFACES[interface_id].at_after_preinit_pause = 500000;
+  globals.SKYPIAX_INTERFACES[interface_id].at_initial_pause = 500000;
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_postinit_1 , "at+cmic=0,9");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_postinit_1_expect , "OK");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_postinit_2 , "AT+CKPD=\"EEE\"");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_postinit_2_expect , "OK");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_postinit_3 , "AT+CSSN=1,0");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_postinit_3_expect , "OK");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_postinit_4 , "at+sidet=0");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_postinit_4_expect , "OK");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_postinit_5 , "at+clvl=99");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_postinit_5_expect , "OK");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_query_battchg , "AT+CBC");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_query_battchg_expect , "OK");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_query_signal , "AT+CSQ");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_query_signal_expect , "OK");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_call_idle , "+MCST: 1");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_call_incoming , "+MCST: 2");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_call_active , "+CSSI: 7");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_call_failed , "+MCST: 65");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_call_calling , "+CSSI: 1");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_indicator_noservice_string , "CIEV: 2;0");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_indicator_nosignal_string , "CIEV: 5;0");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_indicator_lowsignal_string , "CIEV: 5;1");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_indicator_lowbattchg_string , "CIEV: 0;1");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_indicator_nobattchg_string , "CIEV: 0;0");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_indicator_callactive_string , "CIEV: 3;1");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_indicator_nocallactive_string , "CIEV: 3;0");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_indicator_nocallsetup_string , "CIEV: 6;0");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_indicator_callsetupincoming_string , "CIEV: 6;1");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_indicator_callsetupoutgoing_string , "CIEV: 6;2");
+  switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].at_indicator_callsetupremoteringing_string , "CIEV: 6;3");
+  globals.SKYPIAX_INTERFACES[interface_id].at_has_clcc = 0;
+  globals.SKYPIAX_INTERFACES[interface_id].at_has_ecam = 0;
 
+#ifdef NOTDEF
+  .celliax_dir_entry_extension_prefix = 5;
+
+#ifdef CELLIAX_ALSA
+  .alsa_period_size = 160,
+  .alsa_periods_in_buffer = 4,
+  .alsac = NULL,
+  .alsap = NULL,
+  .alsawrite_filled = 0,
+#endif /* CELLIAX_ALSA */
+
+#endif// NOTDEF
+
+
+
+
+
+
+/*********************/
 				DEBUGA_SKYPE
 					("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].X11_display=%s\n",
 					 SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].X11_display);