]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
- Backport of the "limitonpeers" patch from trunk, to fix a lot of issues with queues...
authorOlle Johansson <oej@edvina.net>
Fri, 1 Dec 2006 17:41:56 +0000 (17:41 +0000)
committerOlle Johansson <oej@edvina.net>
Fri, 1 Dec 2006 17:41:56 +0000 (17:41 +0000)
- Remove support for T.38 early media, since it's impossible.

(Two patches in one - extra friday evening offer due to being off line from svn today... :-)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@48177 65c4cc65-6c06-0410-ace0-fbb531ad65f3

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

index 921f92ff7d79c5c41b1ca87ae021bff28223c1d9..6b3be234c941d53d1d4a554b9623eb66986418d2 100644 (file)
@@ -513,6 +513,7 @@ static int default_maxcallbitrate;  /*!< Maximum bitrate for call */
 static struct ast_codec_pref default_prefs;            /*!< Default codec prefs */
 
 /* Global settings only apply to the channel */
+static int global_limitonpeers;                /*!< Match call limit on peers only */
 static int global_rtautoclear;
 static int global_notifyringing;       /*!< Send notifications on ringing */
 static int global_notifyhold;          /*!< Send notifications on hold */
@@ -2944,7 +2945,7 @@ static void __sip_destroy(struct sip_pvt *p, int lockowner)
 static int update_call_counter(struct sip_pvt *fup, int event)
 {
        char name[256];
-       int *inuse, *call_limit, *inringing;
+       int *inuse = NULL, *call_limit = NULL, *inringing = NULL;
        int outgoing = ast_test_flag(&fup->flags[0], SIP_OUTGOING);
        struct sip_user *u = NULL;
        struct sip_peer *p = NULL;
@@ -2959,16 +2960,17 @@ static int update_call_counter(struct sip_pvt *fup, int event)
        ast_copy_string(name, fup->username, sizeof(name));
 
        /* Check the list of users only for incoming calls */
-       if (!outgoing && (u = find_user(name, 1)) ) {
+       if (global_limitonpeers == FALSE && !outgoing && (u = find_user(name, 1)))  {
                inuse = &u->inUse;
                call_limit = &u->call_limit;
                inringing = NULL;
-       } else if ( (p = find_peer(fup->peername, NULL, 1) ) ) { /* Try to find peer */
+       } else if ( (p = find_peer(ast_strlen_zero(fup->peername) ? name : fup->peername, NULL, 1) ) ) { /* Try to find peer */
                inuse = &p->inUse;
                call_limit = &p->call_limit;
                inringing = &p->inRinging;
                ast_copy_string(name, fup->peername, sizeof(name));
-       } else {
+       } 
+       if (!p && !u) {
                if (option_debug > 1)
                        ast_log(LOG_DEBUG, "%s is not a local device, no call limit\n", name);
                return 0;
@@ -3469,15 +3471,12 @@ static int sip_write(struct ast_channel *ast, struct ast_frame *frame)
        case AST_FRAME_MODEM:
                if (p) {
                        ast_mutex_lock(&p->lock);
-                       if (p->udptl) {
-                               if ((ast->_state != AST_STATE_UP) &&
-                                       !ast_test_flag(&p->flags[0], SIP_PROGRESS_SENT) && 
-                                   !ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
-                                       transmit_response_with_t38_sdp(p, "183 Session Progress", &p->initreq, XMIT_UNRELIABLE);
-                                       ast_set_flag(&p->flags[0], SIP_PROGRESS_SENT);
-                               }
+                       /* UDPTL requires two-way communication, so early media is not needed here.
+                               we simply forget the frames if we get modem frames before the bridge is up.
+                               Fax will re-transmit.
+                       */
+                       if (p->udptl && ast->_state != AST_STATE_UP) 
                                res = ast_udptl_write(p->udptl, frame);
-                       }
                        ast_mutex_unlock(&p->lock);
                }
                break;
@@ -10155,6 +10154,7 @@ static int sip_show_settings(int fd, int argc, char *argv[])
        ast_cli(fd, "  Our auth realm          %s\n", global_realm);
        ast_cli(fd, "  Realm. auth:            %s\n", authl ? "Yes": "No");
        ast_cli(fd, "  Always auth rejects:    %s\n", global_alwaysauthreject ? "Yes" : "No");
+       ast_cli(fd, "  Call limit peers only:  %s\n", global_limitonpeers ? "Yes" : "No");
        ast_cli(fd, "  User Agent:             %s\n", global_useragent);
        ast_cli(fd, "  MWI checking interval:  %d secs\n", global_mwitime);
        ast_cli(fd, "  Reg. context:           %s\n", S_OR(global_regcontext, "(not set)"));
@@ -15892,6 +15892,7 @@ static int reload_config(enum channelreloadreason reason)
        global_regcontext[0] = '\0';
        expiry = DEFAULT_EXPIRY;
        global_notifyringing = DEFAULT_NOTIFYRINGING;
+       global_limitonpeers = FALSE;
        global_notifyhold = FALSE;
        global_alwaysauthreject = 0;
        global_allowsubscribe = FALSE;
@@ -16014,6 +16015,8 @@ static int reload_config(enum channelreloadreason reason)
                        compactheaders = ast_true(v->value);
                } else if (!strcasecmp(v->name, "notifymimetype")) {
                        ast_copy_string(default_notifymime, v->value, sizeof(default_notifymime));
+               } else if (!strcasecmp(v->name, "limitonpeers")) {
+                       global_limitonpeers = ast_true(v->value);
                } else if (!strcasecmp(v->name, "notifyringing")) {
                        global_notifyringing = ast_true(v->value);
                } else if (!strcasecmp(v->name, "notifyhold")) {
index 52c65cc0d15934827747aa2e37bd05f7493df1c3..37e3ebba36f0dc56d2bd89f23c12446e3716514f 100644 (file)
@@ -185,6 +185,12 @@ srvlookup=yes                      ; Enable DNS SRV lookups on outbound calls
 ;notifyhold = yes              ; Notify subscriptions on HOLD state (default: no)
                                ; Turning on notifyringing and notifyhold will add a lot
                                ; more database transactions if you are using realtime.
+;limitonpeer = yes             ; Apply call limits on peers only. This will improve 
+                               ; status notification when you are using type=friend
+                               ; Inbound calls, that really apply to the user part
+                               ; of a friend will now be added to and compared with
+                               ; the peer limit instead of applying two call limits,
+                               ; one for the peer and one for the user.
 
 ;----------------------------------------- T.38 FAX PASSTHROUGH SUPPORT -----------------------
 ;