diff --git a/apps/app_disa.c b/apps/app_disa.c index fa94238bccb80f2cd7bc8358c167591a74121091..e87ee83570fde8aeb689a3438cb2669cf7e30c39 100644 --- a/apps/app_disa.c +++ b/apps/app_disa.c @@ -187,8 +187,12 @@ static int disa_exec(struct ast_channel *chan, const char *data) /* answer */ ast_answer(chan); } - } else + } else { special_noanswer = 1; + if (chan->_state != AST_STATE_UP) { + ast_indicate(chan, AST_CONTROL_PROGRESS); + } + } ast_debug(1, "Context: %s\n",args.context); diff --git a/apps/app_playback.c b/apps/app_playback.c index 54e90ffc29ebdb88d493268e05beddee20ca307d..612cf684cced31015b5f9b3f58f3e9fac644b59b 100644 --- a/apps/app_playback.c +++ b/apps/app_playback.c @@ -449,9 +449,13 @@ static int playback_exec(struct ast_channel *chan, const char *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 edf631d5bfd5ad349e5278cc1e0f31f57deb20b5..94de8218706521ada2b152068d14d456b77ff43f 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -1207,6 +1207,8 @@ static struct sip_settings sip_cfg; static int global_match_auth_username; /*!< Match auth username if available instead of From: Default off. */ static int global_relaxdtmf; /*!< Relax DTMF */ +static int global_prematuremediafilter; /*!< Enable/disable premature frames in a call (causing 183 early media) */ +static int global_relaxdtmf; /*!< Relax DTMF */ static int global_rtptimeout; /*!< Time out call if no RTP */ static int global_rtpholdtimeout; /*!< Time out call if no RTP during hold */ static int global_rtpkeepalive; /*!< Send RTP keepalives */ @@ -6269,9 +6271,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_instance_new_source(p->rtp); - p->invitestate = INV_EARLY_MEDIA; - transmit_provisional_response(p, "183 Session Progress", &p->initreq, TRUE); - 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, TRUE); + ast_set_flag(&p->flags[0], SIP_PROGRESS_SENT); + } } else if (p->t38.state == T38_ENABLED) { change_t38_state(p, T38_DISABLED); transmit_reinvite_with_sdp(p, FALSE, FALSE); @@ -16281,6 +16285,7 @@ static char *sip_show_settings(struct ast_cli_entry *e, int cmd, struct ast_cli_ ast_cli(a->fd, " Timer T1: %d\n", global_t1); ast_cli(a->fd, " Timer T1 minimum: %d\n", global_t1min); ast_cli(a->fd, " Timer B: %d\n", global_timer_b); + ast_cli(a->fd, " No premature media: %s\n", global_prematuremediafilter ? "Yes" : "No"); ast_cli(a->fd, "\nDefault Settings:\n"); ast_cli(a->fd, "-----------------\n"); @@ -24823,6 +24828,7 @@ static int reload_config(enum channelreloadreason reason) snprintf(global_useragent, sizeof(global_useragent), "%s %s", DEFAULT_USERAGENT, ast_get_version()); snprintf(global_sdpsession, sizeof(global_sdpsession), "%s %s", DEFAULT_SDPSESSION, ast_get_version()); snprintf(global_sdpowner, sizeof(global_sdpowner), "%s", DEFAULT_SDPOWNER); + global_prematuremediafilter = TRUE; ast_copy_string(default_notifymime, DEFAULT_NOTIFYMIME, sizeof(default_notifymime)); ast_copy_string(sip_cfg.realm, S_OR(ast_config_AST_SYSTEM_NAME, DEFAULT_REALM), sizeof(sip_cfg.realm)); sip_cfg.domainsasrealm = DEFAULT_DOMAINSASREALM; @@ -24995,6 +25001,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, "vmexten")) { diff --git a/configs/sip.conf.sample b/configs/sip.conf.sample index 7170e7e57bbbc423cfb2fa0f680cbf01433b66b0..ab6cee97a9ad86daf5503f1f5951344f806306c5 100644 --- a/configs/sip.conf.sample +++ b/configs/sip.conf.sample @@ -265,6 +265,12 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls ; transmit such UPDATE messages to it, then you must enable this option. ; Otherwise, we will have to wait until we can send a reinvite to ; transmit the information. +;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". ;progressinband=never ; If we should generate in-band ringing always ; use 'never' to never use in-band signalling, even in cases diff --git a/main/pbx.c b/main/pbx.c index f72941c2839498a9b16c6b431ac25d0de45262f7..9aa3b31db990b446e591727ef784aa03be300fd0 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -9126,6 +9126,8 @@ static int pbx_builtin_background(struct ast_channel *chan, const char *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) {