FreeCalypso > hg > themwi-system-sw
view libsip/uas_basic.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 | 5427b26525cd |
children |
line wrap: on
line source
/* * Here we implement some essential UAS functions. */ #include <ctype.h> #include <string.h> #include <strings.h> #include <stdio.h> #include <stdlib.h> #include "parse.h" #include "uas_basic.h" #include "out_msg.h" extern char *get_single_header(); uas_get_basic_headers(msg, ess) struct sip_pkt_rx *msg; struct uas_parse_hdrs *ess; { char *hval, *cp; int dup_flag = 0; hval = get_single_header(msg, "Call-ID", "i", &dup_flag); if (!hval || dup_flag) { ess->error_field = "Call-ID"; return(-1); } ess->call_id = hval; hval = get_single_header(msg, "CSeq", (char *) 0, &dup_flag); if (!hval || dup_flag) { bad_cseq: ess->error_field = "CSeq"; return(-1); } if (!isdigit(*hval)) goto bad_cseq; ess->cseq_num = strtoul(hval, &cp, 10); if (*cp) { if (!isspace(*cp)) goto bad_cseq; while (isspace(*cp)) cp++; if (strcmp(cp, msg->req_method)) goto bad_cseq; } hval = get_single_header(msg, "From", "f", &dup_flag); if (!hval || dup_flag) { ess->error_field = "From"; return(-1); } ess->from = hval; hval = get_single_header(msg, "To", "t", &dup_flag); if (!hval || dup_flag) { ess->error_field = "To"; return(-1); } ess->to = hval; hval = get_single_header(msg, "Via", "v", &dup_flag); if (!hval || dup_flag) { ess->error_field = "Via"; return(-1); } ess->via = hval; return(0); } add_resp_basic_headers(msg, ess, req_method) struct sip_msg_out *msg; struct uas_parse_hdrs *ess; char *req_method; { char cseq_str[80]; int rc; rc = out_msg_add_header(msg, "From", ess->from); if (rc < 0) return rc; rc = out_msg_add_header(msg, "To", ess->to); if (rc < 0) return rc; rc = out_msg_add_header(msg, "Call-ID", ess->call_id); if (rc < 0) return rc; sprintf(cseq_str, "%u %.64s", ess->cseq_num, req_method); rc = out_msg_add_header(msg, "CSeq", cseq_str); if (rc < 0) return rc; return out_msg_add_header(msg, "Via", ess->via); }