FreeCalypso > hg > sipout-test-utils
diff test-fsk/main.c @ 4:030d52b96a23
test-fsk: implement SpanDSP Tx output
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 04 Mar 2024 22:08:19 -0800 |
parents | 26383ed8b79f |
children | ba66d297fe57 |
line wrap: on
line diff
--- a/test-fsk/main.c Mon Mar 04 21:22:27 2024 -0800 +++ b/test-fsk/main.c Mon Mar 04 22:08:19 2024 -0800 @@ -13,6 +13,7 @@ #include <string.h> #include <strings.h> #include <unistd.h> +#include <spandsp.h> #include "../libsip/out_msg.h" #include "../libsip/sdp.h" @@ -30,6 +31,7 @@ unsigned max_forwards = 70; int declare_100rel_supp; int pcma_codec_pref, pcma_codec_force; +int fsk_mode_rx, fsk_mode_tx; send_invite_req() { @@ -75,6 +77,23 @@ } static void +select_modulation(modname) + char *modname; +{ + if (!strcmp(modname, "v21")) { + fsk_mode_rx = FSK_V21CH2; + fsk_mode_tx = FSK_V21CH1; + } else if (!strcmp(modname, "bell103")) { + fsk_mode_rx = FSK_BELL103CH2; + fsk_mode_tx = FSK_BELL103CH1; + } else { + fprintf(stderr, "error: modulation name \"%s\" unknown\n", + modname); + exit(1); + } +} + +static void preliminary_proc(argc, argv) char **argv; { @@ -104,12 +123,12 @@ default: usage: fprintf(stderr, - "usage: %s [options] dest-conf from-num to-num\n", + "usage: %s [options] dest-conf from-num to-num mode\n", argv[0]); exit(1); } } - if (argc != optind + 3) + if (argc != optind + 4) goto usage; read_config_file(argv[optind]); open_sip_udp_socket(); @@ -120,6 +139,7 @@ sprintf(from_uri, "<sip:%s@%s>;tag=out%u", argv[optind+1], inet_ntoa(sip_bind_ip), ntohs(rtp_local_addr.sin_port)); sprintf(to_uri, "sip:%s@%s", argv[optind+2], sip_dest_domain); + select_modulation(argv[optind+3]); if (logfile) { rc = open_sip_log_file(logfile); if (rc < 0)