# HG changeset patch # User Mychaela Falconia # Date 1692170637 28800 # Node ID b997de02771798515a132e23301c21b1908a2b81 # Parent 9f96e5b14755b27796176b596043eb8ad5881d56 themwi-update-outrt: special-num route-to: add support for explicit setting of SIP user part diff -r 9f96e5b14755 -r b997de027717 utils/themwi-update-outrt.c --- a/utils/themwi-update-outrt.c Tue Aug 15 11:28:30 2023 -0800 +++ b/utils/themwi-update-outrt.c Tue Aug 15 23:23:57 2023 -0800 @@ -337,7 +337,7 @@ char *num_code, *cp; { struct special_num_route *rec; - char *dest_name; + char *dest_name, *new_sip_user; int dest_id; while (isspace(*cp)) @@ -354,8 +354,23 @@ *cp++ = '\0'; while (isspace(*cp)) cp++; - if (*cp != '\0' && *cp != '#') - goto inv_syntax; + if (*cp != '\0' && *cp != '#') { + for (new_sip_user = cp; *cp && !isspace(*cp); cp++) + ; + if (*cp) + *cp++ = '\0'; + while (isspace(*cp)) + cp++; + if (*cp != '\0' && *cp != '#') + goto inv_syntax; + if (strlen(new_sip_user) > MAX_SIP_USER_PART) { + fprintf(stderr, + "out-routes line %d: new SIP user part is too long\n", + lineno); + exit(1); + } + } else + new_sip_user = 0; dest_id = find_dest_by_name(dest_name); if (dest_id < 0) { fprintf(stderr, @@ -365,7 +380,7 @@ } rec = special_num_records + special_num_count; strcpy(rec->special_num, num_code); - strcpy(rec->sip_user, num_code); + strcpy(rec->sip_user, new_sip_user ? new_sip_user : num_code); rec->sip_dest_id = dest_id; rec->flags = is_e911 ? SPECIAL_NUM_FLAG_E911 : 0; special_num_count++;