3600,3602d3599
< static int my_getsigstr(struct ast_channel *chan, char *str, char term, int ms)
< {
< char c;
3604,3614c3601,3620
< 	*str = 0; /* start with empty output buffer */
< 	for(;;)
< 	{
< 		/* Wait for the first digit (up to specified ms). */
< 		c = ast_waitfordigit(chan,ms);
< 		/* if timeout, hangup or error, return as such */
< 		if (c < 1) return(c);
< 		*str++ = c;
< 		*str = 0;
< 		if (c == term) return(1);
< 	}
---
> static int my_getsigstr(struct ast_channel *chan, char *str, char term, int ms) {
> char c = 0;
> char dtmflen_var[256] = "LENIFFIRSTX";
> char *dtmflen_ptr;
> long int curlen = 0;
> long int dtmf_str_len = 299;                 /* sizeof(dtmfbuf -1); */
>   dtmflen_var[10] = str[-1]; /* Sorry gents - If this doesn't work use *(char *)(str - 1) */
>   if((dtmflen_ptr = pbx_builtin_getvar_helper(chan, dtmflen_var)));
>   else dtmflen_ptr = pbx_builtin_getvar_helper(NULL, dtmflen_var);
>   if(dtmflen_ptr && dtmflen_ptr[0]) dtmf_str_len = strtol(dtmflen_ptr, NULL, 10);
>   for(curlen=0; (++curlen != dtmf_str_len);) {
> 	      /* Wait for the first digit (up to specified ms). */
>     c = ast_waitfordigit(chan,ms);
>               /* if timeout, hangup or error, return as such */
>     if ((c < 1)||(c == term)) break;
>     *str++ = c;
>   }
>   *str = 0;
>   if (c < 1) return(c);
>   return(1);
