ast_channel_setoption(ast,AST_OPTION_TDD,&x,sizeof(char),0);
p->callwaitcas = 0;
analog_set_callwaiting(p, p->permcallwaiting);
+ /* In theory, the below is not necessary since we set hidecallerid = permhidecaller when calls start,
+ * but this ensures the setting is defaulted properly when channels are idle, too. */
p->hidecallerid = p->permhidecallerid;
analog_set_dialing(p, 0);
analog_update_conf(p);
case ANALOG_SIG_FXOLS:
case ANALOG_SIG_FXOGS:
case ANALOG_SIG_FXOKS:
+ /* Set our default presentation.
+ * This is necessary because the presentation for each call is independent
+ * (though the default may be the same).
+ * For example, if hidecallerid=yes and somebody makes a call with *82,
+ * then makes a 3-way call, the presentation for the 2nd call should still
+ * be blocked, unless that also had a *82.
+ * For this reason, setting hidecallerid = permhidecallerid on hangup
+ * is NOT sufficient, as the *82 from the first call could "leak" into
+ * subsequent ones made before a hangup, improperly leaking a number
+ * that should have been hidden.
+ */
+ p->hidecallerid = p->permhidecallerid;
+
/* Read the first digit */
timeout = analog_get_firstdigit_timeout(p);
/* If starting a threeway call, never timeout on the first digit so someone
res = analog_play_tone(p, idx, -1);
ast_channel_lock(chan);
ast_channel_exten_set(chan, exten);
- if (!ast_strlen_zero(p->cid_num)) {
- if (!p->hidecallerid) {
- ast_set_callerid(chan, p->cid_num, NULL, p->cid_num);
- } else {
- ast_set_callerid(chan, NULL, NULL, p->cid_num);
- }
- }
- if (!ast_strlen_zero(p->cid_name)) {
- if (!p->hidecallerid) {
- ast_set_callerid(chan, NULL, p->cid_name, NULL);
- }
+
+ /* Properly set the presentation.
+ * We need to do this here as well, because p->hidecallerid might be set
+ * due to permanent blocking, not star-67/star-82 usage. */
+ if (p->hidecallerid) {
+ ast_channel_caller(chan)->id.number.presentation = AST_PRES_PROHIB_USER_NUMBER_NOT_SCREENED;
+ ast_channel_caller(chan)->id.name.presentation = AST_PRES_PROHIB_USER_NUMBER_NOT_SCREENED;
+ } else {
+ ast_channel_caller(chan)->id.number.presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED;
+ ast_channel_caller(chan)->id.name.presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED;
}
+
ast_setstate(chan, AST_STATE_RING);
ast_channel_unlock(chan);
analog_set_echocanceller(p, 1);
ast_hangup(chan);
goto quit;
}
-
+ /* While the DMS-100 allows dialing as many *67s and *82s in succession as one's heart may desire,
+ * the 5ESS does not, it only allows pure toggling (and only once!). So, it's not incorrect
+ * to prevent people from dialing *67 if that won't actually do anything. */
} else if (!p->hidecallerid && !strcmp(exten, "*67")) {
- ast_verb(3, "Disabling Caller*ID on %s\n", ast_channel_name(chan));
+ ast_verb(3, "Blocking Caller*ID on %s\n", ast_channel_name(chan));
/* Disable Caller*ID if enabled */
p->hidecallerid = 1;
ast_channel_caller(chan)->id.number.presentation = AST_PRES_PROHIB_USER_NUMBER_NOT_SCREENED;
len = 0;
}
} else if (p->hidecallerid && !strcmp(exten, "*82")) {
- ast_verb(3, "Enabling Caller*ID on %s\n", ast_channel_name(chan));
+ ast_verb(3, "Allowing Caller*ID on %s\n", ast_channel_name(chan));
/* Enable Caller*ID if enabled */
p->hidecallerid = 0;
ast_channel_caller(chan)->id.number.presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED;