access violation in pjsip_parse_uri()

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

 



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 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/20160105/3bd6fea4/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