mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 12:36:58 +00:00
Fixed transmitter hang problem
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5915 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
* Asterisk -- A telephony toolkit for Linux.
|
* Asterisk -- A telephony toolkit for Linux.
|
||||||
*
|
*
|
||||||
* Radio Repeater / Remote Base program
|
* Radio Repeater / Remote Base program
|
||||||
* version 0.24 05/15/05
|
* version 0.25 06/14/05
|
||||||
*
|
*
|
||||||
* See http://www.zapatatelephony.org/app_rpt.html
|
* See http://www.zapatatelephony.org/app_rpt.html
|
||||||
*
|
*
|
||||||
@@ -120,6 +120,10 @@ enum {SOURCE_RPT, SOURCE_LNK, SOURCE_RMT};
|
|||||||
|
|
||||||
enum {DLY_TELEM, DLY_ID, DLY_UNKEY, DLY_CALLTERM};
|
enum {DLY_TELEM, DLY_ID, DLY_UNKEY, DLY_CALLTERM};
|
||||||
|
|
||||||
|
#include "asterisk.h"
|
||||||
|
|
||||||
|
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -140,10 +144,6 @@ enum {DLY_TELEM, DLY_ID, DLY_UNKEY, DLY_CALLTERM};
|
|||||||
#include <tonezone.h>
|
#include <tonezone.h>
|
||||||
#include <linux/zaptel.h>
|
#include <linux/zaptel.h>
|
||||||
|
|
||||||
#include "asterisk.h"
|
|
||||||
|
|
||||||
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|
||||||
|
|
||||||
#include "asterisk/utils.h"
|
#include "asterisk/utils.h"
|
||||||
#include "asterisk/lock.h"
|
#include "asterisk/lock.h"
|
||||||
#include "asterisk/file.h"
|
#include "asterisk/file.h"
|
||||||
@@ -159,7 +159,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include "asterisk/say.h"
|
#include "asterisk/say.h"
|
||||||
#include "asterisk/localtime.h"
|
#include "asterisk/localtime.h"
|
||||||
|
|
||||||
static char *tdesc = "Radio Repeater / Remote Base version 0.24 05/15/2005";
|
static char *tdesc = "Radio Repeater / Remote Base version 0.25 06/14/2005";
|
||||||
|
|
||||||
static char *app = "Rpt";
|
static char *app = "Rpt";
|
||||||
|
|
||||||
@@ -409,7 +409,6 @@ static int rpt_do_debug(int fd, int argc, char *argv[])
|
|||||||
|
|
||||||
static int play_tone_pair(struct ast_channel *chan, int f1, int f2, int duration, int amplitude)
|
static int play_tone_pair(struct ast_channel *chan, int f1, int f2, int duration, int amplitude)
|
||||||
{
|
{
|
||||||
int flags = ZT_IOMUX_WRITEEMPTY;
|
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
if ((res = ast_tonepair_start(chan, f1, f2, duration, amplitude)))
|
if ((res = ast_tonepair_start(chan, f1, f2, duration, amplitude)))
|
||||||
@@ -419,13 +418,6 @@ static int play_tone_pair(struct ast_channel *chan, int f1, int f2, int duration
|
|||||||
if (ast_safe_sleep(chan,1)) return -1;
|
if (ast_safe_sleep(chan,1)) return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Wait for the zaptel driver to physically write the tone blocks to the hardware
|
|
||||||
*/
|
|
||||||
|
|
||||||
res = ioctl(chan->fds[0], ZT_IOMUX, &flags);
|
|
||||||
if (res < 0)
|
|
||||||
return -1;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -514,7 +506,8 @@ static struct morse_bits mbits[] = {
|
|||||||
int len, ddcomb;
|
int len, ddcomb;
|
||||||
int res;
|
int res;
|
||||||
int c;
|
int c;
|
||||||
|
int i;
|
||||||
|
int flags;
|
||||||
|
|
||||||
res = 0;
|
res = 0;
|
||||||
|
|
||||||
@@ -582,6 +575,22 @@ static struct morse_bits mbits[] = {
|
|||||||
res = ast_waitstream(chan, "");
|
res = ast_waitstream(chan, "");
|
||||||
ast_stopstream(chan);
|
ast_stopstream(chan);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Wait for the zaptel driver to physically write the tone blocks to the hardware
|
||||||
|
*/
|
||||||
|
|
||||||
|
for(i = 0; i < 20 ; i++){
|
||||||
|
flags = ZT_IOMUX_WRITEEMPTY | ZT_IOMUX_NOWAIT;
|
||||||
|
res = ioctl(chan->fds[0], ZT_IOMUX, &flags);
|
||||||
|
if(flags & ZT_IOMUX_WRITEEMPTY)
|
||||||
|
break;
|
||||||
|
if( ast_safe_sleep(chan, 50)){
|
||||||
|
res = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -593,6 +602,8 @@ static int send_tone_telemetry(struct ast_channel *chan, char *tonestring)
|
|||||||
int duration;
|
int duration;
|
||||||
int amplitude;
|
int amplitude;
|
||||||
int res;
|
int res;
|
||||||
|
int i;
|
||||||
|
int flags;
|
||||||
|
|
||||||
res = 0;
|
res = 0;
|
||||||
|
|
||||||
@@ -615,6 +626,21 @@ static int send_tone_telemetry(struct ast_channel *chan, char *tonestring)
|
|||||||
res = ast_waitstream(chan, "");
|
res = ast_waitstream(chan, "");
|
||||||
ast_stopstream(chan);
|
ast_stopstream(chan);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Wait for the zaptel driver to physically write the tone blocks to the hardware
|
||||||
|
*/
|
||||||
|
|
||||||
|
for(i = 0; i < 20 ; i++){
|
||||||
|
flags = ZT_IOMUX_WRITEEMPTY | ZT_IOMUX_NOWAIT;
|
||||||
|
res = ioctl(chan->fds[0], ZT_IOMUX, &flags);
|
||||||
|
if(flags & ZT_IOMUX_WRITEEMPTY)
|
||||||
|
break;
|
||||||
|
if( ast_safe_sleep(chan, 50)){
|
||||||
|
res = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user