--- asterisk-11.18.0/channels/chan_sip.c 2015-06-04 02:44:42.000000000 +0200 +++ asterisk-11.18.0_CASTEL/channels/chan_sip.c 2015-07-01 12:18:38.687394603 +0200 @@ -16017,11 +16017,11 @@ char data[SIPBUFSIZE]; const char *expires = sip_get_header(req, "Expires"); int expire = atoi(expires); - char *curi = NULL, *hostport = NULL, *transport = NULL; + char *curi = NULL, *hostport = NULL, *transport = NULL, *curi_params = NULL; int transport_type; const char *useragent; struct ast_sockaddr oldsin, testsa; - char *firstcuri = NULL; + char *firstcuri = NULL, *firstcuri_params = NULL; int start = 0; int wildcard_found = 0; int single_binding_found = 0; @@ -16056,9 +16056,22 @@ curi = contact; if (strchr(contact, '<') == NULL) /* No <, check for ; and strip it */ strsep(&curi, ";"); /* This is Header options, not URI options */ - curi = get_in_brackets(contact); + + char *out; + char *residue; + if ((get_in_brackets_full(contact, &out, &residue))) { + curi = contact; + curi_params = ""; + } + else + { + curi = out; + curi_params = residue; + } + //ast_log(LOG_VERBOSE, "Get contact curi=%s with params=%s\n", curi, curi_params); if (!firstcuri) { firstcuri = ast_strdupa(curi); + firstcuri_params = ast_strdupa(curi_params); } if (!strcasecmp(curi, "*")) { @@ -16076,6 +16089,7 @@ ast_copy_string(contact, __get_header(req, "Contact", &start), sizeof(contact)); } while (!ast_strlen_zero(contact)); curi = firstcuri; + curi_params = firstcuri_params; /* if they did not specify Contact: or Expires:, they are querying what we currently have stored as their contact address, so return @@ -16098,6 +16112,7 @@ /* Store whatever we got as a contact from the client */ ast_string_field_set(peer, fullcontact, curi); + ast_string_field_set(peer, fullcontact_params, curi_params); /* For the 200 OK, we should use the received contact */ ast_string_field_build(pvt, our_contact, "<%s>", curi); @@ -20173,6 +20188,7 @@ ast_cli(fd, "%s\n", status); ast_cli(fd, " Useragent : %s\n", peer->useragent); ast_cli(fd, " Reg. Contact : %s\n", peer->fullcontact); + ast_cli(fd, " Reg. Contact Params : %s\n", peer->fullcontact_params); ast_cli(fd, " Qualify Freq : %d ms\n", peer->qualifyfreq); ast_cli(fd, " Keepalive : %d ms\n", peer->keepalive * 1000); if (peer->chanvars) { @@ -20285,6 +20301,7 @@ astman_append(s, "%s\r\n", status); astman_append(s, "SIP-Useragent: %s\r\n", peer->useragent); astman_append(s, "Reg-Contact: %s\r\n", peer->fullcontact); + astman_append(s, "Reg-Contact-Params: %s\r\n", peer->fullcontact_params); astman_append(s, "QualifyFreq: %d ms\r\n", peer->qualifyfreq); astman_append(s, "Parkinglot: %s\r\n", peer->parkinglot); if (peer->chanvars) {