# HG changeset patch # User Mychaela Falconia # Date 1664489623 28800 # Node ID c62d0f28da6f30ff3d32a7be08f8dd65d317657b # Parent 056616f7e8ab89b7a11236c2277b790ba8e5d50a sip-manual-out: make Max-Forwards configurable diff -r 056616f7e8ab -r c62d0f28da6f sip-manual-out/main.c --- a/sip-manual-out/main.c Thu Sep 29 14:03:06 2022 -0800 +++ b/sip-manual-out/main.c Thu Sep 29 14:13:43 2022 -0800 @@ -25,6 +25,7 @@ struct sockaddr_in sip_dest_sin; char from_uri[128], to_uri[128], call_id[128]; struct timeval cur_event_time; +unsigned max_forwards = 70; send_invite_req() { @@ -68,11 +69,14 @@ int opt, rc; logfile = 0; - while ((opt = getopt(argc, argv, "l:")) != EOF) { + while ((opt = getopt(argc, argv, "l:m:")) != EOF) { switch (opt) { case 'l': logfile = optarg; continue; + case 'm': + max_forwards = atoi(optarg); + continue; default: usage: fprintf(stderr, diff -r 056616f7e8ab -r c62d0f28da6f sip-manual-out/uac.c --- a/sip-manual-out/uac.c Thu Sep 29 14:03:06 2022 -0800 +++ b/sip-manual-out/uac.c Thu Sep 29 14:13:43 2022 -0800 @@ -22,6 +22,7 @@ extern struct in_addr sip_bind_ip; extern unsigned sip_bind_port; extern char call_id[], from_uri[], to_uri[]; +extern unsigned max_forwards; char to_tag[MAX_TO_TAG+1]; @@ -53,7 +54,8 @@ rc = out_msg_add_header(msg, "CSeq", cseq); if (rc < 0) return rc; - return out_msg_add_header(msg, "Max-Forwards", "70"); + sprintf(strbuf, "%u", max_forwards); + return out_msg_add_header(msg, "Max-Forwards", strbuf); } add_contact_header(msg)