]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-4916 added beep real beep instead of DTMF, and fixed hangup before end of greeting...
authorGiovanni Maruzzelli <gmaruzz@gmail.com>
Thu, 24 Jan 2013 14:08:51 +0000 (15:08 +0100)
committerGiovanni Maruzzelli <gmaruzz@gmail.com>
Thu, 24 Jan 2013 14:09:04 +0000 (15:09 +0100)
src/mod/endpoints/mod_skypopen/mod_skypopen.c
src/mod/endpoints/mod_skypopen/skypopen.h
src/mod/endpoints/mod_skypopen/skypopen_protocol.c

index babf5b13642121d52d9899995f782fbf8e7f2550..167357f47d39b806ef76e46359f404ef33a5f314 100644 (file)
@@ -450,6 +450,8 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
 
        channel = switch_core_session_get_channel(session);
        switch_assert(channel != NULL);
+       memset(tech_pvt->skype_voicemail_id, '\0', sizeof(tech_pvt->skype_voicemail_id));
+       memset(tech_pvt->skype_voicemail_id_greeting, '\0', sizeof(tech_pvt->skype_voicemail_id_greeting));
        switch_channel_set_variable(channel, "skype_user", tech_pvt->skype_user);
        switch_mutex_lock(tech_pvt->flag_mutex);
        switch_set_flag(tech_pvt, TFLAG_IO);
@@ -621,15 +623,26 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session)
 
                if (strlen(tech_pvt->skype_call_id)) {
                        DEBUGA_SKYPE("hanging up skype call: %s\n", SKYPOPEN_P_LOG, tech_pvt->skype_call_id);
+                       if(strlen(tech_pvt->skype_voicemail_id_greeting)){
+                               sprintf(msg_to_skype, "ALTER VOICEMAIL %s STOPPLAYBACK", tech_pvt->skype_voicemail_id_greeting);
+                               skypopen_signaling_write(tech_pvt, msg_to_skype);
+                               switch_sleep(MS_SKYPOPEN * 1000 * 100);//XXX FIXME 2000 millisecs, 2 seconds, so it will record at least 1 second
+                       }
+
+                       if(strlen(tech_pvt->skype_voicemail_id_greeting)){
+                               sprintf(msg_to_skype, "ALTER VOICEMAIL %s DELETE", tech_pvt->skype_voicemail_id_greeting);
+                               skypopen_signaling_write(tech_pvt, msg_to_skype);
+                               switch_sleep(MS_SKYPOPEN * 1000 * 10);//XXX FIXME 200 millisecs
+                       }
                        if(strlen(tech_pvt->skype_voicemail_id)){
                                sprintf(msg_to_skype, "ALTER VOICEMAIL %s STOPRECORDING", tech_pvt->skype_voicemail_id);
                                skypopen_signaling_write(tech_pvt, msg_to_skype);
-                               switch_sleep(MS_SKYPOPEN * 1000 * 3);//XXX FIXME ??
+                               switch_sleep(MS_SKYPOPEN * 1000 * 10);//XXX FIXME 200 millisecs
                        }
-                       sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->skype_call_id);
-                       skypopen_signaling_write(tech_pvt, msg_to_skype);
                        sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id);
                        skypopen_signaling_write(tech_pvt, msg_to_skype);
+                       sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->skype_call_id);
+                       skypopen_signaling_write(tech_pvt, msg_to_skype);
                }
                DEBUGA_SKYPE("%s CHANNEL HANGUP\n", SKYPOPEN_P_LOG, tech_pvt->name);
                switch_mutex_lock(globals.mutex);
index b2ee69235ac9e5613dce4872ccd462f6623aa325..69cda02b9a1a41603b00b2b87d2c5ac9cc476ba1 100644 (file)
@@ -358,6 +358,7 @@ struct private_object {
 
        char message[4096];
        char skype_voicemail_id[512];
+       char skype_voicemail_id_greeting[512];
 };
 
 typedef struct private_object private_t;
