diff --git a/channels/chan_sip.c b/channels/chan_sip.c index af353db1a0..9d2564d997 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -11006,6 +11006,8 @@ static int get_rdnis(struct sip_pvt *p, struct sip_request *oreq) if (ast_strlen_zero(tmp)) return 0; + params = strchr(tmp, ';'); + exten = get_in_brackets(tmp); if (!strncasecmp(exten, "sip:", 4)) { exten += 4; @@ -11017,7 +11019,7 @@ static int get_rdnis(struct sip_pvt *p, struct sip_request *oreq) } /* Get diversion-reason param if present */ - if ((params = strchr(tmp, ';'))) { + if (params) { *params = '\0'; /* Cut off parameters */ params++; while (*params == ';' || *params == ' ')