changeset 122:07e4cc5f824c

sip-manual-out: add options to test PCMA codec
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 29 Sep 2022 15:03:12 -0800
parents 5dc0190a624e
children a36b731bfef9
files sip-manual-out/main.c
diffstat 1 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/sip-manual-out/main.c	Thu Sep 29 14:21:10 2022 -0800
+++ b/sip-manual-out/main.c	Thu Sep 29 15:03:12 2022 -0800
@@ -27,6 +27,7 @@
 struct timeval cur_event_time;
 unsigned max_forwards = 70;
 int declare_100rel_supp;
+int pcma_codec_pref, pcma_codec_force;
 
 send_invite_req()
 {
@@ -56,7 +57,13 @@
 	bzero(&sdp, sizeof sdp);
 	sdp.conn_ip = dummy_rtp_endp.sin_addr;
 	sdp.conn_port = ntohs(dummy_rtp_endp.sin_port);
-	sdp.codec_mask = SDP_CODEC_MASK_BOTH;
+	if (pcma_codec_force)
+		sdp.codec_mask = SDP_CODEC_MASK_PCMA;
+	else {
+		sdp.codec_mask = SDP_CODEC_MASK_BOTH;
+		if (pcma_codec_pref)
+			sdp.codec_mask |= SDP_CODEC_MASK_PCMA_PREF;
+	}
 	sdp.session_id = sdp.conn_port << 16;
 	sdp.owner_ip = sip_bind_ip;
 	rc = out_msg_finish_sdp(&msg, &sdp);
@@ -75,8 +82,14 @@
 	int opt, rc;
 
 	logfile = 0;
-	while ((opt = getopt(argc, argv, "l:m:r")) != EOF) {
+	while ((opt = getopt(argc, argv, "aAl:m:r")) != EOF) {
 		switch (opt) {
+		case 'a':
+			pcma_codec_pref = 1;
+			continue;
+		case 'A':
+			pcma_codec_force = 1;
+			continue;
 		case 'l':
 			logfile = optarg;
 			continue;