access violation in pjsip_parse_uri()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks.

Which header is init_sip_parser() defined in? When should I call it ? straight after pj_caching_pool_init()?

What sequence of calls is required to create a sip_endpoint ? as per samples/strerr.c?

From: pjsip [mailto:pjsip-bounces@xxxxxxxxxxxxxxx] On Behalf Of Harald Radke
Sent: 06 January 2016 15:50
To: pjsip at lists.pjsip.org
Subject: Re: access violation in pjsip_parse_uri()

Hi Sam,

You need to call init_sip_parser() before doing the ...well, sip parsing (:

This is due to the fact that you didnt create a sip_endpoint, in which case this will be done in pjsip_endpt_create()

Regards,

Harry

Gesendet: Dienstag, 05. Januar 2016 um 18:22 Uhr
Von: "Garnham, Sam (FN) @ NSS - ASA" <Sam.Garnham at l-3com.com<mailto:Sam.Garnham at l-3com.com>>
An: "pjsip at lists.pjsip.org<mailto:pjsip at lists.pjsip.org>" <pjsip at lists.pjsip.org<mailto:pjsip at lists.pjsip.org>>
Betreff: [pjsip] access violation in pjsip_parse_uri()
Hello,

I have just started investigating PJSIP.
I am running the code below and getting an access violation in pjsip_parse_uri().
What am I doing wrong?

Sam.

---

#include <pjlib.h>
#include <pjsip.h>
#include <stdlib.h> // exit()

static pj_caching_pool cp;

void my_error_exit( const char * title, pj_status_t errcode )
{
      char errbuf[80];
      pjsip_strerror(errcode, errbuf, sizeof(errbuf));
      PJ_LOG(3,("main", "%s: %s", title, errbuf));
      exit(1);
}

void my_init_pjlib()
{
      pj_status_t status;

      /* Must init PJLIB first: */
      status = pj_init();
      if (status != PJ_SUCCESS) my_error_exit("pj_init() error", status);

      /* Then init PJLIB-UTIL: */
      status = pjlib_util_init();
      if (status != PJ_SUCCESS) my_error_exit("pjlib_util_init() error", status);

      /* Must create a pool factory before we can allocate any memory. */
      pj_caching_pool_init(&cp, &pj_pool_factory_default_policy, 0);
}

int main()
{
      char contact_param[] = "<sip:alice at client.atlanta.example.com;transport=tcp>";
      size_t contact_param_len = strlen(contact_param);
      pj_pool_t *pool;
      pjsip_uri *contact_uri;
      pjsip_sip_uri *contact_sip_uri;

      // Init PJLIB
      my_init_pjlib();

      // Create pool to allocate memory
      pool = pj_pool_create(&cp.factory, "mypool", 4000, 4000, NULL);
      if (!pool) my_error_exit("Unable to create pool", PJ_ENOMEM);

      contact_uri = pjsip_parse_uri(pool, contact_param, contact_param_len, 0);
      //TODO if (pjsip_uri_get_scheme(contact_uri)) case-insensitive matches "sip" or "sips"
      contact_sip_uri = (pjsip_sip_uri*) contact_uri;
      printf("transport: %s\n", contact_sip_uri->transport_param);
}

Please consider the environment before printing this email
________________________________

This communication is confidential to the intended recipient (s). If you are not that person you are not permitted to make use of the information and you are requested to notify the sender immediately of its receipt and then destroy the copy in your possession. Any views or opinions expressed are those of the originator and may not represent those of L-3 Communication ASA Ltd.

Sent from L-3 Communications ASA Ltd. Registered in England and Wales Company No. 1730717. Registered Office: 100 New Bridge Street, London, EC4V 6JA
_______________________________________________ Visit our blog: http://blog.pjsip.org pjsip mailing list pjsip at lists.pjsip.org<mailto:pjsip at lists.pjsip.org> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org


**************************************************************************
This communication is confidential to the intended recipient(s). If you are not that person 
you are not permitted to make use of the information and you are requested to notify the 
sender immediately of its receipt and then destroy the copy in your possession.  
Any views or opinions expressed are those of the originator and may not represent 
those of L-3 Communications ASA Ltd.

Sent from L-3 Communications ASA Ltd
Registered in England and Wales Company No. 1730717
Registered Office: 100 New Bridge Street, London, EC4V 6JA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20160107/a74da7ba/attachment.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux