diff -ruN asterisk-1.2.31.1-ori/channels/chan_sip.c asterisk-1.2.31.1/channels/chan_sip.c --- asterisk-1.2.31.1-ori/channels/chan_sip.c 2008-06-03 21:30:02.000000000 +0200 +++ asterisk-1.2.31.1/channels/chan_sip.c 2009-03-03 16:13:39.000000000 +0100 @@ -359,6 +359,8 @@ static int pedanticsipchecking = 0; /*!< Extra checking ? Default off */ +static int urlencodesip = 0; /*!< URL encode ? Default off */ + static int autocreatepeer = 0; /*!< Auto creation of peers at registration? Default off. */ static int relaxdtmf = 0; @@ -5022,7 +5024,7 @@ else /* Save for any further attempts */ ast_copy_string(p->fromname, n, sizeof(p->fromname)); - if (pedanticsipchecking) { + if ( (pedanticsipchecking) || (urlencodesip) ) { ast_uri_encode(n, tmp, sizeof(tmp), 0); n = tmp; ast_uri_encode(l, tmp2, sizeof(tmp2), 0); @@ -5043,7 +5045,7 @@ ast_build_string(&invite, &invite_max, "sip:"); if (!ast_strlen_zero(p->username)) { n = p->username; - if (pedanticsipchecking) { + if ( (pedanticsipchecking) || (urlencodesip) ) { ast_uri_encode(n, tmp, sizeof(tmp), 0); n = tmp; } @@ -6635,7 +6637,7 @@ *t = '\0'; ast_copy_string(tmp, get_header(req, "To"), sizeof(tmp)); - if (pedanticsipchecking) + if ( (pedanticsipchecking) || (urlencodesip) ) ast_uri_decode(tmp); c = get_in_brackets(tmp); @@ -6831,13 +6833,13 @@ return -1; } from += 4; - if (pedanticsipchecking) { + if ( (pedanticsipchecking) || (urlencodesip) ) { ast_uri_decode(from); } } else from = NULL; - if (pedanticsipchecking) { + if ( (pedanticsipchecking) || (urlencodesip) ) { ast_uri_decode(uri); } @@ -6963,7 +6965,7 @@ ast_log(LOG_WARNING, "No Referrred-By Header That's not illegal\n"); return -1; } else { - if (pedanticsipchecking) { + if ( (pedanticsipchecking) || (urlencodesip) ) { ast_uri_decode(h_referred_by); } referred_by = get_in_brackets(h_referred_by); @@ -7265,7 +7267,7 @@ *t = '\0'; ast_copy_string(from, get_header(req, "From"), sizeof(from)); - if (pedanticsipchecking) + if ( (pedanticsipchecking) || (urlencodesip) ) ast_uri_decode(from); memset(calleridname,0,sizeof(calleridname)); @@ -8508,6 +8510,7 @@ ast_cli(fd, " MWI NOTIFY mime type: %s\n", default_notifymime); ast_cli(fd, " DNS SRV lookup: %s\n", srvlookup ? "Yes" : "No"); ast_cli(fd, " Pedantic SIP support: %s\n", pedanticsipchecking ? "Yes" : "No"); + ast_cli(fd, " URL encode SIP: %s\n", urlencodesip ? "Yes" : "No"); ast_cli(fd, " Reg. max duration: %d secs\n", max_expiry); ast_cli(fd, " Reg. default duration: %d secs\n", default_expiry); ast_cli(fd, " Outbound reg. timeout: %d secs\n", global_reg_timeout); @@ -12821,6 +12824,7 @@ global_rtpkeepalive = 0; global_rtautoclear = 120; pedanticsipchecking = 0; + urlencodesip = 0; global_reg_timeout = DEFAULT_REGISTRATION_TIMEOUT; global_regattempts_max = 0; ast_clear_flag(&global_flags, AST_FLAGS_ALL); @@ -12930,6 +12934,8 @@ srvlookup = ast_true(v->value); } else if (!strcasecmp(v->name, "pedantic")) { pedanticsipchecking = ast_true(v->value); + } else if (!strcasecmp(v->name, "urlencode")) { + urlencodesip = ast_true(v->value); } else if (!strcasecmp(v->name, "maxexpirey") || !strcasecmp(v->name, "maxexpiry")) { max_expiry = atoi(v->value); if (max_expiry < 1)