mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 11:58:52 +00:00
sig_analog: Add Last Number Redial feature.
This adds the Last Number Redial feature to
simple switch.
UserNote: Users can now redial the last number
called if the lastnumredial setting is set to yes.
Resolves: #437
(cherry picked from commit 198300c570
)
This commit is contained in:
committed by
Asterisk Development Team
parent
880d5d13b2
commit
3060effc92
@@ -13109,6 +13109,7 @@ static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf,
|
||||
tmp->permhidecallerid = conf->chan.hidecallerid;
|
||||
tmp->hidecalleridname = conf->chan.hidecalleridname;
|
||||
tmp->callreturn = conf->chan.callreturn;
|
||||
tmp->lastnumredial = conf->chan.lastnumredial; /* Not used in DAHDI pvt, only analog pvt */
|
||||
tmp->echocancel = conf->chan.echocancel;
|
||||
tmp->echotraining = conf->chan.echotraining;
|
||||
tmp->pulse = conf->chan.pulse;
|
||||
@@ -13404,6 +13405,7 @@ static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf,
|
||||
analog_p->permcallwaiting = conf->chan.callwaiting; /* permcallwaiting possibly modified in analog_config_complete */
|
||||
analog_p->calledsubscriberheld = conf->chan.calledsubscriberheld; /* Only actually used in analog pvt, not DAHDI pvt */
|
||||
analog_p->callreturn = conf->chan.callreturn;
|
||||
analog_p->lastnumredial = conf->chan.lastnumredial; /* Only actually used in analog pvt, not DAHDI pvt */
|
||||
analog_p->cancallforward = conf->chan.cancallforward;
|
||||
analog_p->canpark = conf->chan.canpark;
|
||||
analog_p->dahditrcallerid = conf->chan.dahditrcallerid;
|
||||
@@ -18653,6 +18655,8 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
|
||||
parse_busy_pattern(v, &confp->chan.busy_cadence);
|
||||
} else if (!strcasecmp(v->name, "calledsubscriberheld")) {
|
||||
confp->chan.calledsubscriberheld = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "lastnumredial")) {
|
||||
confp->chan.lastnumredial = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "callprogress")) {
|
||||
confp->chan.callprogress &= ~CALLPROGRESS_PROGRESS;
|
||||
if (ast_true(v->value))
|
||||
|
@@ -440,6 +440,8 @@ struct dahdi_pvt {
|
||||
* \note Used by SS7. Otherwise set but not used.
|
||||
*/
|
||||
unsigned int inservice:1;
|
||||
/*! *\brief TRUE if last number redial enabled */
|
||||
unsigned int lastnumredial:1;
|
||||
/*!
|
||||
* \brief Bitmask for the channel being locally blocked.
|
||||
* \note Applies to SS7 and MFCR2 channels.
|
||||
|
@@ -1721,6 +1721,9 @@ static int analog_canmatch_featurecode(const char *pickupexten, const char *exte
|
||||
if (extlen < strlen(pickupexten) && !strncmp(pickupexten, exten, extlen)) {
|
||||
return 1;
|
||||
}
|
||||
if (exten[0] == '#' && extlen < 2) {
|
||||
return 1; /* Could match ## */
|
||||
}
|
||||
/* hardcoded features are *60, *67, *69, *70, *72, *73, *78, *79, *82, *0 */
|
||||
if (exten[0] == '*' && extlen < 3) {
|
||||
if (extlen == 1) {
|
||||
@@ -2208,6 +2211,19 @@ static void *__analog_ss_thread(void *data)
|
||||
if (ast_parking_provider_registered()) {
|
||||
is_exten_parking = ast_parking_is_exten_park(ast_channel_context(chan), exten);
|
||||
}
|
||||
if (p->lastnumredial && !strcmp(exten, "##") && !ast_exists_extension(chan, ast_channel_context(chan), "##", 1, p->cid_num)) {
|
||||
/* Last Number Redial */
|
||||
if (!ast_strlen_zero(p->lastexten)) {
|
||||
ast_verb(4, "Redialing last number dialed on channel %d\n", p->channel);
|
||||
ast_copy_string(exten, p->lastexten, sizeof(exten));
|
||||
} else {
|
||||
ast_verb(3, "Last Number Redial not possible on channel %d (no saved number)\n", p->channel);
|
||||
res = analog_play_tone(p, idx, ANALOG_TONE_CONGESTION);
|
||||
analog_wait_event(p);
|
||||
ast_hangup(chan);
|
||||
goto quit;
|
||||
}
|
||||
}
|
||||
if (ast_exists_extension(chan, ast_channel_context(chan), exten, 1, p->cid_num) && !is_exten_parking) {
|
||||
if (!res || !ast_matchmore_extension(chan, ast_channel_context(chan), exten, 1, p->cid_num)) {
|
||||
if (getforward) {
|
||||
@@ -2230,6 +2246,11 @@ static void *__analog_ss_thread(void *data)
|
||||
ast_channel_lock(chan);
|
||||
ast_channel_exten_set(chan, exten);
|
||||
|
||||
/* Save the last number dialed, for Last Number Redial. */
|
||||
if (!p->immediate) {
|
||||
ast_copy_string(p->lastexten, exten, sizeof(p->lastexten));
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
|
@@ -297,6 +297,7 @@ struct analog_pvt {
|
||||
unsigned int hanguponpolarityswitch:1;
|
||||
unsigned int immediate:1;
|
||||
unsigned int immediatering:1; /*!< TRUE if ringing should be provided for immediate execution */
|
||||
unsigned int lastnumredial:1; /*!< TRUE if last number redial allowed */
|
||||
unsigned int permcallwaiting:1; /*!< TRUE if call waiting is enabled. (Configured option) */
|
||||
unsigned int permhidecallerid:1; /*!< Whether to hide our outgoing caller ID or not */
|
||||
unsigned int pulse:1;
|
||||
@@ -352,6 +353,7 @@ struct analog_pvt {
|
||||
char callwait_name[AST_MAX_EXTENSION];
|
||||
char lastcid_num[AST_MAX_EXTENSION];
|
||||
char lastcid_name[AST_MAX_EXTENSION];
|
||||
char lastexten[AST_MAX_EXTENSION]; /*!< Last number dialed */
|
||||
struct ast_party_caller caller;
|
||||
int redirecting_reason; /*!< Redirecting reason */
|
||||
|
||||
|
@@ -814,6 +814,11 @@ cancallforward=yes
|
||||
;
|
||||
callreturn=yes
|
||||
;
|
||||
; Whether or not to allow redialing the last number called using Last Number Redial
|
||||
; (##, if your dialplan doesn't catch this first)
|
||||
;
|
||||
;lastnumredial=yes
|
||||
;
|
||||
; Stutter dialtone support: If voicemail is received in the mailbox then
|
||||
; taking the phone off hook will cause a stutter dialtone instead of a
|
||||
; normal one.
|
||||
|
Reference in New Issue
Block a user