Index: channels/chan_sip.c =================================================================== --- channels/chan_sip.c (revision 148269) +++ channels/chan_sip.c (working copy) @@ -11997,14 +11997,8 @@ /* For subscribes, match on device name only; for other methods, * match on IP address-port of the incoming request. */ - /* First find device on name */ - peer = find_peer(of, NULL, TRUE, FALSE, FALSE); + peer = (sipmethod == SIP_SUBSCRIBE) ? find_peer(of, NULL, TRUE, FALSE, FALSE) : find_peer(NULL, &p->recv, TRUE, FALSE, FALSE); - /* If not found, then find device on IP (if it's not a SUBSCRIBE) */ - if (!peer && sipmethod != SIP_SUBSCRIBE) { - peer = find_peer(NULL, &p->recv, TRUE, FALSE, FALSE); - } - if (!peer) { if (debug) ast_verbose("No matching peer for '%s' from '%s:%d'\n",