All pastes #1237 Raw Edit

Anonymous

public text v1 · immutable
#1237 ·published 2004-10-03 19:54 UTC
rendered paste body
/* 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;
}