switch (handle->state) {
case FSK_STATE_DATA:
- (*handle->attr.bithandler) (handle->attr.bithandler_arg, handle->current_bit);
+ {
+ (*handle->attr.bithandler) (handle->attr.bithandler_arg, handle->current_bit);
+ }
break;
case FSK_STATE_CHANSEIZE:
- if (handle->last_bit != handle->current_bit) {
-
-
- handle->conscutive_state_bits++;
- } else {
- handle->conscutive_state_bits = 0;
- }
- if (handle->conscutive_state_bits > 15) {
- handle->state = FSK_STATE_CARRIERSIG;
- handle->conscutive_state_bits = 0;
+ {
+ if (handle->last_bit != handle->current_bit) {
+ handle->conscutive_state_bits++;
+ } else {
+ handle->conscutive_state_bits = 0;
+ }
+
+ if (handle->conscutive_state_bits > 15) {
+ handle->state = FSK_STATE_CARRIERSIG;
+ handle->conscutive_state_bits = 0;
+ }
}
break;
case FSK_STATE_CARRIERSIG:
- if (handle->current_bit) {
- handle->conscutive_state_bits++;
- } else {
- handle->conscutive_state_bits = 0;
- }
- if (handle->conscutive_state_bits > 15) {
- handle->state = FSK_STATE_DATA;
- handle->conscutive_state_bits = 0;
+ {
+ if (handle->current_bit) {
+ handle->conscutive_state_bits++;
+ } else {
+ handle->conscutive_state_bits = 0;
+ }
+
+ if (handle->conscutive_state_bits > 15) {
+ handle->state = FSK_STATE_DATA;
+ handle->conscutive_state_bits = 0;
+ }
}
break;
}
zap_filehandle_t fds[2];
zap_fsk_data_state_t fsk;
uint8_t fsk_buf[80];
+ uint32_t ring_count;
struct zap_caller_data caller_data;
struct zap_span *span;
struct zap_io_interface *zio;
handle = malloc(sizeof (*handle));
if (handle) {
- memset(handle, 0, sizeof (handle));
+ memset(handle, 0, sizeof (*handle));
/* fill the attributes member */
memcpy(&handle->attr, attr, sizeof (*attr));
handle->data >>= 1;
handle->data |= 0x80 * !!bit;
-
handle->nbits++;
+
if (handle->nbits == 8) {
handle->attr.bytehandler(handle->attr.bytehandler_arg, handle->data);
handle->nbits = 0;
case ZAP_CHANNEL_STATE_GET_CALLERID:
{
zap_channel_done(chan);
+ zap_channel_command(chan, ZAP_COMMAND_TRACE_INPUT, "/tmp/wtf.ul");
zap_channel_command(chan, ZAP_COMMAND_ENABLE_CALLERID_DETECT, NULL);
+ continue;
}
break;
case ZAP_CHANNEL_STATE_RING:
if (event->channel->state == ZAP_CHANNEL_STATE_DOWN && !zap_test_flag(event->channel, ZAP_CHANNEL_INTHREAD)) {
zap_set_state_locked(event->channel, ZAP_CHANNEL_STATE_GET_CALLERID);
+ event->channel->ring_count = 1;
zap_thread_create_detached(zap_analog_channel_run, event->channel);
+ } else {
+ event->channel->ring_count++;
}
}
break;
dsp_fsk_destroy(&state->fsk1200_handle);
}
+ memset(state, 0, sizeof(*state));
+ memset(buf, 0, bufsize);
state->buf = buf;
state->bufsize = bufsize;
if (zap_fsk_demod_feed(&zchan->fsk, sln, slen) != ZAP_SUCCESS) {
uint32_t type, mlen;
char str[128], *sp;
-
-
+
while(zap_fsk_data_parse(&zchan->fsk, &type, &sp, &mlen) == ZAP_SUCCESS) {
*(str+mlen) = '\0';
zap_copy_string(str, sp, ++mlen);
zap_clean_string(str);
- zap_log(ZAP_LOG_DEBUG, "FSK: TYPE %s LEN %d VAL [%s]\n", zap_mdmf_type2str(type), mlen-1, str);
+ zap_log(ZAP_LOG_ERROR, "FSK: TYPE %s LEN %d VAL [%s]\n", zap_mdmf_type2str(type), mlen-1, str);
switch(type) {
case MDMF_DDN: