Hello Alex,

Thanks for the the quick reply. Please find the answers below

> If you just tried the old .so, try to compile the code again with the old 
> compiler (GCC 4.7.2).
It is freshly compiled.

> Try to add some SU_DEBUG_3 call to measure where invalid becomes < 0.
I've found out that the only call which is executed is the following one
    invalid = nta_tpn_by_url(home, orq->orq_tpn, &scheme, &port,
               (url_string_t *)sip->sip_request->rq_url);

> Try to initialize invalid with 0.
Tried that, got same results.

> If nothing helps, turn on all log levels and let me know.
I've attached the logs to the mail.

In order to give more clearity, i am sharing my findings till now.
It seems that the sip->sip_request pointer is over-written by the call to 
msg_header_add()

This is the call chain which produces differing results
 session_include_description()   --->   sip_header_insert(msg, sip, 
(sip_header_t *)pl) < 0) --->   msg_header_add()

Also please refer to the following attached files for more info.
  new_log                  - logs of new toolchain binaries
  old_logs                 - logs of old toolchain binaries
  msg_header_insert.txt    - changes made to function
  outgoing_create.txt      - changes made to function
  session_inclde_description.txt - changes made to function

Notable points : please note the change in address of sip->sip_request
#### session_include_description2 sip=90045c sip->msg_request=900798


Thanks and Regards,
Anand Mistry
Engineer | PES

