On incoming call, set peername to username to properly authenticate BYE (it's not...
authorMark Spencer <markster@digium.com>
Sun, 2 May 2004 16:17:40 +0000 (16:17 +0000)
committerMark Spencer <markster@digium.com>
Sun, 2 May 2004 16:17:40 +0000 (16:17 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2858 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 4d07c8c..4a48cbf 100755 (executable)
@@ -4475,9 +4475,11 @@ static int check_user(struct sip_pvt *p, struct sip_request *req, char *cmd, cha
                                        ast_rtp_setnat(p->vrtp, p->nat);
                                }
                                p->canreinvite = peer->canreinvite;
                                        ast_rtp_setnat(p->vrtp, p->nat);
                                }
                                p->canreinvite = peer->canreinvite;
-                               if (strlen(peer->username))
-                                       strncpy(p->username, peer->username, sizeof(p->username) - 1);
                                strncpy(p->peername, peer->name, sizeof(p->peername) - 1);
                                strncpy(p->peername, peer->name, sizeof(p->peername) - 1);
+                               if (strlen(peer->username)) {
+                                       strncpy(p->username, peer->username, sizeof(p->username) - 1);
+                                       strncpy(p->peername, peer->username, sizeof(p->peername) - 1);
+                               }
                                if (strlen(peer->context))
                                        strncpy(p->context, peer->context, sizeof(p->context) - 1);
                                strncpy(p->peersecret, peer->secret, sizeof(p->peersecret) - 1);
                                if (strlen(peer->context))
                                        strncpy(p->context, peer->context, sizeof(p->context) - 1);
                                strncpy(p->peersecret, peer->secret, sizeof(p->peersecret) - 1);