[asterisk-commits] oej: branch oej/codename-pineapple r47220 - in /team/oej/codename-pineapple/c...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Nov 6 07:50:38 MST 2006


Author: oej
Date: Mon Nov  6 08:50:37 2006
New Revision: 47220

URL: http://svn.digium.com/view/asterisk?rev=47220&view=rev
Log:
Look, it compiles too :-)

Modified:
    team/oej/codename-pineapple/channels/chan_sip3.c
    team/oej/codename-pineapple/channels/sip3/sip3_compose.c
    team/oej/codename-pineapple/channels/sip3/sip3_config.c
    team/oej/codename-pineapple/channels/sip3/sip3_dialog.c
    team/oej/codename-pineapple/channels/sip3/sip3funcs.h

Modified: team/oej/codename-pineapple/channels/chan_sip3.c
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/channels/chan_sip3.c?rev=47220&r1=47219&r2=47220&view=diff
==============================================================================
--- team/oej/codename-pineapple/channels/chan_sip3.c (original)
+++ team/oej/codename-pineapple/channels/chan_sip3.c Mon Nov  6 08:50:37 2006
@@ -635,7 +635,7 @@
 }
 
 /*! \brief Find via branch parameter */
-static void find_via_branch(struct sip_request *req, char *viabuf, size_t vialen)
+GNURK void find_via_branch(struct sip_request *req, char *viabuf, size_t vialen)
 {
 	char *dupvia;
 	char *viabranch;
@@ -651,7 +651,7 @@
 		*sep = '\0';
 	if (ast_test_flag(req, SIP_PKT_DEBUG) && option_debug > 3)
 		ast_log(LOG_DEBUG, "* Found via branch %s\n", viabranch);
-	strncpy(viabuf, vialen, viabranch);
+	strncpy(viabuf, viabranch, vialen);
 }
 
 

Modified: team/oej/codename-pineapple/channels/sip3/sip3_compose.c
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/channels/sip3/sip3_compose.c?rev=47220&r1=47219&r2=47220&view=diff
==============================================================================
--- team/oej/codename-pineapple/channels/sip3/sip3_compose.c (original)
+++ team/oej/codename-pineapple/channels/sip3/sip3_compose.c Mon Nov  6 08:50:37 2006
@@ -133,7 +133,7 @@
 }
 
 /*! \brief Prepare SIP response packet */
