static char musicclass[MAX_LANGUAGE] = "";
static int use_callerid = 1;
static char musicclass[MAX_LANGUAGE] = "";
static int use_callerid = 1;
+static int useincomingcalleridonzaptransfer = 0;
static int cur_signalling = -1;
static unsigned int cur_group = 0;
static int cur_signalling = -1;
static unsigned int cur_group = 0;
char musicclass[MAX_LANGUAGE];
char callerid[AST_MAX_EXTENSION];
char lastcallerid[AST_MAX_EXTENSION];
char musicclass[MAX_LANGUAGE];
char callerid[AST_MAX_EXTENSION];
char lastcallerid[AST_MAX_EXTENSION];
+ char *origcallerid; /* malloced original callerid */
char callwaitcid[AST_MAX_EXTENSION];
char rdnis[AST_MAX_EXTENSION];
char dnid[AST_MAX_EXTENSION];
char callwaitcid[AST_MAX_EXTENSION];
char rdnis[AST_MAX_EXTENSION];
char dnid[AST_MAX_EXTENSION];
int resetting;
int prioffset;
int alreadyhungup;
int resetting;
int prioffset;
int alreadyhungup;
+ int useincomingcalleridonzaptransfer;
#ifdef PRI_EVENT_PROCEEDING
int proceeding;
#endif
#ifdef PRI_EVENT_PROCEEDING
int proceeding;
#endif
x = 0;
zt_confmute(p, 0);
restore_gains(p);
x = 0;
zt_confmute(p, 0);
restore_gains(p);
+ if (p->origcallerid) {
+ strncpy(p->callerid, p->origcallerid, sizeof(p->callerid) - 1);
+ free(p->origcallerid);
+ p->origcallerid = NULL;
+ }
if (p->dsp)
ast_dsp_digitmode(p->dsp,DSP_DIGITMODE_DTMF | p->dtmfrelax);
if (p->dsp)
ast_dsp_digitmode(p->dsp,DSP_DIGITMODE_DTMF | p->dtmfrelax);
if (p->subs[SUB_REAL].owner->bridge)
ast_moh_stop(p->subs[SUB_REAL].owner->bridge);
} else if (!p->subs[SUB_THREEWAY].owner) {
if (p->subs[SUB_REAL].owner->bridge)
ast_moh_stop(p->subs[SUB_REAL].owner->bridge);
} else if (!p->subs[SUB_THREEWAY].owner) {
if (p->threewaycalling && !check_for_conference(p)) {
if (p->threewaycalling && !check_for_conference(p)) {
+ if (p->useincomingcalleridonzaptransfer && p->owner)
+ strncpy(callerid, p->owner->callerid, sizeof(callerid) - 1);
/* XXX This section needs much more error checking!!! XXX */
/* Start a 3-way call if feasible */
if ((ast->pbx) ||
/* XXX This section needs much more error checking!!! XXX */
/* Start a 3-way call if feasible */
if ((ast->pbx) ||
if (!alloc_sub(p, SUB_THREEWAY)) {
/* Make new channel */
chan = zt_new(p, AST_STATE_RESERVED, 0, SUB_THREEWAY, 0, 0);
if (!alloc_sub(p, SUB_THREEWAY)) {
/* Make new channel */
chan = zt_new(p, AST_STATE_RESERVED, 0, SUB_THREEWAY, 0, 0);
+ if (p->useincomingcalleridonzaptransfer) {
+ if (!p->origcallerid) {
+ p->origcallerid = malloc(strlen(p->callerid) + 1);
+ strncpy(p->origcallerid, p->callerid, strlen(p->callerid) + 1);
+ }
+ strncpy(p->callerid, callerid, sizeof(p->callerid) -1);
+ }
/* Swap things around between the three-way and real call */
swap_subs(p, SUB_THREEWAY, SUB_REAL);
/* Disable echo canceller for better dialing */
/* Swap things around between the three-way and real call */
swap_subs(p, SUB_THREEWAY, SUB_REAL);
/* Disable echo canceller for better dialing */
tmp->channel = channel;
tmp->stripmsd = stripmsd;
tmp->use_callerid = use_callerid;
tmp->channel = channel;
tmp->stripmsd = stripmsd;
tmp->use_callerid = use_callerid;
+ tmp->useincomingcalleridonzaptransfer = useincomingcalleridonzaptransfer;
tmp->restrictcid = restrictcid;
tmp->use_callingpres = use_callingpres;
strncpy(tmp->accountcode, accountcode, sizeof(tmp->accountcode)-1);
tmp->restrictcid = restrictcid;
tmp->use_callingpres = use_callingpres;
strncpy(tmp->accountcode, accountcode, sizeof(tmp->accountcode)-1);
strcpy(callerid,"");
else
strncpy(callerid, v->value, sizeof(callerid)-1);
strcpy(callerid,"");
else
strncpy(callerid, v->value, sizeof(callerid)-1);
+ } else if (!strcasecmp(v->name, "useincomingcalleridonzaptransfer")) {
+ useincomingcalleridonzaptransfer = ast_true(v->value);
} else if (!strcasecmp(v->name, "restrictcid")) {
restrictcid = ast_true(v->value);
} else if (!strcasecmp(v->name, "usecallingpres")) {
} else if (!strcasecmp(v->name, "restrictcid")) {
restrictcid = ast_true(v->value);
} else if (!strcasecmp(v->name, "usecallingpres")) {