diff --git a/cdr/cdr_mysql.c b/cdr/cdr_mysql.c index 666a4e29a1..137febb46e 100755 --- a/cdr/cdr_mysql.c +++ b/cdr/cdr_mysql.c @@ -39,21 +39,18 @@ static MYSQL *mysql; static int mysql_log(struct ast_cdr *cdr) { struct tm *tm; - struct timeval *tv; - struct timezone *tz; - char *sqlcmd, *timestr; + struct timeval tv; + struct timezone tz; + char *sqlcmd, timestr[128]; time_t t; - tv = (struct timeval *)malloc(sizeof(struct timeval)); - tz = (struct timezone *)malloc(sizeof(struct timezone)); sqlcmd = (char *)malloc(2048); - timestr = (char*)malloc(128); memset(sqlcmd,0,2048); - gettimeofday(tv,tz); - t = tv->tv_sec; + gettimeofday(&tv,&tz); + t = tv.tv_sec; tm = localtime(&t); strftime(timestr,128,DATE_FORMAT,tm); diff --git a/channels/chan_sip.c b/channels/chan_sip.c index d525083102..c1afbf3932 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -3189,6 +3189,22 @@ static int sip_poke_peer_s(void *data) return 0; } +static void parse_moved_contact(struct sip_pvt *p, struct sip_request *req) +{ + char tmp[256] = ""; + char *s, *e; + strncpy(tmp, get_header(req, "Contact"), sizeof(tmp) - 1); + s = tmp; + e = strchr(tmp, '@'); + if (e) + *e = '\0'; + if (!strncasecmp(s, "sip:", 4)) + s += 4; + ast_log(LOG_DEBUG, "Found 302 Redirect to extension '%s'\n", s); + if (p->owner) + strncpy(p->owner->call_forward, s, sizeof(p->owner->call_forward) - 1); +} + static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_request *req) { char *to; @@ -3361,6 +3377,11 @@ retrylock: } /* XXX Locking issues?? XXX */ switch(resp) { + case 302: /* Moved temporarily */ + parse_moved_contact(p, req); + if (p->owner) + ast_queue_control(p->owner, AST_CONTROL_BUSY, 0); + break; case 486: /* Busy here */ case 600: /* Busy everywhere */ if (p->owner) diff --git a/pbx.c b/pbx.c index 20d38b3ec7..0c01820d58 100755 --- a/pbx.c +++ b/pbx.c @@ -504,7 +504,7 @@ int ast_extension_match(char *pattern, char *data) { int match; /* If they're the same return */ - if (!strcasecmp(pattern, data)) + if (!strcmp(pattern, data)) return 1; EXTENSION_MATCH_CORE(data,pattern,match); /* Must be at the end of both */ @@ -611,7 +611,7 @@ static struct ast_exten *pbx_find_extension(struct ast_channel *chan, char *cont tmp = contexts; while(tmp) { /* Match context */ - if (!strcasecmp(tmp->name, context)) { + if (!strcmp(tmp->name, context)) { if (*status < STATUS_NO_EXTENSION) *status = STATUS_NO_EXTENSION; eroot = tmp->root;