[asterisk-commits] branch oej/sipregister r15426 -
/team/oej/sipregister/channels/chan_sip.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Mon Mar 27 17:41:23 MST 2006
Author: oej
Date: Mon Mar 27 18:41:22 2006
New Revision: 15426
URL: http://svn.digium.com/view/asterisk?rev=15426&view=rev
Log:
Using the known peer on the incoming call from a service provider, without
traversing the list again. This way, we can match the proper peer regardless
if we have many with the same IP address (multiple accounts with the
same service provider)
Modified:
team/oej/sipregister/channels/chan_sip.c
Modified: team/oej/sipregister/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/channels/chan_sip.c?rev=15426&r1=15425&r2=15426&view=diff
==============================================================================
--- team/oej/sipregister/channels/chan_sip.c (original)
+++ team/oej/sipregister/channels/chan_sip.c Mon Mar 27 18:41:22 2006
@@ -7226,7 +7226,7 @@
static int check_user_full(struct sip_pvt *p, struct sip_request *req, int sipmethod, char *uri, enum xmittype reliable, struct sockaddr_in *sin, int ignore, char *mailbox, int mailboxlen)
{
struct sip_user *user = NULL;
- struct sip_peer *peer;
+ struct sip_peer *peer = NULL;
char *of, from[256], *c;
char *rpid, rpid_num[50];
char iabuf[INET_ADDRSTRLEN];
@@ -7290,13 +7290,13 @@
ast_string_field_set(p, cid_num, of);
}
}
- if (p->registry) {
-
- }
if (ast_strlen_zero(of))
return 0;
- if (!mailbox) /* If it's a mailbox SUBSCRIBE, don't check users */
+ if (p->registry && p->registry->peer) /* We know this peer from registry */
+ peer = p->registry->peer;
+
+ if (!mailbox && !peer) /* If it's a mailbox SUBSCRIBE, don't check users */
user = find_user(of, 1);
/* Find user based on user name in the from header */
@@ -7401,15 +7401,19 @@
if (!user) {
/* If we didn't find a user match, check for peers */
- if (sipmethod == SIP_SUBSCRIBE)
- /* For subscribes, match on peer name only */
- peer = find_peer(of, NULL, 1);
- else
- /* Look for peer based on the IP address we received data from */
- /* If peer is registered from this IP address or have this as a default
- IP address, this call is from the peer
- */
- peer = find_peer(NULL, &p->recv, 1);
+ /* If peer is set, we know the peer from registry, so this is
+ an incoming call for a service provider */
+ if (!peer) {
+ if (sipmethod == SIP_SUBSCRIBE)
+ /* For subscribes, match on peer name only */
+ peer = find_peer(of, NULL, 1);
+ else
+ /* Look for peer based on the IP address we received data from */
+ /* If peer is registered from this IP address or have this as a default
+ IP address, this call is from the peer
+ */
+ peer = find_peer(NULL, &p->recv, 1);
+ }
if (peer) {
if (debug)
More information about the asterisk-commits
mailing list