/* function used to extract the CallerID number from the channel string */ void voctel_getcalleridnum(char *acctcid, char *chancid) { char *p, *e=NULL; 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; acctcid = malloc(len+1); strncpy(acctcid, p, len); acctcid[len] = '\0'; } else { acctcid = ""; } /* log the callerid and return */ ast_log(LOG_DEBUG, "VoctelRoute: Extracted CallerID number '%s' from channel CallerID string '%s'\n", acctcid, chancid); }