segmentation fault

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

 



Hi!

Maybe your stack is not enough big for this:
char body[40000];

use this to create body on heap (or lower body's size on stack):
static char body[40000];


bye,
Attila

2010/6/28 peter hanshon <mido.1111 at hotmail.fr>
>
> Hello
> I want to send xml body in a message sip-invite but it return??segmentation fault
> this is the code
> case 'm':
> ? ?/* Make call! : */
> ? printf("(You currently have %d calls)\n",
> ? ? pjsua_call_get_count());
>
> ? ?uri = NULL;
> ? ?ui_input_url("Make call", buf, sizeof(buf), &result);
> ? ?if (result.nb_result != NO_NB) {
> if (result.nb_result == -1 || result.nb_result == 0) {
> ? ?puts("You can't do that with make call!");
> ? ?continue;
> } else {
> ? ?pjsua_buddy_info binfo;
> ? ?pjsua_buddy_get_info(result.nb_result-1, &binfo);
> ? ?tmp.ptr = buf;
> ? ?pj_strncpy(&tmp, &binfo.uri, sizeof(buf));
> }
> ? ?} else if (result.uri_result) {
> tmp = pj_str(result.uri_result);
> ? ?} else {
> tmp.slen = 0;
> ? ?}
> ?? ? ? ? ? ? ? ?char body[40000];
> ?? ? ? ? ? ? ? ?const pj_str_t SIP_INFO = pj_str("INVITE");
> pj_status_t status;
> ?? ? ? ? ? ? ? ?pjsua_msg_data msg_data;
> ? ? ? ?pjsua_msg_data_init(&msg_data);
> msg_data.content_type = pj_str("application/xml");
> ? ? ? ?pjsua_call_make_call( current_acc, &tmp, 0, NULL,&msg_data , NULL);
> ?? ? ? ? ? ? ? ?pj_ansi_snprintf(body, sizeof(body),
> ? ? ? ? "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"
> "<LaBri:user_profile xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"; \r\n"
> "xmlns:LaBri=\"http://www.labri.fr/\"; xsi:schemaLocation=\"http://www.labri.fr/ uaprofschema.xsd\">\r\n"
> "<!-- edited with XMLSpy v2009 (http://www.altova.com) by ait chellouche (prive) -->\r\n"
> "<user id=\" 1\">\r\n "
> , app_config.acc_cfg[current_acc].cred_info[app_config.acc_cfg[current_acc].cred_count].username
> );
> msg_data.msg_body = pj_str(body);
> ?? ? ? ? ? ? ? ?printf(stderr, "TOTO : \n %s \n",msg_data.msg_body.ptr);
> status = pjsua_call_send_request(current_call, &SIP_INFO,
> &msg_data);
> ? ?break;
> thank you
>
> ________________________________
> Hotmail : un service de messagerie gratuit, fiable et complet Profitez-en
> _______________________________________________
> 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
>



--
?dv,
Attila



[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