diff --git a/src/bnetz/bnetz.c b/src/bnetz/bnetz.c index 6c75997..2c96d80 100644 --- a/src/bnetz/bnetz.c +++ b/src/bnetz/bnetz.c @@ -29,6 +29,9 @@ #include "bnetz.h" #include "dsp.h" +// Uncomment this to generate a dial sequnce (for testing) +//#define GEN_DIALSEQUENCE + /* Call reference for calls from mobile station to network This offset of 0x400000000 is required for MNCC interface. */ static int new_callref = 0x40000000; @@ -354,6 +357,12 @@ static void bnetz_go_idle(bnetz_t *bnetz) bnetz_set_dsp_mode(bnetz, DSP_MODE_TELEGRAMM); switch_channel_19(bnetz, 0); bnetz->station_id[0] = '\0'; +#ifdef GEN_DIALSEQUENCE + if (bnetz->sender.loopback) { + bnetz_set_dsp_mode(bnetz, DSP_MODE_0); + timer_start(&bnetz->timer, 0.6); + } +#endif } /* Release connection towards mobile station by sending release digits. */ @@ -390,10 +399,21 @@ const char *bnetz_get_telegramm(bnetz_t *bnetz) struct impulstelegramme *it = NULL; if (bnetz->sender.loopback) { +#ifdef GEN_DIALSEQUENCE + char *dialstring="s50993310es50993310e", c; + c = dialstring[bnetz->loopback_count++]; + if (c) { + it = bnetz_telegramm(c); + } else { + bnetz_set_dsp_mode(bnetz, DSP_MODE_SILENCE); + return NULL; + } +#else bnetz->loopback_time[bnetz->loopback_count] = get_time(); it = bnetz_telegramm(bnetz->loopback_count + '0'); if (++bnetz->loopback_count > 9) bnetz->loopback_count = 0; +#endif } else switch(bnetz->state) { case BNETZ_FREI: @@ -683,6 +703,11 @@ static void bnetz_timeout(struct timer *timer) bnetz_t *bnetz = (bnetz_t *)timer->priv; switch (bnetz->state) { +#ifdef GEN_DIALSEQUENCE + case BNETZ_FREI: + bnetz_set_dsp_mode(bnetz, DSP_MODE_TELEGRAMM); + break; +#endif case BNETZ_WAHLABRUF: PDEBUG(DBNETZ, DEBUG_NOTICE, "Timeout while receiving call setup from mobile station, aborting.\n"); bnetz_go_idle(bnetz);