FreeCalypso > hg > themwi-system-sw
comparison sip-manual-out/main.c @ 123:a36b731bfef9
sip-manual-out: implement sending BYE and CANCEL
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 29 Sep 2022 17:21:11 -0800 |
parents | 07e4cc5f824c |
children | 258932879f8b |
comparison
equal
deleted
inserted
replaced
122:07e4cc5f824c | 123:a36b731bfef9 |
---|---|
38 rc = start_request_out_msg(&msg, "INVITE", to_uri); | 38 rc = start_request_out_msg(&msg, "INVITE", to_uri); |
39 if (rc < 0) { | 39 if (rc < 0) { |
40 msg_size_err: fprintf(stderr, "composing INVITE req: msg size error\n"); | 40 msg_size_err: fprintf(stderr, "composing INVITE req: msg size error\n"); |
41 exit(1); | 41 exit(1); |
42 } | 42 } |
43 rc = add_req_boilerplate(&msg, "1 INVITE"); | 43 rc = add_req_boilerplate(&msg, "1 INVITE", 0); |
44 if (rc < 0) | 44 if (rc < 0) |
45 goto msg_size_err; | 45 goto msg_size_err; |
46 rc = add_contact_header(&msg); | 46 rc = add_contact_header(&msg); |
47 if (rc < 0) | 47 if (rc < 0) |
48 goto msg_size_err; | 48 goto msg_size_err; |
138 ntohs(dummy_rtp_endp.sin_port), inet_ntoa(sip_bind_ip)); | 138 ntohs(dummy_rtp_endp.sin_port), inet_ntoa(sip_bind_ip)); |
139 send_invite_req(); | 139 send_invite_req(); |
140 /* main select loop */ | 140 /* main select loop */ |
141 for (;;) { | 141 for (;;) { |
142 FD_ZERO(&fds); | 142 FD_ZERO(&fds); |
143 FD_SET(0, &fds); | |
143 FD_SET(sip_socket, &fds); | 144 FD_SET(sip_socket, &fds); |
144 rc = select(sip_socket+1, &fds, 0, 0, 0); | 145 rc = select(sip_socket+1, &fds, 0, 0, 0); |
145 if (rc < 0) { | 146 if (rc < 0) { |
146 if (errno == EINTR) | 147 if (errno == EINTR) |
147 continue; | 148 continue; |
148 perror("select"); | 149 perror("select"); |
149 exit(1); | 150 exit(1); |
150 } | 151 } |
151 gettimeofday(&cur_event_time, 0); | 152 gettimeofday(&cur_event_time, 0); |
153 if (FD_ISSET(0, &fds)) | |
154 select_stdin(); | |
152 if (FD_ISSET(sip_socket, &fds)) | 155 if (FD_ISSET(sip_socket, &fds)) |
153 sip_socket_select(); | 156 sip_socket_select(); |
154 } | 157 } |
155 } | 158 } |