Skip to content

Commit 8cd7548

Browse files
sig_analog: Allow immediate fake ring to be suppressed.
When immediate=yes on an FXS channel, sig_analog will start fake audible ringback that continues until the channel is answered. Even if it answers immediately, the ringback is still audible for a brief moment. This can be disruptive and unwanted behavior. This adds an option to disable this behavior, though the default behavior remains unchanged. ASTERISK-30003 #close Resolves: #118 UserNote: The immediatering option can now be set to no to suppress the fake audible ringback provided when immediate=yes on FXS channels.
1 parent a4e21ee commit 8cd7548

5 files changed

Lines changed: 23 additions & 1 deletion

File tree

channels/chan_dahdi.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,7 @@ static struct dahdi_chan_conf dahdi_chan_conf_default(void)
10381038
#endif
10391039
.chan = {
10401040
.context = "default",
1041+
.immediatering = 1,
10411042
.cid_num = "",
10421043
.cid_name = "",
10431044
.cid_tag = "",
@@ -12868,6 +12869,7 @@ static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf,
1286812869
}
1286912870
#endif
1287012871
tmp->immediate = conf->chan.immediate;
12872+
tmp->immediatering = conf->chan.immediatering;
1287112873
tmp->transfertobusy = conf->chan.transfertobusy;
1287212874
tmp->dialmode = conf->chan.dialmode;
1287312875
if (chan_sig & __DAHDI_SIG_FXS) {
@@ -13198,6 +13200,7 @@ static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf,
1319813200
analog_p->canpark = conf->chan.canpark;
1319913201
analog_p->dahditrcallerid = conf->chan.dahditrcallerid;
1320013202
analog_p->immediate = conf->chan.immediate;
13203+
analog_p->immediatering = conf->chan.immediatering;
1320113204
analog_p->permhidecallerid = conf->chan.hidecallerid; /* hidecallerid is the config setting, not permhidecallerid (~permcallwaiting above) */
1320213205
/* It's not necessary to set analog_p->hidecallerid here, sig_analog will set hidecallerid=permhidecaller before each call */
1320313206
analog_p->pulse = conf->chan.pulse;
@@ -18404,6 +18407,8 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
1840418407
}
1840518408
} else if (!strcasecmp(v->name, "immediate")) {
1840618409
confp->chan.immediate = ast_true(v->value);
18410+
} else if (!strcasecmp(v->name, "immediatering")) {
18411+
confp->chan.immediatering = ast_true(v->value);
1840718412
} else if (!strcasecmp(v->name, "transfertobusy")) {
1840818413
confp->chan.transfertobusy = ast_true(v->value);
1840918414
} else if (!strcasecmp(v->name, "dialmode")) {

channels/chan_dahdi.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,12 @@ struct dahdi_pvt {
299299
* \note Set from the "immediate" value read in from chan_dahdi.conf
300300
*/
301301
unsigned int immediate:1;
302+
/*!
303+
* \brief TRUE if audible ringback should be provided
304+
* when immediate = yes.
305+
* \note Set from the "immediatering" value read in from chan_dahdi.conf
306+
*/
307+
unsigned int immediatering:1;
302308
/*! \brief TRUE if in an alarm condition. */
303309
unsigned int inalarm:1;
304310
/*! \brief TRUE if TDD in MATE mode */

channels/sig_analog.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3815,7 +3815,10 @@ void *analog_handle_init_event(struct analog_pvt *i, int event)
38153815
if (i->immediate) {
38163816
analog_set_echocanceller(i, 1);
38173817
/* The channel is immediately up. Start right away */
3818-
res = analog_play_tone(i, ANALOG_SUB_REAL, ANALOG_TONE_RINGTONE);
3818+
if (i->immediatering) {
3819+
/* Play fake ringing, if we've been told to... */
3820+
res = analog_play_tone(i, ANALOG_SUB_REAL, ANALOG_TONE_RINGTONE);
3821+
}
38193822
chan = analog_new_ast_channel(i, AST_STATE_RING, 1, ANALOG_SUB_REAL, NULL);
38203823
if (!chan) {
38213824
ast_log(LOG_WARNING, "Unable to start PBX on channel %d\n", i->channel);

channels/sig_analog.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ struct analog_pvt {
295295
unsigned int dahditrcallerid:1; /*!< should we use the callerid from incoming call on dahdi transfer or not */
296296
unsigned int hanguponpolarityswitch:1;
297297
unsigned int immediate:1;
298+
unsigned int immediatering:1; /*!< TRUE if ringing should be provided for immediate execution */
298299
unsigned int permcallwaiting:1; /*!< TRUE if call waiting is enabled. (Configured option) */
299300
unsigned int permhidecallerid:1; /*!< Whether to hide our outgoing caller ID or not */
300301
unsigned int pulse:1;

configs/samples/chan_dahdi.conf.sample

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,6 +957,13 @@ pickupgroup=1
957957
;
958958
;immediate=yes
959959
;
960+
; On FXS channels (FXO signaled), specifies whether fake audible ringback should
961+
; be provided as soon as the channel goes off hook and immediate=yes.
962+
; If audio should come only from the dialplan, this option should be disabled.
963+
; Default is 'yes'
964+
;
965+
;immediatering=no
966+
;
960967
; Specify whether flash-hook transfers to 'busy' channels should complete or
961968
; return to the caller performing the transfer (default is yes).
962969
;

0 commit comments

Comments
 (0)