Logo Search packages:      
Sourcecode: sofia-sip version File versions  Download package

SOFIAPUBFUN char const* nta_leg_tag ( nta_leg_t leg,
char const *  tag 
)

Add local tag.

Add a local tag to the leg.

Parameters:
leg leg to be tagged
tag tag to be added (if NULL, a tag generated by NTA is added)
Returns:
Pointer to tag if successful, NULL otherwise.

Definition at line 3884 of file nta.c.

References sip_to_add_param(), and su_seterrno().

{
  if (!leg || !leg->leg_local)
    return su_seterrno(EINVAL), NULL;

  if (tag && strchr(tag, '='))
    tag = strchr(tag, '=') + 1;

  /* If there already is a tag, 
     return NULL if it does not match with new one */
  if (leg->leg_local->a_tag) {
    if (!tag && str0casecmp(tag, leg->leg_local->a_tag))
      return NULL;
    else
      return leg->leg_local->a_tag;
  }
  
  if (tag) {
    if (sip_to_tag(leg->leg_home, leg->leg_local, tag) < 0)
      return NULL;
    leg->leg_tagged = 1;
    return leg->leg_local->a_tag;
  }

  tag = nta_agent_newtag(leg->leg_home, "tag=%s", leg->leg_agent);

  if (!tag || sip_to_add_param(leg->leg_home, leg->leg_local, tag) < 0)
    return NULL;

  leg->leg_tagged = 1;

  return leg->leg_local->a_tag;
}


Generated by  Doxygen 1.6.0   Back to index