]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Ensure apathetic replies are sent out on the proper socket.
authorRussell Bryant <russell@russellbryant.com>
Tue, 14 Jul 2009 14:45:47 +0000 (14:45 +0000)
committerRussell Bryant <russell@russellbryant.com>
Tue, 14 Jul 2009 14:45:47 +0000 (14:45 +0000)
chan_iax2 supports multiple address bindings.  The send_apathetic_reply()
function did not attempt to send its response on the same socket that the
incoming message came in on.

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

channels/chan_iax2.c

index 0bbd200922e0e6751d1cf04e2ac6391a4144cb02..dcae68853aab497c7e6ab13c498a2bf2ae7d8a77 100644 (file)
@@ -3102,13 +3102,15 @@ struct parsed_dial_string {
        char *options;
 };
 
-static int send_apathetic_reply(unsigned short callno, unsigned short dcallno, struct sockaddr_in *sin, int command, int ts, unsigned char seqno)
+static int send_apathetic_reply(unsigned short callno, unsigned short dcallno,
+               struct sockaddr_in *sin, int command, int ts, unsigned char seqno,
+               int sockfd)
 {
        struct ast_iax2_full_hdr f = { .scallno = htons(0x8000 | callno), .dcallno = htons(dcallno),
                .ts = htonl(ts), .iseqno = seqno, .oseqno = 0, .type = AST_FRAME_IAX,
                .csub = compress_subclass(command) };
 
-       return sendto(defaultsockfd, &f, sizeof(f), 0, (struct sockaddr *)sin, sizeof(*sin));
+       return sendto(sockfd, &f, sizeof(f), 0, (struct sockaddr *)sin, sizeof(*sin));
 }
 
 /*!
@@ -6877,7 +6879,7 @@ static int socket_read(int *id, int fd, short events, void *cbdata)
                /* Deal with POKE/PONG without allocating a callno */
                if (f.frametype == AST_FRAME_IAX && f.subclass == IAX_COMMAND_POKE) {
                        /* Reply back with a PONG, but don't care about the result. */
-                       send_apathetic_reply(1, ntohs(fh->scallno), &sin, IAX_COMMAND_PONG, ntohs(fh->ts), fh->iseqno + 1);
+                       send_apathetic_reply(1, ntohs(fh->scallno), &sin, IAX_COMMAND_PONG, ntohs(fh->ts), fh->iseqno + 1, fd);
                        return 1;
                } else if (f.frametype == AST_FRAME_IAX && f.subclass == IAX_COMMAND_ACK && dcallno == 1) {
                        /* Ignore */