aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/app_disa.c7
-rw-r--r--apps/app_playback.c6
-rw-r--r--channels/chan_sip.c13
-rw-r--r--configs/sip.conf.sample6
-rw-r--r--main/pbx.c2
5 files changed, 29 insertions, 5 deletions
diff --git a/apps/app_disa.c b/apps/app_disa.c
index 3c8bad9d4..038274057 100644
--- a/apps/app_disa.c
+++ b/apps/app_disa.c
@@ -176,7 +176,12 @@ static int disa_exec(struct ast_channel *chan, void *data)
/* answer */
ast_answer(chan);
}
- } else special_noanswer = 1;
+ } else {
+ special_noanswer = 1;
+ if (chan->_state != AST_STATE_UP) {
+ ast_indicate(chan, AST_CONTROL_PROGRESS);
+ }
+ }
i = k = x = 0; /* k is 0 for pswd entry, 1 for ext entry */
did_ignore = 0;
exten[0] = 0;
diff --git a/apps/app_playback.c b/apps/app_playback.c
index 6763bd917..972435f18 100644
--- a/apps/app_playback.c
+++ b/apps/app_playback.c
@@ -418,9 +418,13 @@ static int playback_exec(struct ast_channel *chan, void *data)
if (option_skip) {
/* At the user's option, skip if the line is not up */
goto done;
- } else if (!option_noanswer)
+ } else if (!option_noanswer) {
/* Otherwise answer unless we're supposed to send this while on-hook */
res = ast_answer(chan);
+ } else {
+ ast_indicate(chan, AST_CONTROL_PROGRESS);
+ }
+
}
if (!res) {
char *back = args.filenames;
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 684bff098..30243e45a 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -539,6 +539,7 @@ static struct ast_codec_pref default_prefs; /*!< Default codec prefs */
/* Global settings only apply to the channel */
static int global_directrtpsetup; /*!< Enable support for Direct RTP setup (no re-invites) */
+static int global_prematuremediafilter; /*!< Enable/disable premature frames in a call (causing 183 early media) */
static int global_limitonpeers; /*!< Match call limit on peers only */
static int global_rtautoclear;
static int global_notifyringing; /*!< Send notifications on ringing */
@@ -3894,9 +3895,11 @@ static int sip_write(struct ast_channel *ast, struct ast_frame *frame)
!ast_test_flag(&p->flags[0], SIP_PROGRESS_SENT) &&
!ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
ast_rtp_new_source(p->rtp);
- p->invitestate = INV_EARLY_MEDIA;
- transmit_provisional_response(p, "183 Session Progress", &p->initreq, 1);
- ast_set_flag(&p->flags[0], SIP_PROGRESS_SENT);
+ if (!global_prematuremediafilter) {
+ p->invitestate = INV_EARLY_MEDIA;
+ transmit_provisional_response(p, "183 Session Progress", &p->initreq, 1);
+ ast_set_flag(&p->flags[0], SIP_PROGRESS_SENT);
+ }
} else if (p->t38.state == T38_ENABLED && !p->t38.direct) {
p->t38.state = T38_DISABLED;
transmit_reinvite_with_sdp(p);
@@ -11317,6 +11320,7 @@ static int sip_show_settings(int fd, int argc, char *argv[])
print_codec_to_cli(fd, &default_prefs);
ast_cli(fd, "\n");
ast_cli(fd, " T1 minimum: %d\n", global_t1min);
+ ast_cli(fd, " No premature media: %s\n", global_prematuremediafilter ? "Yes" : "No");
ast_cli(fd, " Relax DTMF: %s\n", global_relaxdtmf ? "Yes" : "No");
ast_cli(fd, " Compact SIP headers: %s\n", compactheaders ? "Yes" : "No");
ast_cli(fd, " RTP Keepalive: %d %s\n", global_rtpkeepalive, global_rtpkeepalive ? "" : "(Disabled)" );
@@ -18127,6 +18131,7 @@ static int reload_config(enum channelreloadreason reason)
expiry = DEFAULT_EXPIRY;
global_notifyringing = DEFAULT_NOTIFYRINGING;
global_limitonpeers = FALSE;
+ global_prematuremediafilter = FALSE;
global_directrtpsetup = FALSE; /* Experimental feature, disabled by default */
global_notifyhold = FALSE;
global_alwaysauthreject = 0;
@@ -18232,6 +18237,8 @@ static int reload_config(enum channelreloadreason reason)
ast_set2_flag(&global_flags[1], i || ast_true(v->value), SIP_PAGE2_RTAUTOCLEAR);
} else if (!strcasecmp(v->name, "usereqphone")) {
ast_set2_flag(&global_flags[0], ast_true(v->value), SIP_USEREQPHONE);
+ } else if (!strcasecmp(v->name, "prematuremedia")) {
+ global_prematuremediafilter = ast_true(v->value);
} else if (!strcasecmp(v->name, "relaxdtmf")) {
global_relaxdtmf = ast_true(v->value);
} else if (!strcasecmp(v->name, "checkmwi")) {
diff --git a/configs/sip.conf.sample b/configs/sip.conf.sample
index 966d9abf5..741ae7570 100644
--- a/configs/sip.conf.sample
+++ b/configs/sip.conf.sample
@@ -115,6 +115,12 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls
; use 'never' to never use in-band signalling, even in cases
; where some buggy devices might not render it
; Valid values: yes, no, never Default: never
+;prematuremedia=no ; Some ISDN links send empty media frames before
+ ; the call is in ringing or progress state. The SIP
+ ; channel will then send 183 indicating early media
+ ; which will be empty - thus users get no ring signal.
+ ; Setting this to "no" will stop any media before we have
+ ; call progress. Default is "yes".
;useragent=Asterisk PBX ; Allows you to change the user agent string
;promiscredir = no ; If yes, allows 302 or REDIR to non-local SIP address
; Note that promiscredir when redirects are made to the
diff --git a/main/pbx.c b/main/pbx.c
index 1672b5332..acf2da9cf 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -5710,6 +5710,8 @@ static int pbx_builtin_background(struct ast_channel *chan, void *data)
} else if (!ast_test_flag(&flags, BACKGROUND_NOANSWER)) {
res = ast_answer(chan);
}
+ /* Send progress control frame to start early media */
+ ast_indicate(chan, AST_CONTROL_PROGRESS);
}
if (!res) {