comparison test-fsk/disc_cmd.c @ 2:26383ed8b79f

test-fsk: starting as a copy of test-voice
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 04 Mar 2024 21:03:19 -0800
parents test-voice/disc_cmd.c@35c0d9f03c0a
children
comparison
equal deleted inserted replaced
1:38c4d09882f6 2:26383ed8b79f
1 /*
2 * In this module we implement user-driven sending of CANCEL and BYE
3 * disconnection requests.
4 */
5
6 #include <sys/types.h>
7 #include <sys/socket.h>
8 #include <netinet/in.h>
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <string.h>
12 #include <strings.h>
13 #include "../libsip/out_msg.h"
14
15 extern struct sockaddr_in sip_dest_sin;
16 extern char to_uri[];
17 extern int rtp_out_enable;
18
19 send_cancel_req()
20 {
21 struct sip_msg_out msg;
22 int rc;
23
24 rtp_out_enable = 0;
25 rc = start_request_out_msg(&msg, "CANCEL", to_uri);
26 if (rc < 0) {
27 msg_size_err: fprintf(stderr, "composing CANCEL message: size error\n");
28 return(-1);
29 }
30 rc = add_req_boilerplate(&msg, "1 CANCEL", 0);
31 if (rc < 0)
32 goto msg_size_err;
33 out_msg_finish(&msg);
34 sip_tx_packet(&msg, &sip_dest_sin);
35 return(0);
36 }
37
38 send_bye_req()
39 {
40 struct sip_msg_out msg;
41 int rc;
42
43 rtp_out_enable = 0;
44 rc = start_request_out_msg(&msg, "BYE", to_uri);
45 if (rc < 0) {
46 msg_size_err: fprintf(stderr, "composing BYE message: size error\n");
47 return(-1);
48 }
49 rc = add_req_boilerplate(&msg, "2 BYE", 1);
50 if (rc < 0)
51 goto msg_size_err;
52 out_msg_finish(&msg);
53 sip_tx_packet(&msg, &sip_dest_sin);
54 return(0);
55 }