WARNING: The online documentation has moved to https://docs.pjsip.org.

Visit the new documentation at https://docs.pjsip.org:

BLOG | DOCUMENTATION | GITHUB

Home --> Documentations --> PJMEDIA Reference

Samples: Print out error message

This file is pjsip-apps/src/samples/strerror.c

1/*
2 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
3 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program 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
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
29#include <pjlib.h>
30#include <pjlib-util.h>
31#include <pjsip.h>
32#include <pjmedia.h>
33#include <pjnath.h>
34#include <pjsip_simple.h>
35
36/*
37 * main()
38 */
39int main(int argc, char *argv[])
40{
42 pjmedia_endpt *med_ept;
43 pjsip_endpoint *sip_ept;
44 char errmsg[PJ_ERR_MSG_SIZE];
45 pj_status_t code;
46
47 if (argc != 2) {
48 puts("Usage: strerror ERRNUM");
49 return 1;
50 }
51
53
54 pj_init();
55 pj_caching_pool_init(&cp, NULL, 0);
58 pjmedia_endpt_create(&cp.factory, NULL, 0, &med_ept);
59 pjsip_endpt_create(&cp.factory, "localhost", &sip_ept);
60 pjsip_evsub_init_module(sip_ept);
61
62 code = atoi(argv[1]);
63 pj_strerror(code, errmsg, sizeof(errmsg));
64
65 printf("Status %d: %s\n", code, errmsg);
66
68 return 0;
69}
70
pj_status_t pjlib_util_init(void)
struct pjmedia_endpt pjmedia_endpt
Definition: pjmedia/types.h:186
pj_status_t pjmedia_endpt_create(pj_pool_factory *pf, pj_ioqueue_t *ioqueue, unsigned worker_cnt, pjmedia_endpt **p_endpt)
Definition: endpoint.h:127
pj_status_t pjnath_init(void)
pj_status_t pj_init(void)
int pj_status_t
void pj_shutdown(void)
void pj_caching_pool_init(pj_caching_pool *ch_pool, const pj_pool_factory_policy *policy, pj_size_t max_capacity)
void pj_log_set_level(int level)
#define PJ_ERR_MSG_SIZE
pj_str_t pj_strerror(pj_status_t statcode, char *buf, pj_size_t bufsize)
PJMEDIA main header file.
pj_pool_factory factory

 


PJMEDIA small footprint Open Source media stack
Copyright (C) 2006-2008 Teluu Inc.