mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-09 06:28:14 +00:00
Add restrictcid=[yes|no] for chan_zap and chan_sip. You can specify if the sip/zap users will have the callerid transmitted as ANI or CALLERID.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1476 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -568,6 +568,8 @@ static int dial_exec(struct ast_channel *chan, void *data)
|
||||
tmp->chan->ani = strdup(chan->ani);
|
||||
else
|
||||
tmp->chan->ani = NULL;
|
||||
/* Pass hidecallerid setting */
|
||||
tmp->chan->restrictcid = chan->restrictcid;
|
||||
/* Presense of ADSI CPE on outgoing channel follows ours */
|
||||
tmp->chan->adsicpe = chan->adsicpe;
|
||||
/* Place the call, but don't wait on the answer */
|
||||
|
@@ -62,6 +62,8 @@
|
||||
#define DEFAULT_MAX_EXPIRY 3600
|
||||
#define EXPIRY_GUARD_SECS 15
|
||||
|
||||
#define CALLERID_UNKNOWN "Unknown"
|
||||
|
||||
#define SIP_DTMF_RFC2833 (1 << 0)
|
||||
#define SIP_DTMF_INBAND (1 << 1)
|
||||
#define SIP_DTMF_INFO (1 << 2)
|
||||
@@ -217,6 +219,7 @@ static struct sip_pvt {
|
||||
char uri[81]; /* Original requested URI */
|
||||
char peersecret[81];
|
||||
char callerid[256]; /* Caller*ID */
|
||||
int restrictcid; /* hide presentation from remote user */
|
||||
char via[256];
|
||||
char accountcode[20]; /* Account code */
|
||||
char our_contact[256]; /* Our contact header */
|
||||
@@ -276,6 +279,7 @@ struct sip_user {
|
||||
int dtmfmode;
|
||||
int inUse;
|
||||
int incominglimit;
|
||||
int restrictcid;
|
||||
struct ast_ha *ha;
|
||||
struct sip_user *next;
|
||||
};
|
||||
@@ -846,6 +850,7 @@ static int sip_call(struct ast_channel *ast, char *dest, int timeout)
|
||||
|
||||
res = 0;
|
||||
p->outgoing = 1;
|
||||
p->restrictcid = ast->restrictcid;
|
||||
transmit_invite(p, "INVITE", 1, NULL, vxml_url,distinctive_ring, 1);
|
||||
if (p->maxtime) {
|
||||
/* Initialize auto-congest time */
|
||||
@@ -1240,6 +1245,7 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, char *title)
|
||||
|
||||
tmp->callgroup = i->callgroup;
|
||||
tmp->pickupgroup = i->pickupgroup;
|
||||
tmp->restrictcid = i->restrictcid;
|
||||
if (strlen(i->accountcode))
|
||||
strncpy(tmp->accountcode, i->accountcode, sizeof(tmp->accountcode)-1);
|
||||
if (i->amaflags)
|
||||
@@ -2607,6 +2613,9 @@ static void initreqprep(struct sip_request *req, struct sip_pvt *p, char *cmd, c
|
||||
if (!l || !ast_isphonenumber(l))
|
||||
l = callerid;
|
||||
}
|
||||
/* if user want's his callerid restricted */
|
||||
if (p->restrictcid)
|
||||
l = CALLERID_UNKNOWN;
|
||||
if (!n || !strlen(n))
|
||||
n = l;
|
||||
/* Allow user to be overridden */
|
||||
@@ -3800,6 +3809,7 @@ static int check_user(struct sip_pvt *p, struct sip_request *req, char *cmd, cha
|
||||
p->amaflags = user->amaflags;
|
||||
p->callgroup = user->callgroup;
|
||||
p->pickupgroup = user->pickupgroup;
|
||||
p->restrictcid = user->restrictcid;
|
||||
if (user->dtmfmode) {
|
||||
p->dtmfmode = user->dtmfmode;
|
||||
if (p->dtmfmode & SIP_DTMF_RFC2833)
|
||||
@@ -5541,6 +5551,8 @@ static struct sip_user *build_user(char *name, struct ast_variable *v)
|
||||
}
|
||||
} else if (!strcasecmp(v->name, "insecure")) {
|
||||
user->insecure = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "restrictcid")) {
|
||||
user->restrictcid = ast_true(v->value);
|
||||
} //else if (strcasecmp(v->name,"type"))
|
||||
// ast_log(LOG_WARNING, "Ignoring %s\n", v->name);
|
||||
v = v->next;
|
||||
|
@@ -153,6 +153,8 @@ static int callwaitingcallerid = 0;
|
||||
|
||||
static int hidecallerid = 0;
|
||||
|
||||
static int restrictcid = 0;
|
||||
|
||||
static int callreturn = 0;
|
||||
|
||||
static int threewaycalling = 0;
|
||||
@@ -382,6 +384,7 @@ static struct zt_pvt {
|
||||
int hidecallerid;
|
||||
int callreturn;
|
||||
int permhidecallerid; /* Whether to hide our outgoing caller ID or not */
|
||||
int restrictcid;
|
||||
int callwaitingrepeat; /* How many samples to wait before repeating call waiting */
|
||||
int cidcwexpire; /* When to expire our muting for CID/CW */
|
||||
unsigned char *cidspill;
|
||||
@@ -1476,7 +1479,7 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
|
||||
}
|
||||
if (pri_call(p->pri->pri, p->call, p->digital ? PRI_TRANS_CAP_DIGITAL : PRI_TRANS_CAP_SPEECH,
|
||||
p->prioffset, p->pri->nodetype == PRI_NETWORK ? 0 : 1, 1, l, p->pri->dialplan - 1, n,
|
||||
l ? PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN : PRES_NUMBER_NOT_AVAILABLE,
|
||||
l ? (ast->restrictcid ? PRES_PROHIB_USER_NUMBER_PASSED_SCREEN : PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN) : PRES_NUMBER_NOT_AVAILABLE,
|
||||
c + p->stripmsd, p->pri->dialplan - 1,
|
||||
((p->law == ZT_LAW_ALAW) ? PRI_LAYER_1_ALAW : PRI_LAYER_1_ULAW))) {
|
||||
ast_log(LOG_WARNING, "Unable to setup call to %s\n", c + p->stripmsd);
|
||||
@@ -3738,6 +3741,7 @@ static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int
|
||||
tmp->callerid = strdup(i->callerid);
|
||||
tmp->ani = strdup(i->callerid);
|
||||
}
|
||||
tmp->restrictcid = i->restrictcid;
|
||||
#ifdef ZAPATA_PRI
|
||||
/* Assume calls are not idle calls unless we're told differently */
|
||||
i->isidlecall = 0;
|
||||
@@ -5098,6 +5102,7 @@ static struct zt_pvt *mkintf(int channel, int signalling, int radio)
|
||||
tmp->channel = channel;
|
||||
tmp->stripmsd = stripmsd;
|
||||
tmp->use_callerid = use_callerid;
|
||||
tmp->restrictcid = restrictcid;
|
||||
strncpy(tmp->accountcode, accountcode, sizeof(tmp->accountcode)-1);
|
||||
tmp->amaflags = amaflags;
|
||||
if (!here) {
|
||||
@@ -6713,6 +6718,8 @@ int load_module()
|
||||
strcpy(callerid,"");
|
||||
else
|
||||
strncpy(callerid, v->value, sizeof(callerid)-1);
|
||||
} else if (!strcasecmp(v->name, "restrictcid")) {
|
||||
restrictcid = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "accountcode")) {
|
||||
strncpy(accountcode, v->value, sizeof(accountcode)-1);
|
||||
} else if (!strcasecmp(v->name, "amaflags")) {
|
||||
|
@@ -152,6 +152,8 @@ struct ast_channel {
|
||||
char *ani;
|
||||
/*! Malloc'd RDNIS */
|
||||
char *rdnis;
|
||||
/*! Hide callerid from user */
|
||||
int restrictcid;
|
||||
|
||||
|
||||
/*! Current extension context */
|
||||
|
Reference in New Issue
Block a user