]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 373703,373706 via svnmerge from
authorAutomerge script <automerge@asterisk.org>
Tue, 25 Sep 2012 20:26:43 +0000 (20:26 +0000)
committerAutomerge script <automerge@asterisk.org>
Tue, 25 Sep 2012 20:26:43 +0000 (20:26 +0000)
file:///srv/subversion/repos/asterisk/branches/10

................
  r373703 | kmoore | 2012-09-25 14:34:01 -0500 (Tue, 25 Sep 2012) | 11 lines

  Fix an issue where media would not flow for situations where the legacy STUN code is in use.

  The STUN packets should *not* be blocked by strict RTP.

  (closes issue ASTERISK-20415)
Reported-by: Michele Cicciotti
Patch-by: Josh Colp (trunk r369817)
  ........

  Merged revisions 373702 from http://svn.asterisk.org/svn/asterisk/branches/1.8
................
  r373706 | file | 2012-09-25 15:12:02 -0500 (Tue, 25 Sep 2012) | 22 lines

  Fix T.38 support when used with chan_local in between.

  Users of the T.38 API can indicate AST_T38_REQUEST_PARMS on a channel to request that the
  channel indicate a T.38 negotiation with the parameters present on the channel. The return
  value of this indication is expected to be AST_T38_REQUEST_PARMS upon success but with
  chan_local involved this could never occur.

  This fix changes chan_local to always return AST_T38_REQUEST_PARMS for this situation. If
  the underlying channel technology on the other side does not support T.38 this would have
  been determined ahead of time using ast_channel_get_t38_state and an indication would
  not occur.

  (closes issue ASTERISK-20229)
  Reported by: wdoekes
  Patches:
       ASTERISK-20229.patch uploaded by wdoekes (license 5674)

  Review: https://reviewboard.asterisk.org/r/2070/
  ........

  Merged revisions 373705 from http://svn.asterisk.org/svn/asterisk/branches/1.8
................

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

channels/chan_local.c
res/res_rtp_asterisk.c

index ba238d858b8e0cc453512317fe0c965a1e268942..325e9d725618599930e9345c888e44af33f12118 100644 (file)
@@ -757,6 +757,15 @@ static int local_indicate(struct ast_channel *ast, int condition, const void *da
                        f.data.ptr = (void *) data;
                        f.datalen = datalen;
                        res = local_queue_frame(p, isoutbound, &f, ast, 1);
+
+                       if (!res && (condition == AST_CONTROL_T38_PARAMETERS) &&
+                           (datalen == sizeof(struct ast_control_t38_parameters))) {
+                               const struct ast_control_t38_parameters *parameters = data;
+                               
+                               if (parameters->request_response == AST_T38_REQUEST_PARMS) {
+                                       res = AST_T38_REQUEST_PARMS;
+                               }
+                       }
                } else {
                        ast_debug(4, "Blocked indication %d\n", condition);
                }
index 5bafae292a2bb4adca0e89ae88215d556aeffcd4..7773fbcc34c8c2714a9a0a5c505121c855191fa1 100644 (file)
@@ -2160,6 +2160,33 @@ static struct ast_frame *ast_rtp_read(struct ast_rtp_instance *instance, int rtc
                return &ast_null_frame;
        }
 
+       /* Get fields and verify this is an RTP packet */
+       seqno = ntohl(rtpheader[0]);
+
+       ast_rtp_instance_get_remote_address(instance, &remote_address);
+
+       if (!(version = (seqno & 0xC0000000) >> 30)) {
+               struct sockaddr_in addr_tmp;
+               struct ast_sockaddr addr_v4;
+               if (ast_sockaddr_is_ipv4(&addr)) {
+                       ast_sockaddr_to_sin(&addr, &addr_tmp);
+               } else if (ast_sockaddr_ipv4_mapped(&addr, &addr_v4)) {
+                       ast_debug(1, "Using IPv6 mapped address %s for STUN\n",
+                                 ast_sockaddr_stringify(&addr));
+                       ast_sockaddr_to_sin(&addr_v4, &addr_tmp);
+               } else {
+                       ast_debug(1, "Cannot do STUN for non IPv4 address %s\n",
+                                 ast_sockaddr_stringify(&addr));
+                       return &ast_null_frame;
+               }
+               if ((ast_stun_handle_packet(rtp->s, &addr_tmp, rtp->rawdata + AST_FRIENDLY_OFFSET, res, NULL, NULL) == AST_STUN_ACCEPT) &&
+                   ast_sockaddr_isnull(&remote_address)) {
+                       ast_sockaddr_from_sin(&addr, &addr_tmp);
+                       ast_rtp_instance_set_remote_address(instance, &addr);
+               }
+               return &ast_null_frame;
+       }
+
        /* If strict RTP protection is enabled see if we need to learn the remote address or if we need to drop the packet */
        if (rtp->strict_rtp_state == STRICT_RTP_LEARN) {
                ast_debug(1, "%p -- start learning mode pass with addr = %s\n", rtp, ast_sockaddr_stringify(&addr));
@@ -2193,33 +2220,6 @@ static struct ast_frame *ast_rtp_read(struct ast_rtp_instance *instance, int rtc
                }
        }
 
-       /* Get fields and verify this is an RTP packet */
-       seqno = ntohl(rtpheader[0]);
-
-       ast_rtp_instance_get_remote_address(instance, &remote_address);
-
-       if (!(version = (seqno & 0xC0000000) >> 30)) {
-               struct sockaddr_in addr_tmp;
-               struct ast_sockaddr addr_v4;
-               if (ast_sockaddr_is_ipv4(&addr)) {
-                       ast_sockaddr_to_sin(&addr, &addr_tmp);
-               } else if (ast_sockaddr_ipv4_mapped(&addr, &addr_v4)) {
-                       ast_debug(1, "Using IPv6 mapped address %s for STUN\n",
-                                 ast_sockaddr_stringify(&addr));
-                       ast_sockaddr_to_sin(&addr_v4, &addr_tmp);
-               } else {
-                       ast_debug(1, "Cannot do STUN for non IPv4 address %s\n",
-                                 ast_sockaddr_stringify(&addr));
-                       return &ast_null_frame;
-               }
-               if ((ast_stun_handle_packet(rtp->s, &addr_tmp, rtp->rawdata + AST_FRIENDLY_OFFSET, res, NULL, NULL) == AST_STUN_ACCEPT) &&
-                   ast_sockaddr_isnull(&remote_address)) {
-                       ast_sockaddr_from_sin(&addr, &addr_tmp);
-                       ast_rtp_instance_set_remote_address(instance, &addr);
-               }
-               return &ast_null_frame;
-       }
-
        /* If symmetric RTP is enabled see if the remote side is not what we expected and change where we are sending audio */
        if (ast_rtp_instance_get_prop(instance, AST_RTP_PROPERTY_NAT)) {
                if (ast_sockaddr_cmp(&remote_address, &addr)) {