/* function used to extract the CallerID number from the channel string */ char *voctel_getcalleridnum(char *chancid) { char *p, *e=NULL; char *callerid; int len; /* find the beginning bracket */ p = strchr(chancid, '<'); if (p) { p++; /* find the ending bracket */ e = strchr(p, '>'); } /* if there's ending, copy the value */ if (e) { len = e-p; callerid = malloc(len+1); strncpy(callerid, p, len); callerid[len] = '\0'; } else { callerid=""; } /* log the callerid and return */ ast_log(LOG_DEBUG, "VoctelRoute: Extracted CallerID number '%s' from channel string '%s'\n", callerid, chancid); return callerid; }