index e961549d7eed569bd89aadc5a4a4917dbb4c6700..6bd7d2f9af351577c3939de1591f9b5e5d61283b 100644 (file)
@@ -245,6 +245,10 @@ int skypopen_signaling_read(private_t *tech_pvt)
                                } else if (!strncasecmp(message, "ERROR 99 CALL", 12)) {
                                        DEBUGA_SKYPE("Skype got ERROR: |||%s|||, another call is active on this interface\n\n\n", SKYPOPEN_P_LOG, message);
                                        tech_pvt->interface_state = SKYPOPEN_STATE_ERROR_DOUBLE_CALL;
+                               } else if (!strncasecmp(message, "ERROR 531 VOICEMAIL", 18)) {
+                                       NOTICA("Skype got ERROR about VOICEMAIL, no problem: |||%s|||\n", SKYPOPEN_P_LOG, message);
+                               } else if (!strncasecmp(message, "ERROR 529 VOICEMAIL", 18)) {
+                                       NOTICA("Skype got ERROR about VOICEMAIL, no problem: |||%s|||\n", SKYPOPEN_P_LOG, message);
                                } else if (!strncasecmp(message, "ERROR 592 ALTER CALL", 19)) {
                                        NOTICA("Skype got ERROR about TRANSFERRING, no problem: |||%s|||\n", SKYPOPEN_P_LOG, message);
                                } else if (!strncasecmp(message, "ERROR 559 CALL", 13) | !strncasecmp(message, "ERROR 556 CALL", 13)) {
@@ -563,38 +567,15 @@ int skypopen_signaling_read(private_t *tech_pvt)
                                        DEBUGA_SKYPE("VOICEMAIL %s OUTPUT\n", SKYPOPEN_P_LOG, id);
                                        sprintf(msg_to_skype, "ALTER VOICEMAIL %s SET_OUTPUT PORT=\"%d\"", id, tech_pvt->tcp_srv_port);
                                        skypopen_signaling_write(tech_pvt, msg_to_skype);
+                                       sprintf(tech_pvt->skype_voicemail_id_greeting, "%s", id);
 
                                } else if (!strcasecmp(prop, "TYPE") && !strcasecmp(value, "OUTGOING") ) {
                                        DEBUGA_SKYPE("VOICEMAIL OUTGOING id is %s\n", SKYPOPEN_P_LOG, id);
                                        sprintf(tech_pvt->skype_voicemail_id, "%s", id);
                                } else if (!strcasecmp(prop, "STATUS") && !strcasecmp(value, "PLAYED") ) {
-                                       switch_core_session_t *session = NULL;
+                                       switch_ivr_broadcast( tech_pvt->session_uuid_str, "gentones::%(500,0,800)",SMF_ECHO_ALEG|SMF_ECHO_BLEG);
+                                       memset(tech_pvt->skype_voicemail_id_greeting, '\0', sizeof(tech_pvt->skype_voicemail_id_greeting));
 
-                                       session = switch_core_session_locate(tech_pvt->session_uuid_str);
-                                       if (session) {
-                                               char digit_str[2];
-                                               char *p = digit_str;
-                                               switch_channel_t *channel = switch_core_session_get_channel(session);
-
-                                               digit_str[0]='1';
-                                               digit_str[1]='\0';
-
-                                               if (channel) {
-
-                                                       while (p && *p) {
-                                                               switch_dtmf_t dtmf = { 0 };
-                                                               dtmf.digit = *p;
-                                                               dtmf.duration = SWITCH_DEFAULT_DTMF_DURATION;
-                                                               switch_channel_queue_dtmf(channel, &dtmf);
-                                                               p++;
-                                                       }
-                                               } else {
-                                                       WARNINGA("NO CHANNEL ?\n", SKYPOPEN_P_LOG);
-                                               }
-                                       switch_core_session_rwunlock(session);
-                                       } else {
-                                               WARNINGA("NO SESSION ?\n", SKYPOPEN_P_LOG);
-                                       }
                                }
                        }