[Freeswitch-branches] [commit] r10523 - freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax

FreeSWITCH SVN gmaruzz at freeswitch.org
Mon Nov 24 01:54:39 PST 2008


Author: gmaruzz
Date: Mon Nov 24 04:54:38 2008
New Revision: 10523

Log:
skypiax: cosmetics. After receiving at least one skype call, it can make outgoing calls and hangup them. If it has never answered a call, crashes when it hangup the call he originated

Modified:
   freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c

Modified: freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c	(original)
+++ freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c	Mon Nov 24 04:54:38 2008
@@ -549,7 +549,7 @@
 
   sin_size = sizeof(remote_addr);
   while ((fd = accept(s, (struct sockaddr *) &remote_addr, &sin_size)) > 0) {
-    ERRORA("ACCEPTED\n", SKYPIAX_P_LOG);
+    DEBUGA_SKYPE("ACCEPTED\n", SKYPIAX_P_LOG);
     //while (1 && p->owner && p->owner->_state == SKYPIAX_STATE_UP)  FIXME FIXME FIXME
     while (p->interface_state != SKYPIAX_STATE_DOWN && (p->skype_callflow == CALLFLOW_STATUS_INPROGRESS ||p->skype_callflow == SKYPIAX_STATE_UP)) {
   int fdselect;
@@ -777,7 +777,7 @@
 {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "skypiax_docec FAILED\n");
 } else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "skypiax_codec SUCCESS\n");
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "skypiax_codec SUCCESS\n");
 }
 
     DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
@@ -808,6 +808,7 @@
 	globals.calls++;
 	switch_mutex_unlock(globals.mutex);
 
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL INIT\n", switch_channel_get_name(channel));
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -839,7 +840,7 @@
 	tech_pvt = switch_core_session_get_private(session);
 	assert(tech_pvt != NULL);
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel));
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel));
 
 
 	return SWITCH_STATUS_SUCCESS;
@@ -858,7 +859,7 @@
 
 	switch (sig) {
 	case SWITCH_SIG_KILL:
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s CHANNEL got SWITCH_SIG_KILL\n", switch_channel_get_name(channel));
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL got SWITCH_SIG_KILL\n", switch_channel_get_name(channel));
 		switch_clear_flag_locked(tech_pvt, TFLAG_IO);
 		switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
 		switch_set_flag_locked(tech_pvt, TFLAG_HANGUP);
@@ -867,7 +868,7 @@
 		//switch_thread_cond_signal(tech_pvt->cond);
 		break;
 	case SWITCH_SIG_BREAK:
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s CHANNEL got SWITCH_SIG_BREAK\n", switch_channel_get_name(channel));
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL got SWITCH_SIG_BREAK\n", switch_channel_get_name(channel));
 		switch_set_flag_locked(tech_pvt, TFLAG_BREAK);
 		break;
 	default:
@@ -1046,7 +1047,7 @@
 
 	p=tech_pvt->p;
 
-    ERRORA("ANSWERED! \n", SKYPIAX_P_LOG);
+    DEBUGA_SKYPE("ANSWERED! \n", SKYPIAX_P_LOG);
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -1070,7 +1071,7 @@
 	case SWITCH_MESSAGE_INDICATE_ANSWER:
 		{
 			//WARNINGA("TO BE ANSWERED! \n", SKYPIAX_P_LOG);
-			WARNINGA("MSG_ID=%d, TO BE ANSWERED!\n", SKYPIAX_P_LOG, msg->message_id);
+			DEBUGA_SKYPE("MSG_ID=%d, TO BE ANSWERED!\n", SKYPIAX_P_LOG, msg->message_id);
 			channel_answer_channel(session);
 		}
 		break;
@@ -1500,7 +1501,9 @@
   }
   AsteriskHandlesAst = &p->AsteriskHandlesAst;
 
