FreeCalypso > hg > themwi-system-sw
view sip-manual-out/disc_cmd.c @ 124:7e04d28fae8b
sip-in: default use-100rel to no
BulkVS servers act badly when we send a reliable 180 Ringing response
to an incoming call, even though they advertise 100rel support in
the Supported header in the INVITE packet, and we probably won't be
implementing 100rel for outbound because doing per-the-spec PRACK
as a UAC is just too burdensome. Therefore, we need to consider
100rel extension as not-really-supported in themwi-system-sw.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 01 Oct 2022 15:54:50 -0800 |
parents | a36b731bfef9 |
children | f8a33603288f |
line wrap: on
line source
/* * In this module we implement user-driven sending of CANCEL and BYE * disconnection requests. */ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include "../libsip/out_msg.h" extern struct sockaddr_in sip_dest_sin; extern char to_uri[]; send_cancel_req() { struct sip_msg_out msg; int rc; rc = start_request_out_msg(&msg, "CANCEL", to_uri); if (rc < 0) { msg_size_err: fprintf(stderr, "composing CANCEL message: size error\n"); return(-1); } rc = add_req_boilerplate(&msg, "1 CANCEL", 0); if (rc < 0) goto msg_size_err; out_msg_finish(&msg); sip_tx_packet(&msg, &sip_dest_sin); return(0); } send_bye_req() { struct sip_msg_out msg; int rc; rc = start_request_out_msg(&msg, "BYE", to_uri); if (rc < 0) { msg_size_err: fprintf(stderr, "composing BYE message: size error\n"); return(-1); } rc = add_req_boilerplate(&msg, "2 BYE", 1); if (rc < 0) goto msg_size_err; out_msg_finish(&msg); sip_tx_packet(&msg, &sip_dest_sin); return(0); } void select_stdin() { char buf[256], *cp; fgets(buf, sizeof buf, stdin); cp = index(buf, '\n'); if (cp) { while (cp > buf && isspace(cp[-1])) cp--; *cp = '\0'; } for (cp = buf; isspace(*cp); cp++) ; if (!*cp) return; if (!strcmp(cp, "b") || !strcasecmp(cp, "bye")) send_bye_req(); else if (!strcmp(cp, "c") || !strcasecmp(cp, "cancel")) send_cancel_req(); else fprintf(stderr, "error: non-understood stdin command\n"); }