diff options
-rwxr-xr-x | apps/app_dial.c | 2 | ||||
-rwxr-xr-x | channels/chan_zap.c | 31 | ||||
-rwxr-xr-x | configs/sip.conf.sample | 1 | ||||
-rwxr-xr-x | configs/zapata.conf.sample | 9 | ||||
-rwxr-xr-x | include/asterisk/channel.h | 2 |
5 files changed, 42 insertions, 3 deletions
diff --git a/apps/app_dial.c b/apps/app_dial.c index 4d36865a5..d13dfd9f1 100755 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -572,6 +572,8 @@ static int dial_exec(struct ast_channel *chan, void *data) tmp->chan->ani = NULL; /* Pass hidecallerid setting */ tmp->chan->restrictcid = chan->restrictcid; + /* Pass callingpres setting */ + tmp->chan->callingpres = chan->callingpres; /* Presense of ADSI CPE on outgoing channel follows ours */ tmp->chan->adsicpe = chan->adsicpe; /* Place the call, but don't wait on the answer */ diff --git a/channels/chan_zap.c b/channels/chan_zap.c index dd2216702..ac9515238 100755 --- a/channels/chan_zap.c +++ b/channels/chan_zap.c @@ -156,6 +156,8 @@ static int hidecallerid = 0; static int restrictcid = 0; +static int use_callingpres = 0; + static int callreturn = 0; static int threewaycalling = 0; @@ -385,7 +387,9 @@ static struct zt_pvt { int hidecallerid; int callreturn; int permhidecallerid; /* Whether to hide our outgoing caller ID or not */ - int restrictcid; + int restrictcid; /* Whether restrict the callerid -> only send ANI */ + int use_callingpres; /* Whether to use the callingpres the calling switch sends */ + int callingpres; /* The value of callling presentation that we're going to use when placing a PRI call */ int callwaitingrepeat; /* How many samples to wait before repeating call waiting */ int cidcwexpire; /* When to expire our muting for CID/CW */ unsigned char *cidspill; @@ -1497,7 +1501,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 ? (ast->restrictcid ? PRES_PROHIB_USER_NUMBER_PASSED_SCREEN : PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN) : PRES_NUMBER_NOT_AVAILABLE, + l ? (ast->restrictcid ? PRES_PROHIB_USER_NUMBER_PASSED_SCREEN : (p->use_callingpres ? ast->callingpres : 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); @@ -3760,6 +3764,7 @@ static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int tmp->ani = strdup(i->callerid); } tmp->restrictcid = i->restrictcid; + tmp->callingpres = i->callingpres; #ifdef ZAPATA_PRI /* Assume calls are not idle calls unless we're told differently */ i->isidlecall = 0; @@ -5123,6 +5128,7 @@ static struct zt_pvt *mkintf(int channel, int signalling, int radio) tmp->stripmsd = stripmsd; tmp->use_callerid = use_callerid; tmp->restrictcid = restrictcid; + tmp->use_callingpres = use_callingpres; strncpy(tmp->accountcode, accountcode, sizeof(tmp->accountcode)-1); tmp->amaflags = amaflags; if (!here) { @@ -5885,13 +5891,15 @@ static void *pri_dchannel(void *vpri) res = set_actual_gain(pri->pvt[chan]->subs[SUB_REAL].zfd, 0, pri->pvt[chan]->rxgain, pri->pvt[chan]->txgain, law); if (res < 0) ast_log(LOG_WARNING, "Unable to set gains on channel %d\n", pri->pvt[chan]->channel); - /* Start PBX */ if (e->ring.complete || !pri->overlapdial) { pri_acknowledge(pri->pri, e->ring.call, chan, 1); } else if (e->e==PRI_EVENT_RING) { /* If we got here directly and didn't send the SETUP_ACKNOWLEDGE we need to send it otherwise we don't sent anything */ pri_need_more_info(pri->pri, e->ring.call, chan, 1); } + /* Get the use_callingpres state */ + pri->pvt[chan]->callingpres = e->ring.callingpres; + /* Start PBX */ c = zt_new(pri->pvt[chan], AST_STATE_RING, 1, SUB_REAL, law); if (c) { if (option_verbose > 2) @@ -6595,6 +6603,20 @@ static struct ast_cli_entry cli_show_channel = { static struct ast_cli_entry cli_destroy_channel = { {"zap", "destroy", "channel", NULL}, zap_destroy_channel, "Destroy a channel", destroy_channel_usage, NULL }; +static char *synopsis_callingpres = "Change the presentation for the callerid"; +static char *descrip_callingpres = "Callingpres(number): Changes the presentation for the callerid. Should be called before placing an outgoing call\n"; +static char *app_callingpres = "CallingPres"; +static int change_callingpres(struct ast_channel *chan, void *data) +{ + int mode = 0; + if (data) { + mode = atoi((char *)data); + chan->callingpres = mode; + } else + ast_log(LOG_NOTICE, "Application %s requres an argument: %s(number)\n", app_callingpres,app_callingpres); + return 0; +} + int load_module() { struct ast_config *cfg; @@ -6757,6 +6779,8 @@ int load_module() strncpy(callerid, v->value, sizeof(callerid)-1); } else if (!strcasecmp(v->name, "restrictcid")) { restrictcid = ast_true(v->value); + } else if (!strcasecmp(v->name, "usecallingpres")) { + use_callingpres = ast_true(v->value); } else if (!strcasecmp(v->name, "accountcode")) { strncpy(accountcode, v->value, sizeof(accountcode)-1); } else if (!strcasecmp(v->name, "amaflags")) { @@ -6972,6 +6996,7 @@ int load_module() ast_cli_register(&cli_show_channels); ast_cli_register(&cli_show_channel); ast_cli_register(&cli_destroy_channel); + ast_register_application(app_callingpres, change_callingpres, synopsis_callingpres, descrip_callingpres); /* And start the monitor for the first time */ restart_monitor(); return 0; diff --git a/configs/sip.conf.sample b/configs/sip.conf.sample index 26356db72..99337b8b7 100755 --- a/configs/sip.conf.sample +++ b/configs/sip.conf.sample @@ -27,6 +27,7 @@ context = default ; Default for incoming calls ;dtmfmode=inband ; Choices are inband, rfc2833, or info ;defaultip=192.168.0.59 ;mailbox=1234,2345 ; Mailbox for message waiting indicator +;restrictcid=yes ; To have the callerid restriced -> sent as ANI ;[pingtel] ;type=friend diff --git a/configs/zapata.conf.sample b/configs/zapata.conf.sample index 22ce75b4c..70d41d37c 100755 --- a/configs/zapata.conf.sample +++ b/configs/zapata.conf.sample @@ -98,6 +98,15 @@ hidecallerid=no ; callwaiting=yes ; +; Whether or not restrict outgoing caller ID (will be sent as ANI only, not available for the user) +; Mostly use with FXS ports +; +;restrictcid=no +; +; Whether or not use the caller ID presentation for the outgoing call that the calling switch is sending +; +usecallingpres=yes +; ; Support Caller*ID on Call Waiting ; callwaitingcallerid=yes diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h index 16a148302..d90be73e6 100755 --- a/include/asterisk/channel.h +++ b/include/asterisk/channel.h @@ -155,6 +155,8 @@ struct ast_channel { char *rdnis; /*! Hide callerid from user */ int restrictcid; + /*! Callerid presentation/screening */ + int callingpres; /*! Current extension context */ |