+    if (option_debug > 101) {
   DEBUGA_SKYPE("SENDING: |||%s||||\n", SKYPIAX_P_LOG, msg_to_skype);
+	}
 
   if (!skypiax_skype_send_message(AsteriskHandlesAst, msg_to_skype)) {
     ERRORA
@@ -1675,11 +1678,13 @@
 
           if (!strcasecmp(prop, "PARTNER_HANDLE")) {
             strncpy(p->callid_number, value, sizeof(p->callid_number) - 1);
+            WARNINGA("the skype_call %s caller PARTNER_HANDLE (p->callid_number) is: %s\n", SKYPIAX_P_LOG, id, p->callid_number);
             return CALLFLOW_INCOMING_RING;
           }
           if (!strcasecmp(prop, "PARTNER_DISPNAME")) {
             snprintf(p->callid_name, sizeof(p->callid_name) - 1, "%s%s%s", value,
                      where ? " " : "", where ? where : "");
+            WARNINGA("the skype_call %s caller PARTNER_DISPNAME (p->callid_name) is: %s\n", SKYPIAX_P_LOG, id, p->callid_name);
           }
           if (!strcasecmp(prop, "CONF_ID") && !strcasecmp(value, "0")) {
             DEBUGA_SKYPE("the skype_call %s is NOT a conference call\n", SKYPIAX_P_LOG,
@@ -1964,7 +1969,6 @@
 
 			  //FIXME *new_session=switch_loadable_module_create_interface(skypiax_endpoint_interface, pool);
 
-#ifndef NOTDEF
 				if (!global_session) { //FIXME FIXME FIXME 
 					switch_core_session_t *session = NULL;
 					private_t *tech_pvt = NULL;
@@ -1987,7 +1991,6 @@
 
 		// if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session), NULL, dialplan, cid_name, cid_num, ip, NULL, NULL, NULL, modname, NULL, dest)) != 0) 
 
-#if 1
 						if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
 																				  "skypiax",
 																				  "XML",
@@ -2005,17 +2008,12 @@
 							switch_channel_set_name(channel, name);
 							switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
 						}
-              WARNINGA("skype_call: HERE\n", SKYPIAX_P_LOG);
 							switch_channel_set_state(channel, CS_INIT);
-              WARNINGA("skype_call: HERE\n", SKYPIAX_P_LOG);
 							if (switch_core_session_thread_launch(session) != SWITCH_STATUS_SUCCESS) {
-              WARNINGA("skype_call: HERE\n", SKYPIAX_P_LOG);
 								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error spawning thread\n");
 								switch_core_session_destroy(&session);
 							}
-              WARNINGA("skype_call: HERE\n", SKYPIAX_P_LOG);
 
-#endif //0
 #if 0
 						if (iax_set_codec(tech_pvt, iaxevent->session,
 										  &iaxevent->ies.format, &iaxevent->ies.capability, &iaxevent->ies.samprate, IAX_SET) != SWITCH_STATUS_SUCCESS) {
@@ -2039,30 +2037,15 @@
 					private_t *tech_pvt = NULL;
 					switch_channel_t *channel = NULL;
 
-              WARNINGA("skype_call: HERE\n", SKYPIAX_P_LOG);
-			  usleep(50000);
 					tech_pvt = p->tech_pvt;
-              WARNINGA("skype_call: HERE\n", SKYPIAX_P_LOG);
-			  usleep(50000);
 					//session = tech_pvt->session;
 					session = global_session;
-              WARNINGA("skype_call: HERE\n", SKYPIAX_P_LOG);
-			  usleep(5000000);
 							channel = switch_core_session_get_channel(session);
-
-              WARNINGA("skype_call: HERE\n", SKYPIAX_P_LOG);
-			  usleep(50000);
-
-
 			  switch_channel_mark_pre_answered(channel);
 
 							//switch_channel_set_state(channel, CS_EXECUTE);
-              WARNINGA("skype_call: HERE\n", SKYPIAX_P_LOG);
-			  usleep(50000);
-
 
 				}
-#endif //NOTDEF
 			  /**************************/
 
 



More information about the Freeswitch-branches mailing list