i have a template for sending messages, in those some {words} are variable.how can i compare these template against sentences and check whether it is success or failed (if possible with percentage of changes)
Template sample :
Hi {var}, Your last call was from {var} at {var} {var} was {var}.
Thank you for using Cloud PBX Services.
Success Message :
Hi Alex, Your last call was from 1234567890 at 10:30 AM was ANSWERED
Thank you for using Cloud PBX Services.
Success Message :
Hi Mary, Your last call was from 6789012345 at 11:30 PM was BUSY
Thank you for using Cloud PBX Services.
Failed Message :
Hi Joe, Your bank account is credited with 1000Rs at 11:30 PM
Thank you for using Cloud PBX Services.
predefined compare function using kannel library
regex_t *gw_regex_comp_real(const Octstr *pattern, int cflags, const char *file,
long line, const char *func)
{
int rc;
regex_t *preg;
preg = gw_malloc(sizeof(regex_t));
if ((rc = regcomp(preg, pattern ? octstr_get_cstr(pattern) : NULL, cflags)) != 0) {
char buffer[512];
regerror(rc, preg, buffer, sizeof(buffer));
error(0, "%s:%ld: %s: regex compilation `%s' failed: %s (Called from %s:%ld:%s.)",
__FILE__, (long) __LINE__, __func__, octstr_get_cstr(pattern), buffer,
(file), (long) (line), (func));
gw_free(preg);
return NULL;
}
return preg;
}