Author: rizzo
Date: Sun Jul 22 15:51:41 2007
New Revision: 76391

URL: http://svn.digium.com/view/asterisk?view=rev&rev=76391
Log:
more merging from trunk

Modified:
    team/rizzo/astobj2/channels/chan_sip.c

Modified: team/rizzo/astobj2/channels/chan_sip.c
URL: 
http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_sip.c?view=diff&rev=76391&r1=76390&r2=76391
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Sun Jul 22 15:51:41 2007
@@ -4792,7 +4792,7 @@
                ast_set_write_format(p->owner, p->owner->writeformat);
        }
 
-       if ((ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_INBAND) && 
p->vad) {
+       if (f && (ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_INBAND) && 
p->vad) {
                f = ast_dsp_process(p->owner, p->vad, f);
                if (f && f->frametype == AST_FRAME_DTMF) {
                        if (ast_test_flag(&p->t38.t38support, 
SIP_PAGE2_T38SUPPORT_UDPTL) && f->subclass == 'f') {
@@ -4803,6 +4803,7 @@
                        }
                }
        }
+
        return f;
 }
 
@@ -16036,33 +16037,39 @@
 
        /* Find out SIP method for incoming request */
        if (req->method == SIP_RESPONSE) {      /* Response to our request */
+               /* When we get here, we know this is a SIP dialog where we've 
sent
+                * a request and have a response, or at least get a response
+                * within an existing dialog. Do some sanity checks, then
+                * possibly process the request. In all cases, there function
+                * terminates at the end of this block
+                */
+               int ret = 0;
                int respid;
-               /* When we get here, we know this is a SIP dialog where we've 
sent
-                  a request and have a response, or at least get a response
-                  within an existing dialog */
-               /* Response to our request -- Do some sanity checks */  
+
                if (p->ocseq < seqno) {
                        ast_debug(1, "Ignoring out of order response %d 
(expecting %d)\n", seqno, p->ocseq);
-                       return -1;
+                       ret = -1;
                } else if (p->ocseq != seqno) {
-                       /* ignore means "don't do anything with it" but still 
have to 
-                          respond appropriately  */
+                       /* ignore means "don't do anything with it" but still 
have to
+                        * respond appropriately.
+                        * But in this case this is a response already, so we 
really
+                        * have nothing to do with this message, and even 
setting the
+                        * ignore flag is pointless.
+                        */
                        req->ignore = 1;
                        append_history(p, "Ignore", "Ignoring this 
retransmit\n");
-               }
-       
-               e = ast_skip_blanks(e);
-               if (sscanf(e, "%d %n", &respid, &len) != 1) {
-                       ast_log(LOG_WARNING, "Invalid response: '%s'\n", e);
-               } else {
-                       if (respid <= 0) {
+               } else if (e) {
+                       e = ast_skip_blanks(e);
+                       if (sscanf(e, "%d %n", &respid, &len) != 1) {
+                               ast_log(LOG_WARNING, "Invalid response: 
'%s'\n", e);
+                       } else if (respid <= 0) {
                                ast_log(LOG_WARNING, "Invalid SIP response 
code: '%d'\n", respid);
-                               return 0;
+                       } else { /* finally, something worth processing */
+                               /* More SIP ridiculousness, we have to ignore 
bogus contacts in 100 etc responses */
+                               if ((respid == 200) || ((respid >= 300) && 
(respid <= 399)))
+                                       extract_uri(p, req);
+                               handle_response(p, respid, e + len, req, seqno);
                        }
-                       /* More SIP ridiculousness, we have to ignore bogus 
contacts in 100 etc responses */
-                       if ((respid == 200) || ((respid >= 300) && (respid <= 
399)))
-                               extract_uri(p, req);
-                       handle_response(p, respid, e + len, req, seqno);
                }
                return 0;
        }


_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--

svn-commits mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/svn-commits

Reply via email to