FreeCalypso > hg > themwi-system-sw
changeset 260:b997de027717
themwi-update-outrt: special-num route-to: add support for
explicit setting of SIP user part
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 15 Aug 2023 23:23:57 -0800 |
parents | 9f96e5b14755 |
children | a375639e4190 |
files | utils/themwi-update-outrt.c |
diffstat | 1 files changed, 19 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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++;