Merged revisions 69221 via svnmerge from
authorJoshua Colp <jcolp@digium.com>
Wed, 13 Jun 2007 21:20:32 +0000 (21:20 +0000)
committerJoshua Colp <jcolp@digium.com>
Wed, 13 Jun 2007 21:20:32 +0000 (21:20 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r69221 | file | 2007-06-13 17:17:28 -0400 (Wed, 13 Jun 2007) | 2 lines

Let's make chan_iax2 media only native transfers actually work. (issue #9376 reported by simone cittadini)

........

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

channels/chan_iax2.c

index a814c5f..030fd82 100644 (file)
@@ -1224,7 +1224,7 @@ static int match(struct sockaddr_in *sin, unsigned short callno, unsigned short
        if ((cur->transfer.sin_addr.s_addr == sin->sin_addr.s_addr) &&
            (cur->transfer.sin_port == sin->sin_port) && (cur->transferring)) {
                /* We're transferring */
-               if (dcallno == cur->callno)
+               if ((dcallno == cur->callno) || (cur->transferring == TRANSFER_MEDIAPASS && cur->transfercallno == callno))
                        return 1;
        }
        return 0;
@@ -1326,6 +1326,7 @@ static int find_callno(unsigned short callno, unsigned short dcallno, struct soc
        int x;
        struct timeval now;
        char host[80];
+
        if (new <= NEW_ALLOW) {
                for (x=1;(res < 1) && (x<maxnontrunkcall);x++) {
                        ast_mutex_lock(&iaxsl[x]);
@@ -6839,7 +6840,7 @@ static int socket_process(struct iax2_thread *thread)
        if (!fr->callno)
                fr->callno = find_callno(ntohs(mh->callno) & ~IAX_FLAG_FULL, dcallno, &sin, new, 1, fd);
 
-       if (fr->callno > 0) 
+       if (fr->callno > 0)
                ast_mutex_lock(&iaxsl[fr->callno]);
 
        if (!fr->callno || !iaxs[fr->callno]) {
@@ -7924,6 +7925,14 @@ retryowner2:
                                break;  
                        case IAX_COMMAND_TXMEDIA:
                                if (iaxs[fr->callno]->transferring == TRANSFER_READY) {
+                                        AST_LIST_LOCK(&queue);
+                                        AST_LIST_TRAVERSE(&queue, cur, list) {
+                                                /* Cancel any outstanding frames and start anew */
+                                                if ((fr->callno == cur->callno) && (cur->transfer)) {
+                                                        cur->retries = -1;
+                                                }
+                                        }
+                                        AST_LIST_UNLOCK(&queue);
                                        /* Start sending our media to the transfer address, but otherwise leave the call as-is */
                                        iaxs[fr->callno]->transferring = TRANSFER_MEDIAPASS;
                                }