[Freeswitch-svn] [commit] r10461 - freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax
FreeSWITCH SVN
gmaruzz at freeswitch.org
Wed Nov 19 09:54:51 PST 2008
Author: gmaruzz
Date: Wed Nov 19 12:54:51 2008
New Revision: 10461
Log:
skypiax: react to channel_on_hangup()
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 Wed Nov 19 12:54:51 2008
@@ -173,43 +173,43 @@
char X11_display[256];
struct AsteriskHandles AsteriskHandlesAst;
- int interface_state; /*!< \brief 'state' of the interface (channel) */
- char language[80]; /*!< \brief default Asterisk dialplan language for this interface */
- char exten[80]; /*!< \brief default Asterisk dialplan extension for this interface */
- int skypiax_sound_rate; /*!< \brief rate of the sound device, in Hz, eg: 8000 */
- int skypiax_sound_capt_fd; /*!< \brief file descriptor for sound capture dev */
- char callid_name[50];
- char callid_number[50];
- double playback_boost;
- double capture_boost;
- int stripmsd;
- pthread_t skype_thread;
- char skype_call_id[512];
- int skype_call_ongoing;
- char skype_friends[4096];
- char skype_fullname[512];
- char skype_displayname[512];
- int skype_callflow; /*!< \brief 'callflow' of the skype interface (as opposed to phone interface) */
- int skype; /*!< \brief config flag, bool, Skype support on this interface (0 if false, -1 if true) */
- int control_to_send;
- int audiopipe[2];
- int audioskypepipe[2];
- pthread_t tcp_srv_thread;
- pthread_t tcp_cli_thread;
- short audiobuf[160];
- int audiobuf_is_loaded;
-
- //int phonebook_listing;
- //int phonebook_querying;
- //int phonebook_listing_received_calls;
-
- //int phonebook_first_entry;
- //int phonebook_last_entry;
- //int phonebook_number_lenght;
- //int phonebook_text_lenght;
- FILE *phonebook_writing_fp;
- int skypiax_dir_entry_extension_prefix;
- void *tech_pvt;
+ int interface_state; /*!< \brief 'state' of the interface (channel) */
+ char language[80]; /*!< \brief default Asterisk dialplan language for this interface */
+ char exten[80]; /*!< \brief default Asterisk dialplan extension for this interface */
+ int skypiax_sound_rate; /*!< \brief rate of the sound device, in Hz, eg: 8000 */
+ int skypiax_sound_capt_fd; /*!< \brief file descriptor for sound capture dev */
+ char callid_name[50];
+ char callid_number[50];
+ double playback_boost;
+ double capture_boost;
+ int stripmsd;
+ pthread_t skype_thread;
+ char skype_call_id[512];
+ int skype_call_ongoing;
+ char skype_friends[4096];
+ char skype_fullname[512];
+ char skype_displayname[512];
+ int skype_callflow; /*!< \brief 'callflow' of the skype interface (as opposed to phone interface) */
+ int skype; /*!< \brief config flag, bool, Skype support on this interface (0 if false, -1 if true) */
+ int control_to_send;
+ int audiopipe[2];
+ int audioskypepipe[2];
+ pthread_t tcp_srv_thread;
+ pthread_t tcp_cli_thread;
+ short audiobuf[160];
+ int audiobuf_is_loaded;
+
+ //int phonebook_listing;
+ //int phonebook_querying;
+ //int phonebook_listing_received_calls;
+
+ //int phonebook_first_entry;
+ //int phonebook_last_entry;
+ //int phonebook_number_lenght;
+ //int phonebook_text_lenght;
+ FILE *phonebook_writing_fp;
+ int skypiax_dir_entry_extension_prefix;
+ void *tech_pvt;
};
typedef struct skypiax_config skypiax_config_t;
@@ -792,41 +792,6 @@
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t channel_on_hangup(switch_core_session_t *session)
-{
- switch_channel_t *channel = NULL;
- private_t *tech_pvt = NULL;
-
- channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
-
- tech_pvt = switch_core_session_get_private(session);
- assert(tech_pvt != NULL);
-
- switch_clear_flag_locked(tech_pvt, TFLAG_IO);
- switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
- //switch_thread_cond_signal(tech_pvt->cond);
-
- if (tech_pvt->read_codec.implementation) {
- switch_core_codec_destroy(&tech_pvt->read_codec);
- }
-
- if (tech_pvt->write_codec.implementation) {
- switch_core_codec_destroy(&tech_pvt->write_codec);
- }
-
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(channel));
- switch_mutex_lock(globals.mutex);
- globals.calls--;
- if (globals.calls < 0) {
- globals.calls = 0;
- }
- switch_mutex_unlock(globals.mutex);
-
- return SWITCH_STATUS_SUCCESS;
-}
-
static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig)
{
switch_channel_t *channel = NULL;
@@ -1044,11 +1009,15 @@
switch (msg->message_id) {
case SWITCH_MESSAGE_INDICATE_ANSWER:
{
- ERRORA("TO BE ANSWERED! \n", SKYPIAX_P_LOG);
+ //WARNINGA("TO BE ANSWERED! \n", SKYPIAX_P_LOG);
+ WARNINGA("MSG_ID=%d, TO BE ANSWERED!\n", SKYPIAX_P_LOG, msg->message_id);
channel_answer_channel(session);
}
break;
default:
+ {
+ WARNINGA("MSG_ID=%d\n", SKYPIAX_P_LOG, msg->message_id);
+ }
break;
}
@@ -2437,6 +2406,49 @@
return SWITCH_STATUS_SUCCESS;
}
+static switch_status_t channel_on_hangup(switch_core_session_t *session)
+{
+ switch_channel_t *channel = NULL;
+ private_t *tech_pvt = NULL;
+ skypiax_config_t *p;
+ char msg_to_skype[256];
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+ tech_pvt = switch_core_session_get_private(session);
+ assert(tech_pvt != NULL);
+
+ p = tech_pvt->p;
+
+ switch_clear_flag_locked(tech_pvt, TFLAG_IO);
+ switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
+ //switch_thread_cond_signal(tech_pvt->cond);
+ WARNINGA("hanging up skype call: %s\n", SKYPIAX_P_LOG, p->skype_call_id);
+ //sprintf(msg_to_skype, "SET CALL %s STATUS FINISHED", p->skype_call_id);
+ sprintf(msg_to_skype, "ALTER CALL %s HANGUP", p->skype_call_id);
+ skypiax_skype_write(p, msg_to_skype);
+
+ if (tech_pvt->read_codec.implementation) {
+ switch_core_codec_destroy(&tech_pvt->read_codec);
+ }
+
+ if (tech_pvt->write_codec.implementation) {
+ switch_core_codec_destroy(&tech_pvt->write_codec);
+ }
+
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(channel));
+ switch_mutex_lock(globals.mutex);
+ globals.calls--;
+ if (globals.calls < 0) {
+ globals.calls = 0;
+ }
+ switch_mutex_unlock(globals.mutex);
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
/* For Emacs:
* Local Variables:
* mode:c
More information about the Freeswitch-svn
mailing list