if (zap_channel_dequeue_dtmf(tech_pvt->zchan, dtmf, sizeof(dtmf))) {
switch_dtmf_t _dtmf = { 0, SWITCH_DEFAULT_DTMF_DURATION };
- switch_channel_queue_dtmf(channel, &_dtmf);
+ char *p;
+ for (p = dtmf; p && *p; p++) {
+ if (is_dtmf(*p)) {
+ _dtmf.digit = *p;
+ zap_log(ZAP_LOG_DEBUG, "queue DTMF [%c]\n", *p);
+ switch_channel_queue_dtmf(channel, &_dtmf);
+ }
+ }
}
return SWITCH_STATUS_SUCCESS;
}
break;
case ZAP_SIGEVENT_STOP:
- {
+ {
while((session = zap_channel_get_session(sigmsg->channel, 0))) {
channel = switch_core_session_get_channel(session);
switch_channel_hangup(channel, sigmsg->channel->caller_data.hangup_cause);
uint32_t zap_hash_hashfromstring(void *ky);
uint32_t zap_running(void);
+
ZIO_CODEC_FUNCTION(zio_slin2ulaw);
ZIO_CODEC_FUNCTION(zio_ulaw2slin);
ZIO_CODEC_FUNCTION(zio_slin2alaw);
struct tm * localtime_r(const time_t *clock, struct tm *result);
#endif
-
static void *zap_analog_channel_run(zap_thread_t *me, void *obj);
static ZIO_CHANNEL_OUTGOING_CALL_FUNCTION(analog_fxo_outgoing_call)
}
}
- if ((dlen = zap_channel_dequeue_dtmf(zchan, dtmf + dtmf_offset, sizeof(dtmf) - strlen(dtmf)))) {
- if (zchan->state == ZAP_CHANNEL_STATE_DIALTONE || zchan->state == ZAP_CHANNEL_STATE_COLLECT) {
- zap_log(ZAP_LOG_DEBUG, "DTMF %s\n", dtmf + dtmf_offset);
+
+ if (zchan->state == ZAP_CHANNEL_STATE_DIALTONE || zchan->state == ZAP_CHANNEL_STATE_COLLECT) {
+ if ((dlen = zap_channel_dequeue_dtmf(zchan, dtmf + dtmf_offset, sizeof(dtmf) - strlen(dtmf)))) {
+
if (zchan->state == ZAP_CHANNEL_STATE_DIALTONE) {
zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_COLLECT);
collecting = 1;
}
-
zap_status_t zap_analog_start(zap_span_t *span)
{
zap_analog_data_t *analog_data = span->signal_data;
assert(zchan != NULL);
- if (zap_buffer_inuse(zchan->digit_buffer)) {
+ if (!zap_test_flag(zchan, ZAP_CHANNEL_READY)) {
+ return ZAP_FAIL;
+ }
+
+ if (zchan->digit_buffer && zap_buffer_inuse(zchan->digit_buffer)) {
zap_mutex_lock(zchan->mutex);
if ((bytes = zap_buffer_read(zchan->digit_buffer, dtmf, len)) > 0) {
*(dtmf + bytes) = '\0';
}
if (zap_test_flag(zchan, ZAP_CHANNEL_DTMF_DETECT)) {
-
teletone_dtmf_detect(&zchan->dtmf_detect, sln, (int)slen);
teletone_dtmf_get(&zchan->dtmf_detect, digit_str, sizeof(digit_str));
zap_span_close_all();
globals.running = 0;
- zap_sleep(200);
+ zap_sleep(1000);
for(i = 1; i <= globals.span_index; i++) {
zap_span_t *cur_span = &globals.spans[i];