Skip to content

Commit

Permalink
sig_analog: Allow immediate fake ring to be suppressed.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
InterLinked1 authored and asterisk-org-access-app[bot] committed Jul 10, 2023
1 parent a4e21ee commit 8cd7548
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
5 changes: 5 additions & 0 deletions channels/chan_dahdi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,7 @@ static struct dahdi_chan_conf dahdi_chan_conf_default(void)
#endif
.chan = {
.context = "default",
.immediatering = 1,
.cid_num = "",
.cid_name = "",
.cid_tag = "",
Expand Down Expand Up @@ -12868,6 +12869,7 @@ static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf,
}
#endif
tmp->immediate = conf->chan.immediate;
tmp->immediatering = conf->chan.immediatering;
tmp->transfertobusy = conf->chan.transfertobusy;
tmp->dialmode = conf->chan.dialmode;
if (chan_sig & __DAHDI_SIG_FXS) {
Expand Down Expand Up @@ -13198,6 +13200,7 @@ static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf,
analog_p->canpark = conf->chan.canpark;
analog_p->dahditrcallerid = conf->chan.dahditrcallerid;
analog_p->immediate = conf->chan.immediate;
analog_p->immediatering = conf->chan.immediatering;
analog_p->permhidecallerid = conf->chan.hidecallerid; /* hidecallerid is the config setting, not permhidecallerid (~permcallwaiting above) */
/* It's not necessary to set analog_p->hidecallerid here, sig_analog will set hidecallerid=permhidecaller before each call */
analog_p->pulse = conf->chan.pulse;
Expand Down Expand Up @@ -18404,6 +18407,8 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
}
} else if (!strcasecmp(v->name, "immediate")) {
confp->chan.immediate = ast_true(v->value);
} else if (!strcasecmp(v->name, "immediatering")) {
confp->chan.immediatering = ast_true(v->value);
} else if (!strcasecmp(v->name, "transfertobusy")) {
confp->chan.transfertobusy = ast_true(v->value);
} else if (!strcasecmp(v->name, "dialmode")) {
Expand Down
6 changes: 6 additions & 0 deletions channels/chan_dahdi.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,12 @@ struct dahdi_pvt {
* \note Set from the "immediate" value read in from chan_dahdi.conf
*/
unsigned int immediate:1;
/*!
* \brief TRUE if audible ringback should be provided
* when immediate = yes.
* \note Set from the "immediatering" value read in from chan_dahdi.conf
*/
unsigned int immediatering:1;
/*! \brief TRUE if in an alarm condition. */
unsigned int inalarm:1;
/*! \brief TRUE if TDD in MATE mode */
Expand Down
5 changes: 4 additions & 1 deletion channels/sig_analog.c
Original file line number Diff line number Diff line change
Expand Up @@ -3815,7 +3815,10 @@ void *analog_handle_init_event(struct analog_pvt *i, int event)
if (i->immediate) {
analog_set_echocanceller(i, 1);
/* The channel is immediately up. Start right away */
res = analog_play_tone(i, ANALOG_SUB_REAL, ANALOG_TONE_RINGTONE);
if (i->immediatering) {
/* Play fake ringing, if we've been told to... */
res = analog_play_tone(i, ANALOG_SUB_REAL, ANALOG_TONE_RINGTONE);
}
chan = analog_new_ast_channel(i, AST_STATE_RING, 1, ANALOG_SUB_REAL, NULL);
if (!chan) {
ast_log(LOG_WARNING, "Unable to start PBX on channel %d\n", i->channel);
Expand Down
1 change: 1 addition & 0 deletions channels/sig_analog.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ struct analog_pvt {
unsigned int dahditrcallerid:1; /*!< should we use the callerid from incoming call on dahdi transfer or not */
unsigned int hanguponpolarityswitch:1;
unsigned int immediate:1;
unsigned int immediatering:1; /*!< TRUE if ringing should be provided for immediate execution */
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;
Expand Down
7 changes: 7 additions & 0 deletions configs/samples/chan_dahdi.conf.sample
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,13 @@ pickupgroup=1
;
;immediate=yes
;
; On FXS channels (FXO signaled), specifies whether fake audible ringback should
; be provided as soon as the channel goes off hook and immediate=yes.
; If audio should come only from the dialplan, this option should be disabled.
; Default is 'yes'
;
;immediatering=no
;
; Specify whether flash-hook transfers to 'busy' channels should complete or
; return to the caller performing the transfer (default is yes).
;
Expand Down

0 comments on commit 8cd7548

Please sign in to comment.