[asterisk-commits] murf: branch murf/bug11210 r101077 - in /team/murf/bug11210: ./ apps/ channel...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 29 17:40:38 CST 2008


Author: murf
Date: Tue Jan 29 17:40:38 2008
New Revision: 101077

URL: http://svn.digium.com/view/asterisk?view=rev&rev=101077
Log:
Merged revisions 100741,100767,100794-100795,100833,100843,100900,100928,100931,100933,100935,100974,101018,101036 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r100741 | oej | 2008-01-29 01:28:43 -0700 (Tue, 29 Jan 2008) | 3 lines

Removing code that wasn't supposed to be there at all, only at an experimental stage
before I found another solution. Thanks Kevin, for reminding me.

................
r100767 | oej | 2008-01-29 02:18:42 -0700 (Tue, 29 Jan 2008) | 16 lines

Merged revisions 100740 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r100740 | oej | 2008-01-29 09:26:48 +0100 (Tis, 29 Jan 2008) | 8 lines

(closes issue #11736)
Reported by: MVF
Patches: 
      bug11736-2.diff uploaded by oej (license 306)
Tested by: oej, MVF, revolution

(russellb: This was the showstopper for the release.)

........

................
r100794 | crichter | 2008-01-29 03:47:06 -0700 (Tue, 29 Jan 2008) | 9 lines

Merged revisions 96199 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r96199 | crichter | 2008-01-03 13:12:27 +0100 (Do, 03 Jan 2008) | 1 line

make sure frame is completely clean, before we send it to asterisk as DTMF. If we don't make it clean, it happens that one way audio occurs..
........

................
r100795 | crichter | 2008-01-29 03:50:29 -0700 (Tue, 29 Jan 2008) | 9 lines

Merged revisions 100793 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r100793 | crichter | 2008-01-29 11:36:19 +0100 (Di, 29 Jan 2008) | 1 line

fixed potential segfault in misdn show channels CLI command
........

................
r100833 | file | 2008-01-29 08:30:19 -0700 (Tue, 29 Jan 2008) | 4 lines

Make externip work as documented. If no port is specified it will use the value of bindport instead of always being 5060.
(closes issue #11858)
Reported by: hmodes

................
r100843 | qwell | 2008-01-29 09:14:08 -0700 (Tue, 29 Jan 2008) | 13 lines

Merged revisions 100835 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r100835 | qwell | 2008-01-29 10:10:00 -0600 (Tue, 29 Jan 2008) | 5 lines

Allow zap groups above 30 to work properly.

(closes issue #11590)
Reported by: tbsky

........

................
r100900 | russell | 2008-01-29 10:16:34 -0700 (Tue, 29 Jan 2008) | 14 lines

Merged revisions 100882 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r100882 | russell | 2008-01-29 11:06:43 -0600 (Tue, 29 Jan 2008) | 6 lines

Fix building Asterisk when the working path has spaces in it.

(closes issue #11834)
Reported by: spendergrass
Patched by: me

........

................
r100928 | russell | 2008-01-29 10:22:47 -0700 (Tue, 29 Jan 2008) | 11 lines

Merged revisions 100922 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r100922 | russell | 2008-01-29 11:21:33 -0600 (Tue, 29 Jan 2008) | 3 lines

Use GNU make magic instead of shell magic to escape spaces in the working directory.
(related to issue #11834)

........

................
r100931 | qwell | 2008-01-29 10:42:48 -0700 (Tue, 29 Jan 2008) | 14 lines

Merged revisions 100930 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r100930 | qwell | 2008-01-29 11:41:43 -0600 (Tue, 29 Jan 2008) | 6 lines

Initialize an array to 0s if config option not specified.

(closes issue #11860)
Patches:
      misdn_get_config.v1.diff uploaded by IgorG (license 20)

........

................
r100933 | russell | 2008-01-29 10:44:05 -0700 (Tue, 29 Jan 2008) | 12 lines

Merged revisions 100932 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r100932 | russell | 2008-01-29 11:43:41 -0600 (Tue, 29 Jan 2008) | 4 lines

Fix the last couple of issues related to building from a path that contains spaces.

(closes issue #11834)

........

................
r100935 | file | 2008-01-29 10:58:37 -0700 (Tue, 29 Jan 2008) | 11 lines

Blocked revisions 100934 via svnmerge

........
r100934 | file | 2008-01-29 13:57:05 -0400 (Tue, 29 Jan 2008) | 4 lines

Don't forget to record the channel so we know whether it is bridged or not later.
(closes issue #11811)
Reported by: slavon

........

................
r100974 | mmichelson | 2008-01-29 12:41:42 -0700 (Tue, 29 Jan 2008) | 14 lines

Merged revisions 100973 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r100973 | mmichelson | 2008-01-29 13:39:00 -0600 (Tue, 29 Jan 2008) | 6 lines

Fixing an erroneous return value returned when attempting to pause or unpause a queue member
fails.

Fixes BE-366, thanks to John Bigelow for writing the patch.


........

................
r101018 | tilghman | 2008-01-29 15:04:15 -0700 (Tue, 29 Jan 2008) | 2 lines

Oops, a sizeof error

................
r101036 | mmichelson | 2008-01-29 16:02:48 -0700 (Tue, 29 Jan 2008) | 11 lines

Merged revisions 101035 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r101035 | mmichelson | 2008-01-29 17:02:03 -0600 (Tue, 29 Jan 2008) | 3 lines

Remove a memory leak from updating realtime queues


........

................

Modified:
    team/murf/bug11210/   (props changed)
    team/murf/bug11210/Makefile
    team/murf/bug11210/apps/app_queue.c
    team/murf/bug11210/channels/chan_misdn.c
    team/murf/bug11210/channels/chan_sip.c
    team/murf/bug11210/channels/chan_zap.c
    team/murf/bug11210/channels/misdn_config.c
    team/murf/bug11210/main/Makefile
    team/murf/bug11210/res/res_config_curl.c

Propchange: team/murf/bug11210/
------------------------------------------------------------------------------
    automerge = yes

Propchange: team/murf/bug11210/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

Propchange: team/murf/bug11210/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/murf/bug11210/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Jan 29 17:40:38 2008
@@ -1,1 +1,1 @@
-/trunk:1-100738
+/trunk:1-101060

Modified: team/murf/bug11210/Makefile
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/Makefile?view=diff&rev=101077&r1=101076&r2=101077
==============================================================================
--- team/murf/bug11210/Makefile (original)
+++ team/murf/bug11210/Makefile Tue Jan 29 17:40:38 2008
@@ -108,7 +108,9 @@
 #Uncomment this to see all build commands instead of 'quiet' output
 #NOISY_BUILD=yes
 
-ASTTOPDIR:=$(CURDIR)
+empty:=
+space:=$(empty) $(empty)
+ASTTOPDIR:=$(subst $(space),\$(space),$(CURDIR))
 
 # Overwite config files on "make samples"
 OVERWRITE=y

Modified: team/murf/bug11210/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/apps/app_queue.c?view=diff&rev=101077&r1=101076&r2=101077
==============================================================================
--- team/murf/bug11210/apps/app_queue.c (original)
+++ team/murf/bug11210/apps/app_queue.c Tue Jan 29 17:40:38 2008
@@ -1555,8 +1555,7 @@
 	char *interface = NULL;
 	struct ao2_iterator mem_iter;
 
-	member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name", q->name , NULL);
-	if (!member_config) {
+	if (!(member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name", q->name , NULL))) {
 		/*This queue doesn't have realtime members*/
 		ast_debug(3, "Queue %s has no realtime members defined. No need for update\n", q->name);
 		return;
@@ -1591,6 +1590,7 @@
 		ao2_ref(m, -1);
 	}
 	ao2_unlock(q);
+	ast_config_destroy(member_config);
 }
 
 static int join_queue(char *queuename, struct queue_ent *qe, enum queue_result *reason)
@@ -4007,7 +4007,7 @@
 	if (set_member_paused(args.queuename, args.interface, args.reason, 1)) {
 		ast_log(LOG_WARNING, "Attempt to pause interface %s, not found\n", args.interface);
 		pbx_builtin_setvar_helper(chan, "PQMSTATUS", "NOTFOUND");
-		return -1;
+		return 0;
 	}
 
 	pbx_builtin_setvar_helper(chan, "PQMSTATUS", "PAUSED");
@@ -4042,7 +4042,7 @@
 	if (set_member_paused(args.queuename, args.interface, args.reason, 0)) {
 		ast_log(LOG_WARNING, "Attempt to unpause interface %s, not found\n", args.interface);
 		pbx_builtin_setvar_helper(chan, "UPQMSTATUS", "NOTFOUND");
-		return -1;
+		return 0;
 	}
 
 	pbx_builtin_setvar_helper(chan, "UPQMSTATUS", "UNPAUSED");

Modified: team/murf/bug11210/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/channels/chan_misdn.c?view=diff&rev=101077&r1=101076&r2=101077
==============================================================================
--- team/murf/bug11210/channels/chan_misdn.c (original)
+++ team/murf/bug11210/channels/chan_misdn.c Tue Jan 29 17:40:38 2008
@@ -1251,10 +1251,19 @@
 	help = cl_te;
   
 	ast_cli(a->fd, "Channel List: %p\n", cl_te); 
-  
+
 	for (; help; help = help->next) {
 		struct misdn_bchannel *bc = help->bc;   
 		struct ast_channel *ast = help->ast;
+		if (!ast) {
+			if (!bc) {
+				ast_cli(a->fd, "chan_list obj. with l3id:%x has no bc and no ast Leg\n", help->l3id);
+				continue;
+			}
+			ast_cli(a->fd, "bc with pid:%d has no Ast Leg\n", bc->pid);
+			continue;
+		}
+
 		if (misdn_debug[0] > 2)
 			ast_cli(a->fd, "Bc:%p Ast:%p\n", bc, ast);
 		if (bc) {
@@ -4163,6 +4172,7 @@
 			/*  sending INFOS as DTMF-Frames :) */
 			struct ast_frame fr;
 			int digits;
+			memset(&fr, 0, sizeof(fr));
 			fr.frametype = AST_FRAME_DTMF;
 			fr.subclass = bc->info_dad[0] ;
 			fr.src = NULL;

Modified: team/murf/bug11210/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/channels/chan_sip.c?view=diff&rev=101077&r1=101076&r2=101077
==============================================================================
--- team/murf/bug11210/channels/chan_sip.c (original)
+++ team/murf/bug11210/channels/chan_sip.c Tue Jan 29 17:40:38 2008
@@ -970,6 +970,7 @@
 #define SIP_PAGE2_RTCACHEFRIENDS	(1 << 0)	/*!< GP: Should we keep RT objects in memory for extended time? */
 #define SIP_PAGE2_RTAUTOCLEAR		(1 << 2)	/*!< GP: Should we clean memory from peers after expiry? */
 /* Space for addition of other realtime flags in the future */
+#define SIP_PAGE2_STATECHANGEQUEUE	(1 << 9)	/*!< D: Unsent state pending change exists */
 
 #define SIP_PAGE2_VIDEOSUPPORT		(1 << 14)	/*!< DP: Video supported if offered? */
 #define SIP_PAGE2_TEXTSUPPORT		(1 << 15)	/*!< GDP: Global text enable */
@@ -1267,7 +1268,7 @@
 	int noncecount;				/*!< Nonce-count */
 	char lastmsg[256];			/*!< Last Message sent/received */
 	int amaflags;				/*!< AMA Flags */
-	int pendinginvite;			/*!< Any pending invite ? (seqno of this) */
+	int pendinginvite;			/*!< Any pending INVITE or state NOTIFY (in subscribe pvt's) ? (seqno of this) */
 	struct sip_request initreq;		/*!< Latest request that opened a new transaction
 							within this dialog.
 							NOT the request that opened the dialog
@@ -8944,7 +8945,6 @@
 	enum state { NOTIFY_OPEN, NOTIFY_INUSE, NOTIFY_CLOSED } local_state = NOTIFY_OPEN;
 	char *pidfstate = "--";
 	char *pidfnote= "Ready";
-	int res;
 	
 	memset(from, 0, sizeof(from));
 	memset(to, 0, sizeof(to));
@@ -9110,8 +9110,9 @@
 	add_header_contentLength(&req, tmp->used);
 	add_line(&req, tmp->str);
 
-	res = send_request(p, &req, XMIT_RELIABLE, p->ocseq);
-	return res;
+	p->pendinginvite = p->ocseq;	/* Remember that we have a pending NOTIFY in order not to confuse the NOTIFY subsystem */
+
+	return send_request(p, &req, XMIT_RELIABLE, p->ocseq);
 }
 
 /*! \brief Notify user of messages waiting in voicemail
@@ -10382,10 +10383,17 @@
 		p->laststate = state;
 		break;
 	}
-	if (p->subscribed != NONE)	/* Only send state NOTIFY if we know the format */
-		transmit_state_notify(p, state, 1, FALSE);
-
-	ast_verb(2, "Extension Changed %s new state %s for Notify User %s\n", exten, ast_extension_state2str(state), p->username);
+	if (p->subscribed != NONE) {	/* Only send state NOTIFY if we know the format */
+		if (!p->pendinginvite) {
+			transmit_state_notify(p, state, 1, FALSE);
+		} else {
+			/* We already have a NOTIFY sent that is not answered. Queue the state up.
+			   if many state changes happen meanwhile, we will only send a notification of the last one */
+			ast_set_flag(&p->flags[1], SIP_PAGE2_STATECHANGEQUEUE);
+		}
+	}
+	ast_verb(2, "Extension Changed %s[%s] new state %s for Notify User %s %s\n", exten, context, ast_extension_state2str(state), p->username,
+			ast_test_flag(&p->flags[1], SIP_PAGE2_STATECHANGEQUEUE) ? "(queued)" : "");
 
 	sip_pvt_unlock(p);
 
@@ -15004,10 +15012,6 @@
 					manager_event(EVENT_FLAG_SYSTEM, "ChannelUpdate",
 						"Channel: %s\r\nChanneltype: %s\r\nUniqueid: %s\r\nSIPcallid: %s\r\nSIPfullcontact: %s\r\nPeername: %s\r\n",
 						p->owner->name, p->owner->uniqueid, "SIP", p->callid, p->fullcontact, p->peername);
-				/* Set bridged channel variable */
-				bridgepeer = ast_bridged_channel(p->owner);
-				if (bridgepeer)
-					pbx_builtin_setvar_helper(bridgepeer, "SIP_BRIDGED_CALLID", p->callid);
 			} else {	/* RE-invite */
 				ast_queue_frame(p->owner, &ast_null_frame);
 			}
@@ -15493,6 +15497,10 @@
 		__sip_semi_ack(p, seqno, 0, sipmethod);
 	else
 		__sip_ack(p, seqno, 0, sipmethod);
+
+	/* If this is a NOTIFY for a subscription clear the flag that indicates that we have a NOTIFY pending */
+	if (!p->owner && sipmethod == SIP_NOTIFY && p->pendinginvite) 
+		p->pendinginvite = 0;
 
 	/* Get their tag if we haven't already */
 	if (ast_strlen_zero(p->theirtag) || (resp >= 200)) {
@@ -15552,6 +15560,11 @@
 				} else {
 					if (p->subscribed == NONE) 
 						p->needdestroy = 1;
+					if (ast_test_flag(&p->flags[1], SIP_PAGE2_STATECHANGEQUEUE)) {
+						/* Ready to send the next state we have on queue */
+						ast_clear_flag(&p->flags[1], SIP_PAGE2_STATECHANGEQUEUE);
+						cb_extensionstate((char *)p->context, (char *)p->exten, p->laststate, (void *) p);
+					}
 				}
 			} else if (sipmethod == SIP_REGISTER) 
 				res = handle_response_register(p, resp, rest, req, seqno);
@@ -21090,7 +21103,6 @@
 	ourport_tcp = STANDARD_SIP_PORT;
 	ourport_tls = STANDARD_TLS_PORT;
 	bindaddr.sin_port = htons(STANDARD_SIP_PORT);
-	externip.sin_port = htons(STANDARD_SIP_PORT);
 	global_srvlookup = DEFAULT_SRVLOOKUP;
 	global_tos_sip = DEFAULT_TOS_SIP;
 	global_tos_audio = DEFAULT_TOS_AUDIO;
@@ -21389,6 +21401,9 @@
 			if (ast_parse_arg(v->value, PARSE_INADDR, &externip))
 				ast_log(LOG_WARNING, "Invalid address for externip keyword: %s\n", v->value);
 			externexpire = 0;
+			/* If no port was specified use the value of bindport */
+			if (!externip.sin_port)
+				externip.sin_port = bindaddr.sin_port;
 		} else if (!strcasecmp(v->name, "externhost")) {
 			ast_copy_string(externhost, v->value, sizeof(externhost));
 			if (ast_parse_arg(externhost, PARSE_INADDR, &externip))

Modified: team/murf/bug11210/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/channels/chan_zap.c?view=diff&rev=101077&r1=101076&r2=101077
==============================================================================
--- team/murf/bug11210/channels/chan_zap.c (original)
+++ team/murf/bug11210/channels/chan_zap.c Tue Jan 29 17:40:38 2008
@@ -8533,7 +8533,7 @@
 	return tmp;
 }
 
-static inline int available(struct zt_pvt *p, int channelmatch, int groupmatch, int *busy, int *channelmatched, int *groupmatched)
+static inline int available(struct zt_pvt *p, int channelmatch, ast_group_t groupmatch, int *busy, int *channelmatched, int *groupmatched)
 {
 	int res;
 	ZT_PARAMS par;
@@ -8713,7 +8713,7 @@
 
 static struct ast_channel *zt_request(const char *type, int format, void *data, int *cause)
 {
-	int groupmatch = 0;
+	ast_group_t groupmatch = 0;
 	int channelmatch = -1;
 	int roundrobin = 0;
 	int callwait = 0;
@@ -8756,7 +8756,7 @@
 			ast_log(LOG_WARNING, "Unable to determine group for data %s\n", (char *)data);
 			return NULL;
 		}
-		groupmatch = 1 << x;
+		groupmatch = ((ast_group_t) 1 << x);
 		if (toupper(dest[0]) == 'G') {
 			if (dest[0] == 'G') {
 				backwards = 1;

Modified: team/murf/bug11210/channels/misdn_config.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/channels/misdn_config.c?view=diff&rev=101077&r1=101076&r2=101077
==============================================================================
--- team/murf/bug11210/channels/misdn_config.c (original)
+++ team/murf/bug11210/channels/misdn_config.c Tue Jan 29 17:40:38 2008
@@ -537,7 +537,8 @@
 						ast_copy_string(buf, port_cfg[port][place].str, bufsize);
 					} else if (port_cfg[0][place].str) {
 						ast_copy_string(buf, port_cfg[0][place].str, bufsize);
-					}
+					} else
+						memset(buf, 0, bufsize);
 					break;
 				default:
 					if (port_cfg[port][place].any)

Modified: team/murf/bug11210/main/Makefile
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/main/Makefile?view=diff&rev=101077&r1=101076&r2=101077
==============================================================================
--- team/murf/bug11210/main/Makefile (original)
+++ team/murf/bug11210/main/Makefile Tue Jan 29 17:40:38 2008
@@ -108,11 +108,11 @@
 CHECK_SUBDIR:	# do nothing, just make sure that we recurse in the subdir/
 
 editline/libedit.a: CHECK_SUBDIR
-	cd editline && test -f config.h || CFLAGS="$(PTHREAD_CFLAGS) $(ASTCFLAGS:-Werror=)" LDFLAGS="$(ASTLDFLAGS)" ./configure --build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) --with-ncurses=$(NCURSES_DIR) --with-curses=$(CURSES_DIR) --with-termcap=$(TERMCAP_DIR) --with-tinfo=$(TINFO_DIR)
+	cd editline && test -f config.h || CFLAGS="$(PTHREAD_CFLAGS) $(subst $(ASTTOPDIR),../../,$(ASTCFLAGS:-Werror=))" LDFLAGS="$(ASTLDFLAGS)" ./configure --build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) --with-ncurses=$(NCURSES_DIR) --with-curses=$(CURSES_DIR) --with-termcap=$(TERMCAP_DIR) --with-tinfo=$(TINFO_DIR)
 	$(MAKE) -C editline libedit.a
 
 db1-ast/libdb1.a: CHECK_SUBDIR
-	CFLAGS="$(ASTCFLAGS)" LDFLAGS="$(ASTLDFLAGS)" $(MAKE) -C db1-ast libdb1.a
+	CFLAGS="$(subst $(ASTTOPDIR),../../,$(ASTCFLAGS))" LDFLAGS="$(ASTLDFLAGS)" $(MAKE) -C db1-ast libdb1.a
 
 ast_expr2.c ast_expr2.h:
 	bison -o $@ -d --name-prefix=ast_yy ast_expr2.y

Modified: team/murf/bug11210/res/res_config_curl.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/res/res_config_curl.c?view=diff&rev=101077&r1=101076&r2=101077
==============================================================================
--- team/murf/bug11210/res/res_config_curl.c (original)
+++ team/murf/bug11210/res/res_config_curl.c Tue Jan 29 17:40:38 2008
@@ -61,7 +61,7 @@
 	char *stringp, *pair, *key;
 	int i;
 	struct ast_variable *var=NULL, *prev=NULL;
-	const int EncodeSpecialChars = 1;
+	const int EncodeSpecialChars = 1, bufsize = 64000;
 	char *buffer;
 
 	if (!ast_custom_function_find("CURL")) {
@@ -72,7 +72,7 @@
 	if (!(query = ast_str_create(1000)))
 		return NULL;
 
-	if (!(buffer = ast_malloc(64000))) {
+	if (!(buffer = ast_malloc(bufsize))) {
 		ast_free(query);
 		return NULL;
 	}
@@ -88,7 +88,7 @@
 	va_end(ap);
 
 	ast_str_append(&query, 0, ")}");
-	pbx_substitute_variables_helper(NULL, query->str, buffer, sizeof(buffer));
+	pbx_substitute_variables_helper(NULL, query->str, buffer, bufsize);
 
 	/* Remove any trailing newline characters */
 	if ((stringp = strchr(buffer, '\r')) || (stringp = strchr(buffer, '\n')))
@@ -131,7 +131,8 @@
 	char buf1[200], buf2[200];
 	const char *newparam, *newval;
 	char *stringp, *line, *pair, *key, *initfield = NULL;
-	int i, EncodeSpecialChars = 1;
+	int i;
+	const int EncodeSpecialChars = 1, bufsize = 256000;
 	struct ast_variable *var=NULL;
 	struct ast_config *cfg=NULL;
 	struct ast_category *cat=NULL;
@@ -145,7 +146,7 @@
 	if (!(query = ast_str_create(1000)))
 		return NULL;
 
-	if (!(buffer = ast_malloc(256000))) {
+	if (!(buffer = ast_malloc(bufsize))) {
 		ast_free(query);
 		return NULL;
 	}
@@ -165,7 +166,7 @@
 	ast_str_append(&query, 0, ")}");
 
 	/* Do the CURL query */
-	pbx_substitute_variables_helper(NULL, query->str, buffer, sizeof(buffer));
+	pbx_substitute_variables_helper(NULL, query->str, buffer, bufsize);
 
 	if (!(cfg = ast_config_new()))
 		goto exit_multi;
@@ -224,7 +225,7 @@
 	const char *newparam, *newval;
 	char *stringp;
 	int i, rowcount = -1;
-	const int EncodeSpecialChars = 1;
+	const int EncodeSpecialChars = 1, bufsize = 100;
 	char *buffer;
 
 	if (!ast_custom_function_find("CURL")) {
@@ -235,7 +236,7 @@
 	if (!(query = ast_str_create(1000)))
 		return -1;
 
-	if (!(buffer = ast_malloc(100))) {
+	if (!(buffer = ast_malloc(bufsize))) {
 		ast_free(query);
 		return -1;
 	}
@@ -253,7 +254,7 @@
 	va_end(ap);
 
 	ast_str_append(&query, 0, ")}");
-	pbx_substitute_variables_helper(NULL, query->str, buffer, sizeof(buffer));
+	pbx_substitute_variables_helper(NULL, query->str, buffer, bufsize);
 
 	/* Line oriented output */
 	stringp = buffer;
@@ -290,7 +291,7 @@
 	const char *newparam, *newval;
 	char *stringp;
 	int i, rowcount = -1;
-	const int EncodeSpecialChars = 1;
+	const int EncodeSpecialChars = 1, bufsize = 100;
 	char *buffer;
 
 	if (!ast_custom_function_find("CURL")) {
@@ -301,7 +302,7 @@
 	if (!(query = ast_str_create(1000)))
 		return -1;
 
-	if (!(buffer = ast_malloc(100))) {
+	if (!(buffer = ast_malloc(bufsize))) {
 		ast_free(query);
 		return -1;
 	}
@@ -317,7 +318,7 @@
 	va_end(ap);
 
 	ast_str_append(&query, 0, ")}");
-	pbx_substitute_variables_helper(NULL, query->str, buffer, sizeof(buffer));
+	pbx_substitute_variables_helper(NULL, query->str, buffer, bufsize);
 
 	stringp = buffer;
 	while (*stringp <= ' ')
@@ -355,7 +356,7 @@
 	const char *newparam, *newval;
 	char *stringp;
 	int i, rowcount = -1;
-	const int EncodeSpecialChars = 1;
+	const int EncodeSpecialChars = 1, bufsize = 100;
 	char *buffer;
 
 	if (!ast_custom_function_find("CURL")) {
@@ -366,7 +367,7 @@
 	if (!(query = ast_str_create(1000)))
 		return -1;
 
-	if (!(buffer = ast_malloc(100))) {
+	if (!(buffer = ast_malloc(bufsize))) {
 		ast_free(query);
 		return -1;
 	}
@@ -384,7 +385,7 @@
 	va_end(ap);
 
 	ast_str_append(&query, 0, ")}");
-	pbx_substitute_variables_helper(NULL, query->str, buffer, sizeof(buffer));
+	pbx_substitute_variables_helper(NULL, query->str, buffer, bufsize);
 
 	/* Line oriented output */
 	stringp = buffer;
@@ -407,7 +408,8 @@
 	struct ast_str *query;
 	char buf1[200];
 	char *stringp, *line, *pair, *key;
-	int EncodeSpecialChars = 1, last_cat_metric = -1, cat_metric = -1;
+	const int EncodeSpecialChars = 1, bufsize = 256000;
+	int last_cat_metric = -1, cat_metric = -1;
 	struct ast_category *cat=NULL;
 	char *buffer, *cur_cat = "";
 	char *category = "", *var_name = "", *var_val = "";
@@ -421,7 +423,7 @@
 	if (!(query = ast_str_create(1000)))
 		return NULL;
 
-	if (!(buffer = ast_malloc(256000))) {
+	if (!(buffer = ast_malloc(bufsize))) {
 		ast_free(query);
 		return NULL;
 	}
@@ -430,7 +432,7 @@
 	ast_str_set(&query, 0, "${CURL(%s/static?file=%s)}", url, buf1);
 
 	/* Do the CURL query */
-	pbx_substitute_variables_helper(NULL, query->str, buffer, sizeof(buffer));
+	pbx_substitute_variables_helper(NULL, query->str, buffer, bufsize);
 
 	/* Line oriented output */
 	stringp = buffer;




More information about the asterisk-commits mailing list