FreeCalypso > hg > themwi-system-sw
comparison utils/themwi-update-outrt.c @ 204:de7c64c4d6fd
themwi-update-outrt: add inn-default-rt possibility
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 04 Apr 2023 21:21:04 -0800 |
parents | aa278d75d757 |
children | b0bf167bb846 |
comparison
equal
deleted
inserted
replaced
203:e89619893c1e | 204:de7c64c4d6fd |
---|---|
213 rec->sip_dest_id = dest_id; | 213 rec->sip_dest_id = dest_id; |
214 inn_rec_count++; | 214 inn_rec_count++; |
215 } | 215 } |
216 | 216 |
217 static void | 217 static void |
218 handle_default_rt(cp) | |
219 char *cp; | |
220 { | |
221 char *dest_name; | |
222 struct inn_route *rec; | |
223 int dest_id; | |
224 | |
225 for (dest_name = cp; *cp && !isspace(*cp); cp++) | |
226 ; | |
227 if (*cp) | |
228 *cp++ = '\0'; | |
229 while (isspace(*cp)) | |
230 cp++; | |
231 if (*cp != '\0' && *cp != '#') { | |
232 fprintf(stderr, | |
233 "out-routes line %d: invalid syntax for inn-default-rt\n", | |
234 lineno); | |
235 exit(1); | |
236 } | |
237 dest_id = find_dest_by_name(dest_name); | |
238 if (dest_id < 0) { | |
239 fprintf(stderr, | |
240 "out-routes line %d: SIP destination \"%s\" not defined\n", | |
241 lineno, dest_name); | |
242 exit(1); | |
243 } | |
244 if (inn_rec_count >= MAX_INN_ENTRIES) { | |
245 fprintf(stderr, | |
246 "out-routes line %d: MAX_INN_ENTRIES exceeded\n", | |
247 lineno); | |
248 exit(1); | |
249 } | |
250 rec = inn_records + inn_rec_count; | |
251 rec->prefix[0] = '\0'; | |
252 rec->sip_dest_id = dest_id; | |
253 inn_rec_count++; | |
254 } | |
255 | |
256 static void | |
218 preen_special_num_code(num_code) | 257 preen_special_num_code(num_code) |
219 char *num_code; | 258 char *num_code; |
220 { | 259 { |
221 char *cp; | 260 char *cp; |
222 int c; | 261 int c; |
389 *cp++ = '\0'; | 428 *cp++ = '\0'; |
390 if (!strcmp(np, "dest")) | 429 if (!strcmp(np, "dest")) |
391 handler = handle_dest_line; | 430 handler = handle_dest_line; |
392 else if (!strcmp(np, "inn-route")) | 431 else if (!strcmp(np, "inn-route")) |
393 handler = handle_inn_route; | 432 handler = handle_inn_route; |
433 else if (!strcmp(np, "inn-default-rt")) | |
434 handler = handle_default_rt; | |
394 else if (!strcmp(np, "special-num")) | 435 else if (!strcmp(np, "special-num")) |
395 handler = handle_special_num; | 436 handler = handle_special_num; |
396 else { | 437 else { |
397 fprintf(stderr, | 438 fprintf(stderr, |
398 "out-routes line %d: non-understood keyword \"%s\"\n", | 439 "out-routes line %d: non-understood keyword \"%s\"\n", |