comparison sip-manual-out/main.c @ 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
comparison
equal deleted inserted replaced
121:5dc0190a624e 122:07e4cc5f824c
25 struct sockaddr_in sip_dest_sin; 25 struct sockaddr_in sip_dest_sin;
26 char from_uri[128], to_uri[128], call_id[128]; 26 char from_uri[128], to_uri[128], call_id[128];
27 struct timeval cur_event_time; 27 struct timeval cur_event_time;
28 unsigned max_forwards = 70; 28 unsigned max_forwards = 70;
29 int declare_100rel_supp; 29 int declare_100rel_supp;
30 int pcma_codec_pref, pcma_codec_force;
30 31
31 send_invite_req() 32 send_invite_req()
32 { 33 {
33 struct sip_msg_out msg; 34 struct sip_msg_out msg;
34 struct sdp_gen sdp; 35 struct sdp_gen sdp;
54 if (rc < 0) 55 if (rc < 0)
55 goto msg_size_err; 56 goto msg_size_err;
56 bzero(&sdp, sizeof sdp); 57 bzero(&sdp, sizeof sdp);
57 sdp.conn_ip = dummy_rtp_endp.sin_addr; 58 sdp.conn_ip = dummy_rtp_endp.sin_addr;
58 sdp.conn_port = ntohs(dummy_rtp_endp.sin_port); 59 sdp.conn_port = ntohs(dummy_rtp_endp.sin_port);
59 sdp.codec_mask = SDP_CODEC_MASK_BOTH; 60 if (pcma_codec_force)
61 sdp.codec_mask = SDP_CODEC_MASK_PCMA;
62 else {
63 sdp.codec_mask = SDP_CODEC_MASK_BOTH;
64 if (pcma_codec_pref)
65 sdp.codec_mask |= SDP_CODEC_MASK_PCMA_PREF;
66 }
60 sdp.session_id = sdp.conn_port << 16; 67 sdp.session_id = sdp.conn_port << 16;
61 sdp.owner_ip = sip_bind_ip; 68 sdp.owner_ip = sip_bind_ip;
62 rc = out_msg_finish_sdp(&msg, &sdp); 69 rc = out_msg_finish_sdp(&msg, &sdp);
63 if (rc < 0) 70 if (rc < 0)
64 goto msg_size_err; 71 goto msg_size_err;
73 extern char *optarg; 80 extern char *optarg;
74 char *logfile; 81 char *logfile;
75 int opt, rc; 82 int opt, rc;
76 83
77 logfile = 0; 84 logfile = 0;
78 while ((opt = getopt(argc, argv, "l:m:r")) != EOF) { 85 while ((opt = getopt(argc, argv, "aAl:m:r")) != EOF) {
79 switch (opt) { 86 switch (opt) {
87 case 'a':
88 pcma_codec_pref = 1;
89 continue;
90 case 'A':
91 pcma_codec_force = 1;
92 continue;
80 case 'l': 93 case 'l':
81 logfile = optarg; 94 logfile = optarg;
82 continue; 95 continue;
83 case 'm': 96 case 'm':
84 max_forwards = atoi(optarg); 97 max_forwards = atoi(optarg);