On second thought, add new "never" option for progressinband
authorMark Spencer <markster@digium.com>
Sun, 14 Nov 2004 15:13:13 +0000 (15:13 +0000)
committerMark Spencer <markster@digium.com>
Sun, 14 Nov 2004 15:13:13 +0000 (15:13 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4240 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c
configs/sip.conf.sample

index 8bda1dc..d73a471 100755 (executable)
@@ -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")) {
index 1a6c804..4794ca5 100755 (executable)
@@ -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