aboutsummaryrefslogtreecommitdiffstats
path: root/pbx.c
diff options
context:
space:
mode:
authormartinp <martinp@f38db490-d61c-443f-a65b-d21fe96a405b>2003-06-06 19:47:59 +0000
committermartinp <martinp@f38db490-d61c-443f-a65b-d21fe96a405b>2003-06-06 19:47:59 +0000
commit9a59f698c682e15ab4174fb92db3fd7ff06e708e (patch)
tree49d86c084247853d51bcec26685602a61d312a4f /pbx.c
parentc0ab5cfbbf5620b781e67bdc206e1436ea5d0929 (diff)
Add the variable LEN(STRING) to retrieve the length of the STRING
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1078 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx.c')
-rwxr-xr-xpbx.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/pbx.c b/pbx.c
index e4041ccbf..a0c58fad9 100755
--- a/pbx.c
+++ b/pbx.c
@@ -893,6 +893,17 @@ static void pbx_substitute_variables_temp(struct ast_channel *c,const char *var,
}
}
}
+ if (!(*ret)) {
+ int len=strlen(var);
+ int len_len=strlen("LEN(");
+ if (len > (len_len+1) && !strncasecmp(var,"LEN(",len_len) && strchr(var+len_len+2,')')) {
+ char cp3[80];
+ strncpy(cp3, var, sizeof(cp3) - 1);
+ cp3[len-len_len-1]='\0';
+ sprintf(workspace,"%d",strlen(cp3));
+ *ret = workspace;
+ } else ast_log(LOG_NOTICE, "Wrong use of LEN(VARIABLE)\n");
+ }
}
}