FreeCalypso > hg > sipout-test-utils
comparison libsip/resp_ident.c @ 0:35c0d9f03c0a
beginning with sipout-test-voice,
a copy of sip-manual-out from themwi-system-sw
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 03 Mar 2024 23:20:19 -0800 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:35c0d9f03c0a |
---|---|
1 /* | |
2 * In this module we implement an essential step in the process | |
3 * of handling incoming SIP response messages: extracting Call-ID | |
4 * and CSeq headers and preparsing the latter, providing key info | |
5 * for matching these incoming responses with call state and | |
6 * with outstanding UAC requests. | |
7 */ | |
8 | |
9 #include <ctype.h> | |
10 #include <string.h> | |
11 #include <strings.h> | |
12 #include <stdio.h> | |
13 #include <stdlib.h> | |
14 #include "parse.h" | |
15 #include "resp_ident.h" | |
16 | |
17 extern char *get_single_header(); | |
18 | |
19 sip_resp_extract_ident(msg, id) | |
20 struct sip_pkt_rx *msg; | |
21 struct sip_resp_ident *id; | |
22 { | |
23 char *hval, *cp; | |
24 int dup_flag = 0; | |
25 | |
26 hval = get_single_header(msg, "Call-ID", "i", &dup_flag); | |
27 if (!hval || dup_flag) { | |
28 id->error_field = "Call-ID"; | |
29 return(-1); | |
30 } | |
31 id->call_id = hval; | |
32 hval = get_single_header(msg, "CSeq", (char *) 0, &dup_flag); | |
33 if (!hval || dup_flag) { | |
34 bad_cseq: id->error_field = "CSeq"; | |
35 return(-1); | |
36 } | |
37 if (!isdigit(*hval)) | |
38 goto bad_cseq; | |
39 id->cseq_num = strtoul(hval, &cp, 10); | |
40 if (!isspace(*cp)) | |
41 goto bad_cseq; | |
42 while (isspace(*cp)) | |
43 cp++; | |
44 if (!isupper(*cp)) | |
45 goto bad_cseq; | |
46 id->cseq_method = cp; | |
47 while (isalnum(*cp)) | |
48 cp++; | |
49 if (*cp) | |
50 goto bad_cseq; | |
51 return(0); | |
52 } |