Did you forget to create the pool? Best regards, ?Benny On Tue, Oct 19, 2010 at 12:25 AM, Thomas Tavaris J (Tavaris) <tjthomas at lgsinnovations.com> wrote: > Hello, > > I am new to pjsip and unsuccessfully trying (for days) to use pjsip to parse > a sip message contained in a char* buffer. I have looked at sample source > code for assistance but I am still getting seg faults. (google'ing hasnt > provided much help either) > My program doesn't need to do anything elaborate, just parse the data for > the SIP message and print it to the screen. In my case I have simple pcap > file with a SIP registration contained within it and would like pjsip to > parse it. Thank you so much for your help. If you need any additional info > please let me know. > > -t > > When I run my program I get the following output: > ?12:01:15.705 os_core_unix.c? pjlib 1.8 for POSIX initialized > ?12:01:15.716 sip_endpoint.c? Creating endpoint instance... > ?12:01:15.717????????? pjlib? select() I/O Queue created (0x1ef4d730) > ?12:01:15.717 sip_endpoint.c? Module "mod-msg-print" registered > ?12:01:15.717 sip_transport.? Transport manager created. > ?12:01:15.717????????? sip.c? The message size is 529 > Segmentation fault > [root at localhost bin]# > > When I run my program through gdb I get the following: > (gdb) run register.pcap > Starting program: /root/upe/bin/gm register.pcap > [Thread debugging using libthread_db enabled] > ?12:03:17.587 os_core_unix.c? pjlib 1.8 for POSIX initialized > ?12:03:17.587 sip_endpoint.c? Creating endpoint instance... > ?12:03:17.587????????? pjlib? select() I/O Queue created (0x88c730) > ?12:03:17.587 sip_endpoint.c? Module "mod-msg-print" registered > ?12:03:17.587 sip_transport.? Transport manager created. > ?12:03:17.587????????? sip.c? The message size is 529 > > Program received signal SIGSEGV, Segmentation fault. > 0x00000000004b15a1 in pjsip_msg_create () > (gdb) > > my code is below: > > ??? status = pj_init(); > ??? if (status != PJ_SUCCESS) error_exit("Error in pj_init()", status); > > ??? status = pjlib_util_init(); > ??? if (status != PJ_SUCCESS) error_exit("Error in pjlib_util_init()", > status); > > ??? pj_caching_pool_init(&cp, &pj_pool_factory_default_policy,8000); > > ??? status = pjsip_endpt_create(&cp.factory, NULL, &g_endpt); > ??? if (status != PJ_SUCCESS) error_exit("Error in pjsip_endpt_create()", > status); > > ??? pj_list_init(&err); > ??? np::dout << "THe message size is: " << msgsize << " bytes." << endl; > ??? PJ_LOG(4,("sip.c", "The message size is %d",msgsize)); > > > ??? pjsip_msg *msg = pjsip_parse_msg(pool,(char*) buf, msgsize, &err); > > > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip at lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > >