2 The oSIP library implements the Session Initiation Protocol (SIP -rfc2543-)
3 Copyright (C) 2001 Aymeric MOIZARD jack@atosc.org
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #include <osip2/internal.h>
28 #include <osipparser2/osip_message.h>
31 main (int argc, char **argv)
36 osip_call_id_t *callid;
41 callids_file = fopen (argv[1], "r");
42 if (callids_file == NULL)
45 "Failed to open %s file.\nUsage: tcallid callids.txt\n",
50 a_callid = (char *) osip_malloc (200);
51 res = fgets (a_callid, 200, callids_file); /* lines are under 200 */
57 /* remove the last '\n' before parsing */
58 strncpy (a_callid + strlen (a_callid) - 1, "\0", 1);
60 if (0 != strncmp (a_callid, "#", 1))
62 /* allocate & init callid */
63 osip_call_id_init (&callid);
64 printf ("=================================================\n");
65 printf ("CALLID TO PARSE: |%s|\n", a_callid);
66 errcode = osip_call_id_parse (callid, a_callid);
69 if (osip_call_id_to_str (callid, &dest) != -1)
71 printf ("result: |%s|\n", dest);
76 printf ("Bad callid format: %s\n", a_callid);
77 osip_call_id_free (callid);
78 printf ("=================================================\n");
80 res = fgets (a_callid, 200, callids_file); /* lines are under 200 */