mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 04:30:28 +00:00
Added 'polite ID' concept in app_rpt.c and fixed a couple of silly telemetry issues.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3326 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.10 6/26/04
|
* version 0.11 6/27/04
|
||||||
*
|
*
|
||||||
* Copyright (C) 2002-2004, Jim Dixon, WB6NIL
|
* Copyright (C) 2002-2004, Jim Dixon, WB6NIL
|
||||||
*
|
*
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
enum {REM_OFF,REM_MONITOR,REM_TX};
|
enum {REM_OFF,REM_MONITOR,REM_TX};
|
||||||
|
|
||||||
enum{ID,PROC,TERM,COMPLETE,UNKEY,REMDISC,REMALREADY,REMNOTFOUND,REMGO,
|
enum{ID,PROC,TERM,COMPLETE,UNKEY,REMDISC,REMALREADY,REMNOTFOUND,REMGO,
|
||||||
CONNECTED,CONNFAIL,STATUS,TIMEOUT};
|
CONNECTED,CONNFAIL,STATUS,TIMEOUT,ID1};
|
||||||
|
|
||||||
enum {REM_SIMPLEX,REM_MINUS,REM_PLUS};
|
enum {REM_SIMPLEX,REM_MINUS,REM_PLUS};
|
||||||
|
|
||||||
@@ -131,6 +131,7 @@ LOCAL_USER_DECL;
|
|||||||
#define TOTIME 180000
|
#define TOTIME 180000
|
||||||
#define IDTIME 300000
|
#define IDTIME 300000
|
||||||
#define MAXRPTS 20
|
#define MAXRPTS 20
|
||||||
|
#define POLITEID 30000
|
||||||
|
|
||||||
static pthread_t rpt_master_thread;
|
static pthread_t rpt_master_thread;
|
||||||
|
|
||||||
@@ -196,6 +197,8 @@ static struct rpt
|
|||||||
pthread_t rpt_call_thread,rpt_thread;
|
pthread_t rpt_call_thread,rpt_thread;
|
||||||
time_t rem_dtmf_time,dtmf_time_rem;
|
time_t rem_dtmf_time,dtmf_time_rem;
|
||||||
int tailtimer,totimer,idtimer,txconf,conf,callmode,cidx;
|
int tailtimer,totimer,idtimer,txconf,conf,callmode,cidx;
|
||||||
|
int mustid;
|
||||||
|
int politeid;
|
||||||
int dtmfidx,rem_dtmfidx;
|
int dtmfidx,rem_dtmfidx;
|
||||||
char mydtmf;
|
char mydtmf;
|
||||||
int iobase;
|
int iobase;
|
||||||
@@ -231,7 +234,10 @@ struct ast_channel *mychannel;
|
|||||||
}
|
}
|
||||||
/* make a conference for the tx */
|
/* make a conference for the tx */
|
||||||
ci.chan = 0;
|
ci.chan = 0;
|
||||||
ci.confno = myrpt->conf; /* use the tx conference */
|
/* If there's an ID queued, only connect the ID audio to the local tx conference so
|
||||||
|
linked systems can't hear it */
|
||||||
|
ci.confno = (((mytele->mode == ID) || (mytele->mode == UNKEY)) ?
|
||||||
|
myrpt->txconf : myrpt->conf);
|
||||||
ci.confmode = ZT_CONF_CONFANN;
|
ci.confmode = ZT_CONF_CONFANN;
|
||||||
/* first put the channel on the conference in announce mode */
|
/* first put the channel on the conference in announce mode */
|
||||||
if (ioctl(mychannel->fds[0],ZT_SETCONF,&ci) == -1)
|
if (ioctl(mychannel->fds[0],ZT_SETCONF,&ci) == -1)
|
||||||
@@ -248,6 +254,9 @@ struct ast_channel *mychannel;
|
|||||||
switch(mytele->mode)
|
switch(mytele->mode)
|
||||||
{
|
{
|
||||||
case ID:
|
case ID:
|
||||||
|
case ID1:
|
||||||
|
/* wait a bit */
|
||||||
|
usleep(500000);
|
||||||
res = ast_streamfile(mychannel, myrpt->ident, mychannel->language);
|
res = ast_streamfile(mychannel, myrpt->ident, mychannel->language);
|
||||||
break;
|
break;
|
||||||
case PROC:
|
case PROC:
|
||||||
@@ -1087,7 +1096,7 @@ ZT_CONFINFO ci; /* conference info */
|
|||||||
return;
|
return;
|
||||||
case 8: /* force ID */
|
case 8: /* force ID */
|
||||||
if (!myrpt->enable) return;
|
if (!myrpt->enable) return;
|
||||||
myrpt->idtimer = 0;
|
rpt_telemetry(myrpt,ID1,NULL);
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
@@ -1852,11 +1861,12 @@ static void *rpt(void *this)
|
|||||||
{
|
{
|
||||||
struct rpt *myrpt = (struct rpt *)this;
|
struct rpt *myrpt = (struct rpt *)this;
|
||||||
char *tele;
|
char *tele;
|
||||||
int ms = MSWAIT,lasttx,keyed,val,remrx;
|
int ms = MSWAIT,lasttx,keyed,val,remrx,identqueued,nonidentqueued;
|
||||||
struct ast_channel *who;
|
struct ast_channel *who;
|
||||||
ZT_CONFINFO ci; /* conference info */
|
ZT_CONFINFO ci; /* conference info */
|
||||||
time_t dtmf_time,t;
|
time_t dtmf_time,t;
|
||||||
struct rpt_link *l,*m;
|
struct rpt_link *l,*m;
|
||||||
|
struct rpt_tele *telem;
|
||||||
pthread_attr_t attr;
|
pthread_attr_t attr;
|
||||||
|
|
||||||
ast_mutex_lock(&myrpt->lock);
|
ast_mutex_lock(&myrpt->lock);
|
||||||
@@ -1981,7 +1991,8 @@ pthread_attr_t attr;
|
|||||||
myrpt->links.prev = &myrpt->links;
|
myrpt->links.prev = &myrpt->links;
|
||||||
myrpt->tailtimer = 0;
|
myrpt->tailtimer = 0;
|
||||||
myrpt->totimer = 0;
|
myrpt->totimer = 0;
|
||||||
myrpt->idtimer = 0;
|
myrpt->idtimer = myrpt->politeid;
|
||||||
|
myrpt->mustid = 0;
|
||||||
myrpt->callmode = 0;
|
myrpt->callmode = 0;
|
||||||
myrpt->tounkeyed = 0;
|
myrpt->tounkeyed = 0;
|
||||||
myrpt->tonotify = 0;
|
myrpt->tonotify = 0;
|
||||||
@@ -2018,10 +2029,43 @@ pthread_attr_t attr;
|
|||||||
if (l->lastrx) remrx = 1;
|
if (l->lastrx) remrx = 1;
|
||||||
l = l->next;
|
l = l->next;
|
||||||
}
|
}
|
||||||
totx = (keyed || myrpt->callmode ||
|
|
||||||
(myrpt->tele.next != &myrpt->tele));
|
|
||||||
|
/* Create a "must_id" flag for the cleanup ID */
|
||||||
|
|
||||||
|
myrpt->mustid |= (myrpt->idtimer) && (keyed || remrx) ;
|
||||||
|
|
||||||
|
/* Build a fresh totx from keyed and autopatch activated */
|
||||||
|
|
||||||
|
totx = (keyed || myrpt->callmode);
|
||||||
|
|
||||||
|
/* Traverse the telemetry list to see if there's an ID queued and if there is not an ID queued */
|
||||||
|
|
||||||
|
identqueued = 0;
|
||||||
|
nonidentqueued = 0;
|
||||||
|
|
||||||
|
telem = myrpt->tele.next;
|
||||||
|
while(telem != &myrpt->tele)
|
||||||
|
{
|
||||||
|
if(telem->mode == ID)
|
||||||
|
identqueued = 1;
|
||||||
|
else
|
||||||
|
nonidentqueued = 1;
|
||||||
|
telem = telem->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Add in any non-id telemetry */
|
||||||
|
|
||||||
|
totx = totx || nonidentqueued;
|
||||||
|
|
||||||
|
/* Update external transmitter PTT state with everything but ID telemetry */
|
||||||
|
|
||||||
myrpt->exttx = totx;
|
myrpt->exttx = totx;
|
||||||
totx = totx || remrx;
|
|
||||||
|
/* Add in ID telemetry to local transmitter */
|
||||||
|
|
||||||
|
totx = totx || remrx || identqueued;
|
||||||
|
|
||||||
if (!totx)
|
if (!totx)
|
||||||
{
|
{
|
||||||
myrpt->totimer = myrpt->totime;
|
myrpt->totimer = myrpt->totime;
|
||||||
@@ -2059,10 +2103,16 @@ pthread_attr_t attr;
|
|||||||
if (!myrpt->totimer) myrpt->tailtimer = 0;
|
if (!myrpt->totimer) myrpt->tailtimer = 0;
|
||||||
/* if not timed-out, add in tail */
|
/* if not timed-out, add in tail */
|
||||||
if (myrpt->totimer) totx = totx || myrpt->tailtimer;
|
if (myrpt->totimer) totx = totx || myrpt->tailtimer;
|
||||||
/* if time to ID */
|
/* Try to be polite */
|
||||||
if (totx && (!myrpt->idtimer))
|
/* If the repeater has been inactive for longer than the ID time, do an initial ID in the tail*/
|
||||||
|
/* If within 30 seconds of the time to ID, try do it in the tail */
|
||||||
|
/* else if at ID time limit, do it right over the top of them */
|
||||||
|
/* Lastly, if the repeater has been keyed, and the ID timer is expired, do a clean up ID */
|
||||||
|
if (((totx && (!myrpt->exttx) && (myrpt->idtimer <= myrpt->politeid) && myrpt->tailtimer)) ||
|
||||||
|
(myrpt->mustid && (!myrpt->idtimer)))
|
||||||
{
|
{
|
||||||
myrpt->idtimer = myrpt->idtime;
|
myrpt->mustid = 0;
|
||||||
|
myrpt->idtimer = myrpt->idtime; /* Reset our ID timer */
|
||||||
ast_mutex_unlock(&myrpt->lock);
|
ast_mutex_unlock(&myrpt->lock);
|
||||||
rpt_telemetry(myrpt,ID,NULL);
|
rpt_telemetry(myrpt,ID,NULL);
|
||||||
ast_mutex_lock(&myrpt->lock);
|
ast_mutex_lock(&myrpt->lock);
|
||||||
@@ -2543,6 +2593,9 @@ int i,n;
|
|||||||
val = ast_variable_retrieve(cfg,this,"idtime");
|
val = ast_variable_retrieve(cfg,this,"idtime");
|
||||||
if (val) rpt_vars[n].idtime = atoi(val);
|
if (val) rpt_vars[n].idtime = atoi(val);
|
||||||
else rpt_vars[n].idtime = IDTIME;
|
else rpt_vars[n].idtime = IDTIME;
|
||||||
|
val = ast_variable_retrieve(cfg,this,"politeid");
|
||||||
|
if (val) rpt_vars[n].politeid = atoi(val);
|
||||||
|
else rpt_vars[n].politeid = POLITEID;
|
||||||
val = ast_variable_retrieve(cfg,this,"simple");
|
val = ast_variable_retrieve(cfg,this,"simple");
|
||||||
if (val) rpt_vars[n].simple = ast_true(val);
|
if (val) rpt_vars[n].simple = ast_true(val);
|
||||||
else rpt_vars[n].simple = 0;
|
else rpt_vars[n].simple = 0;
|
||||||
|
@@ -16,6 +16,9 @@
|
|||||||
;hangtime=1000 ; squelch tail hang time (in ms) (optional)
|
;hangtime=1000 ; squelch tail hang time (in ms) (optional)
|
||||||
;totime=100000 ; transmit time-out time (in ms) (optional)
|
;totime=100000 ; transmit time-out time (in ms) (optional)
|
||||||
;idtime=30000 ; id interval time (in ms) (optional)
|
;idtime=30000 ; id interval time (in ms) (optional)
|
||||||
|
politeid=30000 ; time in milliseconds before ID timer
|
||||||
|
; expires to try and ID in the tail.
|
||||||
|
; (optional, default is 30000).
|
||||||
|
|
||||||
; The default values for hangtime, time-out time, and id interval time are
|
; The default values for hangtime, time-out time, and id interval time are
|
||||||
; 5 seconds (5000 ms), 3 minutes (180000 ms), and 5 minutes (300000 ms)
|
; 5 seconds (5000 ms), 3 minutes (180000 ms), and 5 minutes (300000 ms)
|
||||||
@@ -51,6 +54,9 @@
|
|||||||
000 = context_A@1.2.3.4/1234
|
000 = context_A@1.2.3.4/1234
|
||||||
001 = context_B@5.6.7.8/4321
|
001 = context_B@5.6.7.8/4321
|
||||||
|
|
||||||
|
;of course, you can also specify these with domain names, but why rely
|
||||||
|
;on DNS working unnecessarily?
|
||||||
|
|
||||||
[memory]
|
[memory]
|
||||||
|
|
||||||
; this example gives you 146.460, simplex, 100.0 HZ PL, hi-power, transmit PL
|
; this example gives you 146.460, simplex, 100.0 HZ PL, hi-power, transmit PL
|
||||||
@@ -58,4 +64,8 @@
|
|||||||
; this example gives you 146.940, minus offset, 100.0 HZ PL, low-power, no PL
|
; this example gives you 146.940, minus offset, 100.0 HZ PL, low-power, no PL
|
||||||
01 = 146.940,100.0,-l
|
01 = 146.940,100.0,-l
|
||||||
|
|
||||||
|
; The format for these entries is: Receive-Freq,Receive-PL,Attrbutes
|
||||||
|
; Attributes: l=low power, m=medium power, h=high power, -=minus offset,
|
||||||
|
; s=simplex, +=plus offset, t=tx PL enable, r=rx PL enable
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user