[https://gallery.einfochips.com/Sign.png]
Product Engineering Services
Software | Embedded | Semiconductor
Frost & Sullivan Company of the Year 2013-2014


________________________________
From: Alexsander Petry <alexsanderpe...@gmail.com>
Sent: 06 January 2016 20:53
To: sofia-sip-devel@lists.sourceforge.net
Subject: Re: [Sofia-sip-devel] nta outgoing create: invalid URI

If you just tried the old .so, try to compile the code again with the old 
compiler (GCC 4.7.2).

By the sofia code (libsofia-sip-ua/nta/nta.c), "nta outgoing create: invalid 
URI" message appears when "invalid < 0", and invalid is assigned in three 
places:
invalid = tport_name_dup(home, orq->orq_tpn, tpn);
invalid = nta_tpn_by_url(home, orq->orq_tpn, &scheme, &port, route_url);
invalid = nta_tpn_by_url(home, orq->orq_tpn, &scheme, &port, (url_string_t 
*)sip->sip_request->rq_url);

Try to add some SU_DEBUG_3 call to measure where invalid becomes < 0.

And... invalid is not initialized! Look.. int invalid, resolved = 0, stateless 
= 0, user_via = agent->sa_user_via;
Try to initialize invalid with 0.

If nothing helps, turn on all log levels and let me know.


On Wed, Jan 6, 2016 at 10:32 AM, Anand Mistry 
<anand.mis...@einfochips.com<mailto:anand.mis...@einfochips.com>> wrote:


Hello,


I am working on this issue for a quite long time. Still I am unable to fix 
this. And I need some help.


Recently we updated our build system (compiler, automake, etc.). However we 
kept the same sofia-sip library version (1.12.10). It compiles well. But it 
gives the following error whenever we try to place a call.


    nta outgoing create: invalid URI


For testing, we are using the sofsip_cli client 
(http://sourceforge.net/projects/sofia-sip/files/sofsip-cli/). We checked the 
URI, it is correct. The URI we used is 
"<sip:toto@10.102.2.180<mailto:sip%3Atoto@10.102.2.180>>". It works if we use 
the older sofia-sip library ".so" files, with those compiled using previous 
compiler, but facing problem when using the newer ones.

Has anybody faced this problem before? What is the solution/workaround? Please 
help.
We also tried to use the latest version of sofia-sip library, but found the 
same results.

Additional information:
- Target system  = ARM based custom board
- Previous compiler = GCC (4.7.2)
- Current compiler = GCC (4.9.1)

Thanks and Regards,
Anand Mistry
Engineer | PES

[https://gallery.einfochips.com/Sign.png]
Product Engineering Services
Software | Embedded | Semiconductor
Frost & Sullivan Company of the Year 2013-2014
*************************************************************************************************************************************************************
 eInfochips Business Disclaimer: This e-mail message and all attachments 
transmitted with it are intended solely for the use of the addressee and may 
contain legally privileged and confidential information. If the reader of this 
message is not the intended recipient, or an employee or agent responsible for 
delivering this message to the intended recipient, you are hereby notified that 
any dissemination, distribution, copying, or other use of this message or its 
attachments is strictly prohibited. If you have received this message in error, 
please notify the sender immediately by replying to this message and please 
delete it from your computer. Any views expressed in this message are those of 
the individual sender unless otherwise stated. Company has taken enough 
precautions to prevent the spread of viruses. However the company accepts no 
liability for any damage caused by any virus transmitted by this email. 
*************************************************************************************************************************************************************

------------------------------------------------------------------------------

_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net<mailto:Sofia-sip-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel




--
Alexsander Petry
int msg_header_insert(msg_t *msg, msg_pub_t *pub, msg_header_t *h)
{
  msg_header_t **hh;

  printf("#### msg_header_insert IN\n");

  assert(msg);

  if (msg == NULL || h == NULL || h == MSG_HEADER_NONE ||
      h->sh_class == NULL)
    return -1;
  if (pub == NULL)
    pub = msg->m_object;

  hh = msg_hclass_offset(msg->m_class, pub, h->sh_class);

  printf("#### msg_header_insert pub=%x pub->msg_request=%x\n", pub, 
pub->msg_request);
  printf("#### msg_header_insert *hh=%x h=%x\n", *hh, h);

  return msg_header_add(msg, pub, hh, h);
}

Attachment: new_log
Description: new_log

Attachment: old_log
Description: old_log

nta_outgoing_t *outgoing_create(nta_agent_t *agent,
                                nta_response_f *callback,
                                nta_outgoing_magic_t *magic,
                                url_string_t const *route_url,
                                tp_name_t const *tpn,
                                msg_t *msg,
                                tag_type_t tag, tag_value_t value, ...)
{
  nta_outgoing_t *orq;
  sip_t *sip;
  su_home_t *home;
  char const *comp = NONE;
  char const *branch = NONE;
  char const *ack_branch = NONE;
  char const *tp_ident;
  int delay_sending = 0, sigcomp_zap = 0;
  int pass_100 = agent->sa_pass_100, use_timestamp = agent->sa_timestamp;
  enum nta_res_order_e res_order = agent->sa_res_order;
  struct sigcomp_compartment *cc = NULL;
  ta_list ta;
  char const *scheme = NULL;
  char const *port = NULL;
  int invalid = 0, resolved = 0, stateless = 0, user_via = agent->sa_user_via;
  int invite_100rel = agent->sa_invite_100rel;

  printf("#### outgoing_create1\n");

  tagi_t const *t;
  tport_t *override_tport = NULL;

  if (!agent->sa_tport_ip6)
    res_order = nta_res_ip4_only;
  else if (!agent->sa_tport_ip4)
    res_order = nta_res_ip6_only;

  if (!callback)
    callback = outgoing_default_cb;
  if (!route_url)
    route_url = (url_string_t *)agent->sa_default_proxy;

  sip = sip_object(msg);
  home = msg_home(msg);

  printf("#### outgoing_create1 pointers sip=%x , sip->sip_request=%x\n", sip, 
sip->sip_request);


  if (!sip->sip_request || sip_complete_message(msg) < 0) {
    SU_DEBUG_3(("nta: outgoing_create: incomplete request\n"));
    return NULL;
  }

  if (!route_url && !tpn && sip->sip_route &&
      sip->sip_route->r_url->url_params &&
      url_param(sip->sip_route->r_url->url_params, "lr", NULL, 0))
    route_url = (url_string_t *)sip->sip_route->r_url;

  if (!(orq = su_zalloc(agent->sa_home, sizeof(*orq))))
    return NULL;

  tp_ident = tpn ? tpn->tpn_ident : NULL;

  ta_start(ta, tag, value);

  /* tl_gets() is a bit too slow here... */
  for (t = ta_args(ta); t; t = tl_next(t)) {
    tag_type_t tt = t->t_tag;

    if (ntatag_stateless == tt)
      stateless = t->t_value != 0;
    else if (ntatag_delay_sending == tt)
      delay_sending = t->t_value != 0;
    else if (ntatag_branch_key == tt)
      branch = (void *)t->t_value;
    else if (ntatag_pass_100 == tt)
      pass_100 = t->t_value != 0;
    else if (ntatag_use_timestamp == tt)
      use_timestamp = t->t_value != 0;
    else if (ntatag_user_via == tt)
      user_via = t->t_value != 0;
    else if (ntatag_ack_branch == tt)
      ack_branch = (void *)t->t_value;
    else if (ntatag_default_proxy == tt)
      route_url = (void *)t->t_value;
    else if (tptag_ident == tt)
      tp_ident = (void *)t->t_value;
    else if (ntatag_comp == tt)
      comp = (char const *)t->t_value;
    else if (ntatag_sigcomp_close == tt)
      sigcomp_zap = t->t_value != 0;
    else if (tptag_compartment == tt)
      cc = (void *)t->t_value;
    else if (ntatag_tport == tt) {
      override_tport = (tport_t *)t->t_value;
    }
    else if (ntatag_rel100 == tt) {
      invite_100rel = t->t_value != 0;
    }
  }

  orq->orq_agent    = agent;
  orq->orq_callback = callback;
  orq->orq_magic    = magic;
  orq->orq_method   = sip->sip_request->rq_method;
  orq->orq_method_name = sip->sip_request->rq_method_name;
  orq->orq_cseq     = sip->sip_cseq;
  orq->orq_to       = sip->sip_to;
  orq->orq_from     = sip->sip_from;
  orq->orq_call_id  = sip->sip_call_id;
  orq->orq_tags     = tl_afilter(home, tport_tags, ta_args(ta));
  orq->orq_delayed  = delay_sending != 0;
  orq->orq_pass_100 = pass_100 != 0;
  orq->orq_sigcomp_zap = sigcomp_zap;
  orq->orq_sigcomp_new = comp != NONE && comp != NULL;
  orq->orq_res_order = res_order;
  orq->orq_timestamp = use_timestamp;
  orq->orq_delay     = UINT_MAX;
  orq->orq_stateless = stateless != 0;
  orq->orq_user_via  = user_via != 0 && sip->sip_via;
  orq->orq_100rel    = invite_100rel;

  if (cc)
    orq->orq_cc = nta_compartment_ref(cc);

  /* Add supported features */
  outgoing_features(agent, orq, msg, sip, ta_args(ta));

  ta_end(ta);

  /* select the tport to use for the outgoing message  */
  if (override_tport) {
    /* note: no ref taken to the tport as its only used once here */
    if (tport_is_secondary(override_tport)) {
      tpn = tport_name(override_tport);
      orq->orq_user_tport = 1;
    }
  }

  if (route_url && !orq->orq_user_tport) {
      printf("#### outgoing_create2\n");
    invalid = nta_tpn_by_url(home, orq->orq_tpn, &scheme, &port, route_url);

    if (override_tport) {       /* Use transport protocol name from transport  
*/
      if (strcmp(orq->orq_tpn->tpn_proto, "*") == 0)
        orq->orq_tpn->tpn_proto = tport_name(override_tport)->tpn_proto;
    }

    resolved = tport_name_is_resolved(orq->orq_tpn);
    orq->orq_url = url_hdup(home, sip->sip_request->rq_url);
    if (route_url != (url_string_t *)agent->sa_default_proxy)
      orq->orq_route = url_hdup(home, route_url->us_url);
  }
  else if (tpn) {
      printf("#### outgoing_create3\n");

    invalid = tport_name_dup(home, orq->orq_tpn, tpn);
#if HAVE_SOFIA_SRESOLV
    assert(tport_name_is_resolved(orq->orq_tpn));
#endif
    resolved = tport_name_is_resolved(orq->orq_tpn);
    orq->orq_url = url_hdup(home, sip->sip_request->rq_url);
    scheme = "sip";             /* XXX */
  }
  else {
      printf("#### outgoing_create4\n");

      printf("#### outgoing_create pointers sip=%x , sip->sip_request=%x\n", 
sip, sip->sip_request);

      invalid = nta_tpn_by_url(home, orq->orq_tpn, &scheme, &port,
                             (url_string_t *)sip->sip_request->rq_url);
    resolved = tport_name_is_resolved(orq->orq_tpn);
    orq->orq_url = url_hdup(home, sip->sip_request->rq_url);
    sip_fragment_clear(sip->sip_request->rq_common);
  }

  if (!override_tport)
    orq->orq_tpn->tpn_ident = tp_ident;
  else
    orq->orq_tpn->tpn_ident = tport_name(override_tport)->tpn_ident;

  if (comp == NULL)
    orq->orq_tpn->tpn_comp = comp;

  if (orq->orq_user_via && str0cmp(orq->orq_tpn->tpn_proto, "*") == 0) {
    char const *proto = sip_via_transport(sip->sip_via);
    if (proto) orq->orq_tpn->tpn_proto = proto;
  }

  if (branch && branch != NONE) {
    if (strncasecmp(branch, "branch=", 7) == 0)
      branch = su_strdup(home, branch);
    else
      branch = su_sprintf(home, "branch=%s", branch);
  }
  else if (orq->orq_user_via && sip->sip_via->v_branch)
    branch = su_sprintf(home, "branch=%s", sip->sip_via->v_branch);
  else if (stateless)
    branch = stateless_branch(agent, msg, sip, orq->orq_tpn);
  else
    branch = stateful_branch(home, agent);

  orq->orq_branch = branch;
  orq->orq_via_branch = branch;

  if (orq->orq_method == sip_method_ack) {
    /* Find the original INVITE which we are ACKing */
    if (ack_branch != NULL && ack_branch != NONE) {
      if (strncasecmp(ack_branch, "branch=", 7) == 0)
        orq->orq_branch = su_strdup(home, ack_branch);
      else
        orq->orq_branch = su_sprintf(home, "branch=%s", ack_branch);
    }
    else if (!stateless && agent->sa_is_a_uas) {
      /*
       * ACK redirect further 2XX messages to it.
       *
       * Use orq_branch from INVITE, but put a different branch in topmost Via.
       */
      nta_outgoing_t *invite = outgoing_find(agent, msg, sip, NULL);

      if (invite) {
        sip_t const *inv = sip_object(invite->orq_request);

        orq->orq_branch = su_strdup(home, invite->orq_branch);

        /* @RFC3261 section 13.2.2.4 -
         * The ACK MUST contain the same credentials as the INVITE.
         */
        if (!sip->sip_proxy_authorization && !sip->sip_authorization) {
          if (inv->sip_proxy_authorization)
            sip_add_dup(msg, sip, (void *)inv->sip_proxy_authorization);
          if (inv->sip_authorization)
            sip_add_dup(msg, sip, (void *)inv->sip_authorization);
        }
      }
      else {
        SU_DEBUG_1(("outgoing_create: ACK without INVITE\n"));
        assert(!"INVITE found for ACK");
      }
    }
  }

#if HAVE_SOFIA_SRESOLV
  if (!resolved)
    orq->orq_tpn->tpn_port = port;
  orq->orq_resolved = resolved;
#else
  orq->orq_resolved = resolved = 1;
#endif
  orq->orq_scheme = scheme;

  if (invalid < 0 || !orq->orq_branch || msg_serialize(msg, (void *)sip) < 0) {
    SU_DEBUG_3(("nta outgoing create: %s\n",
                invalid < 0 ? "invalid URI" :
                !orq->orq_branch ? "no branch" : "invalid message"));
    outgoing_free(orq);
    return NULL;
  }

  /* Now we are committed in sending the transaction */
  orq->orq_request = msg;
  agent->sa_stats->as_client_tr++;
  orq->orq_hash = NTA_HASH(sip->sip_call_id, sip->sip_cseq->cs_seq);

  if (orq->orq_user_tport)
    outgoing_send_via(orq, override_tport);
  else if (resolved)
    outgoing_prepare_send(orq);
#if HAVE_SOFIA_SRESOLV
  else
    outgoing_resolve(orq);
#endif

  if (stateless &&
      orq->orq_status >= 200 &&
      callback == outgoing_default_cb) {
    void *retval;

    if (orq->orq_status < 300)
      retval = (void *)-1;      /* NONE */
    else
      retval = NULL, orq->orq_request = NULL;

    outgoing_free(orq);

    return retval;
  }

  assert(orq->orq_queue);

  outgoing_insert(agent, orq);

  return orq;
}
static
int session_include_description(soa_session_t *soa,
                int session,
                msg_t *msg,
                sip_t *sip)
{
  su_home_t *home = msg_home(msg);

  sip_content_disposition_t *cd = NULL;
  sip_content_type_t *ct = NULL;
  sip_payload_t *pl = NULL;

  int retval;

  if (!soa)
    return 0;

  retval = session_make_description(home, soa, session, &cd, &ct, &pl);

  if (retval <= 0)
    return retval;

  if( ct == NULL)   printf("#### ct is null\n");
  if( cd == NULL)   printf("#### cd is null\n");
  if( pl == NULL)   printf("#### pl is null\n");

/*  if ((cd && sip_header_insert(msg, sip, (sip_header_t *)cd) < 0) ||
      sip_header_insert(msg, sip, (sip_header_t *)ct) < 0 ||
      sip_header_insert(msg, sip, (sip_header_t *)pl) < 0)
    return -1; */

  if (cd && sip_header_insert(msg, sip, (sip_header_t *)cd) < 0)     return -1;
  printf("#### session_include_description1 sip=%x sip->sip_request=%x\n", sip, 
sip->sip_request);

  if (sip_header_insert(msg, sip, (sip_header_t *)ct) < 0)    return -1;
  printf("#### session_include_description2 sip=%x sip->sip_request=%x\n", sip, 
sip->sip_request);

  if (sip_header_insert(msg, sip, (sip_header_t *)pl) < 0)    return -1;
  printf("#### session_include_description3 sip=%x sip->sip_request=%x\n", sip, 
sip->sip_request);

  return retval;
}
------------------------------------------------------------------------------
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to