[Freeswitch-branches] [commit] r10349 - freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax
FreeSWITCH SVN
gmaruzz at freeswitch.org
Wed Nov 12 03:57:47 PST 2008
Author: gmaruzz
Date: Wed Nov 12 06:57:47 2008
New Revision: 10349
Log:
skypiax: trying to send DTMF from incoming skype to IVR
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 12 06:57:47 2008
@@ -173,6 +173,7 @@
//int phonebook_text_lenght;
FILE *phonebook_writing_fp;
int skypiax_dir_entry_extension_prefix;
+ void *tech_pvt;
};
typedef struct skypiax_config skypiax_config_t;
@@ -645,8 +646,11 @@
switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
switch_core_session_set_private(session, tech_pvt);
tech_pvt->session = session;
- if(p)
+ if(p){
tech_pvt->p=p;
+ p->tech_pvt=tech_pvt;
+
+ }
if ( skypiax_codec(tech_pvt, 8000, 20) != SWITCH_STATUS_SUCCESS)
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "skypiax_docec FAILED\n");
@@ -897,7 +901,7 @@
int sent;
struct skypiax_config *p=NULL;
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL WRITE FRAME\n");
+ //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL WRITE FRAME\n");
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
@@ -919,7 +923,7 @@
#endif
sent = write(p->audioskypepipe[1], (short *) frame->data, frame->datalen);
- ERRORA("sent %d\n", SKYPIAX_P_LOG, sent);
+ //ERRORA("sent %d\n", SKYPIAX_P_LOG, sent);
return SWITCH_STATUS_SUCCESS;
@@ -1579,8 +1583,31 @@
}
if (!strcasecmp(prop, "DTMF")) {
+ switch_core_session_t *session = NULL;
+ private_t *tech_pvt = NULL;
+ switch_channel_t *channel = NULL;
+
//FIXME struct ast_frame f2 = { AST_FRAME_DTMF, value[0], };
DEBUGA_SKYPE("Call %s received a DTMF: %s\n", SKYPIAX_P_LOG, id, value);
+
+ tech_pvt = p->tech_pvt;
+ session = tech_pvt->session;
+ channel = switch_core_session_get_channel(session);
+
+
+
+ if (channel) {
+ switch_dtmf_t dtmf = { (char) value[0], switch_core_default_dtmf_duration(0) };
+ if (globals.debug) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%c DTMF %s\n", dtmf.digit, switch_channel_get_name(channel));
+ }
+ switch_mutex_lock(tech_pvt->flag_mutex);
+ switch_channel_queue_dtmf(channel, &dtmf);
+ switch_set_flag(tech_pvt, TFLAG_DTMF);
+ switch_mutex_unlock(tech_pvt->flag_mutex);
+ }
+
+
//FIXME ast_queue_frame(p->owner, &f2);
}
More information about the Freeswitch-branches
mailing list