-int respprep(struct sip_request *resp, struct sip_dialog *p, const char *msg, struct sip_request *req)
+int respprep(struct sip_request *resp, struct sip_dialog *p, const char *msg, const struct sip_request *req)
 {
 	char newto[256];
 	const char *ot;
@@ -143,9 +143,10 @@
 	if (msg[0] == '2')
 		copy_all_header(resp, req, "Record-Route");
 	copy_header(resp, req, "From");	/* XXX this can be simplified when we are sure that req->from works*/
-	if (ast_strlen_zero(req->to))
-		req->to = get_header(req, "To");
-	ot = req->to;
+	if (!ast_strlen_zero(req->to))
+		ot = req->to;
+	else
+		ot = get_header(req, "To");
 		
 	if (!strcasestr(ot, "tag=") && strncmp(msg, "100", 3)) {
 		/* Add the proper tag if we don't have it already.  If they have specified

Modified: team/oej/codename-pineapple/channels/sip3/sip3_config.c
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/channels/sip3/sip3_config.c?rev=47220&r1=47219&r2=47220&view=diff
==============================================================================
--- team/oej/codename-pineapple/channels/sip3/sip3_config.c (original)
+++ team/oej/codename-pineapple/channels/sip3/sip3_config.c Mon Nov  6 08:50:37 2006
@@ -93,6 +93,21 @@
 	.impl = ""
 };
 
+/*! \brief * implement the servar config line */
+static struct ast_variable *add_var(const char *buf, struct ast_variable *list)
+{
+	struct ast_variable *tmpvar = NULL;
+	char *varname = ast_strdupa(buf), *varval = NULL;
+	
+	if ((varval = strchr(varname,'='))) {
+		*varval++ = '\0';
+		if ((tmpvar = ast_variable_new(varname, varval))) {
+			tmpvar->next = list;
+			list = tmpvar;
+		}
+	}
+	return list;
+}
 /*! \brief Destroy disused contexts between reloads
 	Only used in reload_config so the code for regcontext doesn't get ugly
 */
@@ -301,8 +316,6 @@
 	int firstpass = 1;
 	int format = 0;		/* Ama flags */
 	time_t regseconds = 0;
-	char *varname = NULL, *varval = NULL;
-	struct ast_variable *tmpvar = NULL;
 	struct ast_flags peerflags[2] = {{(0)}};
 	struct ast_flags mask[2] = {{(0)}};
 	int register_lineno = 0;
@@ -499,15 +512,7 @@
 				peer->rtpkeepalive = global.rtpkeepalive;
 			}
 		} else if (!strcasecmp(v->name, "setvar")) {
-			/* Set peer channel variable */
-			varname = ast_strdupa(v->value);
-			if ((varval = strchr(varname, '='))) {
-				*varval++ = '\0';
-				if ((tmpvar = ast_variable_new(varname, varval))) {
-					tmpvar->next = peer->chanvars;
-					peer->chanvars = tmpvar;
-				}
-			}
+			peer->chanvars = add_var(v->value, peer->chanvars);
 		} else if (!strcasecmp(v->name, "qualify")) {
 			if (!strcasecmp(v->value, "no")) {
 				peer->maxms = 0;

Modified: team/oej/codename-pineapple/channels/sip3/sip3_dialog.c
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/channels/sip3/sip3_dialog.c?rev=47220&r1=47219&r2=47220&view=diff
==============================================================================
--- team/oej/codename-pineapple/channels/sip3/sip3_dialog.c (original)
+++ team/oej/codename-pineapple/channels/sip3/sip3_dialog.c Mon Nov  6 08:50:37 2006
@@ -922,7 +922,7 @@
 	if (option_debug > 4 )
 		ast_log(LOG_DEBUG, "= Looking for  Call ID: %s (Checking %s) --From tag %s --To-tag %s  \n", req->callid, req->method==SIP_RESPONSE ? "To" : "From", fromtag, totag);
 
-	findviabranch(req, branch, sizeof(branch));
+	find_via_branch(req, branch, sizeof(branch));
 	dialoglist_lock();
 	for (cur = dialoglist; cur; cur = cur->next) {
 		/* we do not want packets with bad syntax to be connected to a PVT */
@@ -969,7 +969,7 @@
 				from several UAs on one request.
 				For requests, we might be getting a statelessly forked call to us. 
 			*/
-			if (!ast_strlen_zero(cur->remotebranch) && strcmp(cur->remotebranch, branch) {
+			if (!ast_strlen_zero(cur->remotebranch) && strcmp(cur->remotebranch, branch)) {
 				
 			}
 		}

Modified: team/oej/codename-pineapple/channels/sip3/sip3funcs.h
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/channels/sip3/sip3funcs.h?rev=47220&r1=47219&r2=47220&view=diff
==============================================================================
--- team/oej/codename-pineapple/channels/sip3/sip3funcs.h (original)
+++ team/oej/codename-pineapple/channels/sip3/sip3funcs.h Mon Nov  6 08:50:37 2006
@@ -83,6 +83,7 @@
 GNURK void ast_quiet_chan(struct ast_channel *chan);
 GNURK void sip_dump_history(struct sip_dialog *dialog);	/* Dump history to LOG_DEBUG at end of dialog, before destroying data */
 GNURK void free_old_route(struct sip_route *route);
+GNURK void find_via_branch(struct sip_request *req, char *viabuf, size_t vialen);
 
 /*! sip3_refer.c */
 GNURK const char *referstatus2str(enum referstatus rstatus) attribute_pure;
@@ -136,7 +137,7 @@
 GNURK void append_date(struct sip_request *req);
 GNURK int add_text(struct sip_request *req, const char *text);
 GNURK int add_digit(struct sip_request *req, char digit);
-GNURK int respprep(struct sip_request *resp, struct sip_dialog *p, const char *msg, struct sip_request *req);
+GNURK int respprep(struct sip_request *resp, struct sip_dialog *p, const char *msg, const struct sip_request *req);
 GNURK void add_route(struct sip_request *req, struct sip_route *route);
 GNURK int add_line(struct sip_request *req, const char *line);
 GNURK int add_header_contentLength(struct sip_request *req, int len);



More information about the asterisk-commits mailing list