[asterisk-commits] oej: branch oej/pinetree-1.4 r193187 - in /team/oej/pinetree-1.4: ./ channels...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri May 8 05:17:05 CDT 2009
Author: oej
Date: Fri May 8 05:16:47 2009
New Revision: 193187
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=193187
Log:
Adding docs and starting to clean up this branch
Modified:
team/oej/pinetree-1.4/ (props changed)
team/oej/pinetree-1.4/channels/chan_sip.c
team/oej/pinetree-1.4/configs/sip.conf.sample
Propchange: team/oej/pinetree-1.4/
------------------------------------------------------------------------------
--- automerge (original)
+++ automerge Fri May 8 05:16:47 2009
@@ -1,1 +1,1 @@
-Note to myself: Everyone Needs Project Codename Pineapple! http://edvina.net
+http://www.codename-pineapple.org/
Modified: team/oej/pinetree-1.4/channels/chan_sip.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/oej/pinetree-1.4/channels/chan_sip.c?view=diff&rev=193187&r1=193186&r2=193187
==============================================================================
--- team/oej/pinetree-1.4/channels/chan_sip.c (original)
+++ team/oej/pinetree-1.4/channels/chan_sip.c Fri May 8 05:16:47 2009
@@ -1506,6 +1506,8 @@
static int get_also_info(struct sip_pvt *p, struct sip_request *oreq);
static int parse_ok_contact(struct sip_pvt *pvt, struct sip_request *req);
static int set_address_from_contact(struct sip_pvt *pvt);
+static int find_via_address(int findsecond, struct sip_pvt *p, struct sip_request *req, struct sockaddr_in *addr);
+static int get_address_from_via(const char *via, char *hostname, size_t hostlen, char *port, size_t portlen, struct sockaddr_in *addr);
static void check_via(struct sip_pvt *p, const struct sip_request *req);
static char *get_calleridname(const char *input, char *output, size_t outputsize);
static int get_rpid_num(const char *input, char *output, int maxlen);
@@ -1541,7 +1543,6 @@
static int copy_header(struct sip_request *req, const struct sip_request *orig, const char *field);
static int copy_all_header(struct sip_request *req, const struct sip_request *orig, const char *field);
static int copy_via_headers(struct sip_pvt *p, struct sip_request *req, const struct sip_request *orig, const char *field);
-static int find_via_address(int findsecond, struct sip_pvt *p, struct sip_request *req, struct sockaddr_in *addr);
static void set_destination(struct sip_pvt *p, char *uri);
static void append_date(struct sip_request *req);
static void build_contact(struct sip_pvt *p);
@@ -2718,7 +2719,6 @@
static struct sip_peer *find_peer(const char *peer, struct sockaddr_in *sin, int realtime, int devstate_only)
{
struct sip_peer *p = NULL;
- ast_log(LOG_DEBUG, "--- DEBUG: Trying to find a mate\n");
if (peer)
p = ASTOBJ_CONTAINER_FIND(&peerl, peer);
@@ -9703,9 +9703,7 @@
if (sip_debug_test_pvt(p)) {
const struct sockaddr_in *dst = sip_real_dst(p);
ast_verbose("Sending to %s : %d (%s)\n", ast_inet_ntoa(dst->sin_addr), ntohs(dst->sin_port), sip_nat_mode(p));
- ast_verbose("DEBUG: Sender is at %s : %d \n", ast_inet_ntoa(p->sa.sin_addr), ntohs(p->sa.sin_port));
- }
- ast_log(LOG_DEBUG, "DEBUG: Returning from check_via()\n");
+ }
}
/*! \brief Get caller id name from SIP headers */
@@ -10001,20 +9999,16 @@
/* If peer is registered from this IP address or have this as a default
IP address, this call is from the peer
*/
- ast_log(LOG_DEBUG, "--- DEBUG: GOING TO FIND MYSELF A GOOD PEER\n");
peer = find_peer(NULL, &p->recv, 1, 0);
/* If this peer have a matching principle that says we need to check
the via headers for the REAL peer, then do that.
*/
- ast_log(LOG_DEBUG, "--- DEBUG: NOW FOR SOMETHING COMPLETELY DIFFERENT (peer = %s)\n", peer ? "Found" : "Not found");
if (peer && (peer->matchrule == MATCH_SECONDVIA || peer->matchrule == MATCH_LASTVIA)) {
struct sockaddr_in matchaddr;
/* Go find the peer */
- ast_log(LOG_DEBUG, "--- DEBUG: SEARCHING FOR PEER IN VIA HEADER\n");
find_via_address(peer->matchrule == MATCH_SECONDVIA, p, req, &matchaddr);
peer = find_peer(NULL, &matchaddr, 1, 0);
}
- ast_log(LOG_DEBUG, "--- DEBUG: DONE SEARCHING FOR A PEER\n");
}
if (peer) {
@@ -14512,9 +14506,6 @@
if (!ast_strlen_zero(supported))
parse_sip_options(p, supported);
}
- /* DEBUG: */
- find_via_address(TRUE, p, req, NULL);
-
/* Find out what they require */
required = get_header(req, "Require");
Modified: team/oej/pinetree-1.4/configs/sip.conf.sample
URL: http://svn.asterisk.org/svn-view/asterisk/team/oej/pinetree-1.4/configs/sip.conf.sample?view=diff&rev=193187&r1=193186&r2=193187
==============================================================================
--- team/oej/pinetree-1.4/configs/sip.conf.sample (original)
+++ team/oej/pinetree-1.4/configs/sip.conf.sample Fri May 8 05:16:47 2009
@@ -532,10 +532,12 @@
; outboundproxy
; rfc2833compensate
; t38pt_usertpsource
+; matchrule
; contactpermit ; Limit what a host may register as (a neat trick
; contactdeny ; is to register at the same IP as a SIP provider,
; ; then call oneself, and get redirected to that
; ; same location).
+;
;[sip_proxy]
; For incoming calls only. Example: FWD (Free World Dialup)
@@ -704,3 +706,19 @@
; if the nat option is enabled. If a single RTP packet is received Asterisk will know the
; external IP address of the remote device. If port forwarding is done at the client side
; then UDPTL will flow to the remote device.
+
+; ---------------------------- Ignoring a proxy ------------------------------------------------------------------------
+; If you have an inbound proxy in your network and want Asterisk to identify, and possibly authenticate, the device
+; behind that proxy instead of the proxy, add a peer for the proxy and set matchrule to "secondvia".
+; Other settings are "lastvia" if you want to identify the sender, regardless of number of proxys
+; and "normal".
+;
+; This setting only works for peers and only for matching on IP and port (for the actual proxy that you want to ignore)
+; Asterisk will first match the inbound proxy, which should be in-memory, and then look for a peer that matches
+; the IP and port of the second via. This device can be in memory or in the realtime database, depending upon
+; your preference.
+;
+;[inboundproxy]
+;type=peer
+;host=proxy.edvina.net
+;matchrule=secondvia
More information about the asterisk-commits
mailing list