comparison libsip/uri_utils.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 * Some utility functions for working with SIP URIs.
3 */
4
5 #include <string.h>
6 #include <strings.h>
7
8 user_from_sip_uri(uri, outbuf, maxlen)
9 char *uri, *outbuf;
10 unsigned maxlen;
11 {
12 char *cp, *dp;
13 unsigned n;
14
15 if (strncasecmp(uri, "sip:", 4))
16 return(-1);
17 cp = uri + 4;
18 dp = outbuf;
19 n = 0;
20 for (;;) {
21 if (!*cp)
22 return(-1);
23 if (*cp == '@')
24 break;
25 if (n >= maxlen)
26 return(-2);
27 *dp++ = *cp++;
28 n++;
29 }
30 *dp = '\0';
31 return(0);
32 }