annotate sip-manual-out/disc_cmd.c @ 224:62184b971c8e

smpp-send/input.c: copy-n-paste error
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 05 Aug 2023 12:27:36 -0800
parents 1f9a6cede2c5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
123
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * In this module we implement user-driven sending of CANCEL and BYE
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * disconnection requests.
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <sys/types.h>
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <sys/socket.h>
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <netinet/in.h>
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <stdio.h>
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <stdlib.h>
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include <string.h>
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include <strings.h>
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 #include "../libsip/out_msg.h"
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 extern struct sockaddr_in sip_dest_sin;
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 extern char to_uri[];
192
f8a33603288f sip-manual-out: generate outgoing RTP stream with PCM silence
Mychaela Falconia <falcon@freecalypso.org>
parents: 123
diff changeset
17 extern int rtp_out_enable;
123
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 send_cancel_req()
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 {
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 struct sip_msg_out msg;
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 int rc;
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23
192
f8a33603288f sip-manual-out: generate outgoing RTP stream with PCM silence
Mychaela Falconia <falcon@freecalypso.org>
parents: 123
diff changeset
24 rtp_out_enable = 0;
123
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 rc = start_request_out_msg(&msg, "CANCEL", to_uri);
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 if (rc < 0) {
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 msg_size_err: fprintf(stderr, "composing CANCEL message: size error\n");
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 return(-1);
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 }
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 rc = add_req_boilerplate(&msg, "1 CANCEL", 0);
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 if (rc < 0)
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 goto msg_size_err;
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 out_msg_finish(&msg);
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 sip_tx_packet(&msg, &sip_dest_sin);
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 return(0);
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 }
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 send_bye_req()
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 {
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 struct sip_msg_out msg;
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 int rc;
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42
192
f8a33603288f sip-manual-out: generate outgoing RTP stream with PCM silence
Mychaela Falconia <falcon@freecalypso.org>
parents: 123
diff changeset
43 rtp_out_enable = 0;
123
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 rc = start_request_out_msg(&msg, "BYE", to_uri);
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 if (rc < 0) {
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 msg_size_err: fprintf(stderr, "composing BYE message: size error\n");
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 return(-1);
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 }
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 rc = add_req_boilerplate(&msg, "2 BYE", 1);
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 if (rc < 0)
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 goto msg_size_err;
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 out_msg_finish(&msg);
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 sip_tx_packet(&msg, &sip_dest_sin);
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 return(0);
a36b731bfef9 sip-manual-out: implement sending BYE and CANCEL
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 }