diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 8bda1dc8dfab0c3904de31fffa2a5f5e5bdc055f..d73a47114e862b86ba5a0e7b51dca5fd038d6f53 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -1900,16 +1900,14 @@ static int sip_indicate(struct ast_channel *ast, int condition) switch(condition) { case AST_CONTROL_RINGING: if (ast->_state == AST_STATE_RING) { - /* Send 180 ringing no matter what */ - transmit_response(p, "180 Ringing", &p->initreq); - if (!p->progress) { + if (!p->progress || !p->progressinband) { + /* Send 180 ringing if out-of-band seems reasonable */ + transmit_response(p, "180 Ringing", &p->initreq); p->ringing = 1; - if (!p->progressinband) + if (!p->progressinband > 1) break; } else { - /* Oops, we've sent progress tones. Some devices don't seem to - handle a 180 after a 183, so we'll go ahead and send the - ringback in-band, too. */ + /* Well, if it's not reasonable, just send in-band */ } } return -1; @@ -8208,7 +8206,12 @@ static struct sip_user *build_user(const char *name, struct ast_variable *v) } else if (!strcasecmp(v->name, "useclientcode")) { user->useclientcode = ast_true(v->value); } else if (!strcasecmp(v->name, "progressinband")) { - user->progressinband = ast_true(v->value); + if (!strcasecmp(v->value, "never")) + user->progressinband = 0; + else if (ast_true(v->value)) + user->progressinband = 2; + else + user->progressinband = 1; #ifdef OSP_SUPPORT } else if (!strcasecmp(v->name, "ospauth")) { if (!strcasecmp(v->value, "exclusive")) { @@ -8474,7 +8477,12 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, int } else if (!strcasecmp(v->name, "trustrpid")) { peer->trustrpid = ast_true(v->value); } else if (!strcasecmp(v->name, "progressinband")) { - peer->progressinband = ast_true(v->value); + if (!strcasecmp(v->value, "never")) + peer->progressinband = 0; + else if (ast_true(v->value)) + peer->progressinband = 2; + else + peer->progressinband = 1; #ifdef OSP_SUPPORT } else if (!strcasecmp(v->name, "ospauth")) { if (!strcasecmp(v->value, "exclusive")) { @@ -8625,7 +8633,12 @@ static int reload_config(void) } else if (!strcasecmp(v->name, "trustrpid")) { global_trustrpid = ast_true(v->value); } else if (!strcasecmp(v->name, "progressinband")) { - global_progressinband = ast_true(v->value); + if (!strcasecmp(v->value, "never")) + global_progressinband = 0; + else if (ast_true(v->value)) + global_progressinband = 2; + else + global_progressinband = 1; #ifdef OSP_SUPPORT } else if (!strcasecmp(v->name, "ospauth")) { if (!strcasecmp(v->value, "exclusive")) { diff --git a/configs/sip.conf.sample b/configs/sip.conf.sample index 1a6c8046ce7f65a46b45d8e961dd2ecf750ee2d3..4794ca5ef6604cf490debc2f5d226ca4363989e9 100755 --- a/configs/sip.conf.sample +++ b/configs/sip.conf.sample @@ -62,6 +62,8 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls ; when we're on hold (must be > rtptimeout) ;trustrpid = no ; If Remote-Party-ID should be trusted ;progressinband=no ; If we should generate in-band ringing always + ; use 'never' to never use in-band signalling, even in cases + ; where some buggy devices might not render it ;useragent=Asterisk PBX ; Allows you to change the user agent string ;nat=no ; NAT settings ; yes = Always ignore info and assume NAT