FreeCalypso > hg > themwi-system-sw
view sip-in/sip_uas.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 | 0d6435808bcd |
children |
line wrap: on
line source
/* * Basic UAS functions for themwi-sip-in. */ #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 <syslog.h> #include "../libsip/parse.h" #include "../libsip/uas_basic.h" #include "../libsip/out_msg.h" static void unsupported_method(req, ess, sin) struct sip_pkt_rx *req; struct uas_parse_hdrs *ess; struct sockaddr_in *sin; { struct sip_msg_out resp; int rc; start_response_out_msg(&resp, "501 Method not supported"); rc = add_resp_basic_headers(&resp, ess, req->req_method); if (rc < 0) { too_long: syslog(LOG_ERR, "sending 501 error: response length exceeded"); return; } rc = out_msg_add_header(&resp, "Allow", "INVITE,ACK,PRACK,CANCEL,BYE"); if (rc < 0) goto too_long; out_msg_finish(&resp); sip_tx_packet(&resp, sin); } void process_sip_request(msg, sin) struct sip_pkt_rx *msg; struct sockaddr_in *sin; { struct uas_parse_hdrs ess; int rc; rc = uas_get_basic_headers(msg, &ess); if (rc < 0) { syslog(LOG_ERR, "SIP %.16s request: bad or missing %s header", msg->req_method, ess.error_field); return; } /* dispatch by method */ if (!strcmp(msg->req_method, "INVITE")) handle_sip_invite(msg, &ess, sin); else if (!strcmp(msg->req_method, "ACK")) handle_sip_ack(msg, &ess, sin); else if (!strcmp(msg->req_method, "PRACK")) handle_sip_prack(msg, &ess, sin); else if (!strcmp(msg->req_method, "CANCEL")) handle_sip_cancel(msg, &ess, sin); else if (!strcmp(msg->req_method, "BYE")) handle_sip_bye(msg, &ess, sin); else unsupported_method(msg, &ess, sin); }