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

SOFIAPUBFUN nta_outgoing_t* nta_outgoing_tcreate ( nta_leg_t leg,
nta_response_f callback,
nta_outgoing_magic_t magic,
url_string_t const *  route_url,
sip_method_t  method,
char const *  name,
url_string_t const *  request_uri,
tag_type_t  tag,
tag_value_t  value,
  ... 
)

Create an outgoing request and client transaction belonging to the leg.

Create a request message and pass the request message to an outgoing client transaction object. The request is sent to the route_url (if non-NULL), default proxy (if defined by NTATAG_DEFAULT_PROXY()), or to the address specified by request_uri. If no request_uri is specified, it is taken from route-set target or from the header.

When NTA receives response to the request, it invokes the callback function.

Parameters:
leg call leg object
callback callback function (may be NULL)
magic application context pointer
route_url optional URL used to route transaction requests
method method type
name method name
request_uri Request-URI
tag,value,... list of tagged arguments
Returns:
A pointer to a newly created outgoing transaction object if successful, and NULL otherwise.
Note:
If NTATAG_STATELESS(1) tag is given and the callback is NULL, the transaction object is marked as destroyed from the beginning. In that case, the function may return if the transaction is freed before returning from the function.
See also:
nta_outgoing_mcreate(), nta_outgoing_tcancel(), nta_outgoing_destroy().
NTATAG_STATELESS(), NTATAG_DELAY_SENDING(), NTATAG_BRANCH_KEY(), NTATAG_ACK_BRANCH(), NTATAG_DEFAULT_PROXY(), NTATAG_PASS_100(), NTATAG_USE_TIMESTAMP(), NTATAG_USER_VIA(), TPTAG_IDENT(), NTATAG_TPORT(). All SIP tags from <sofia-sip/sip_tag.h> can be used to manipulate the request message. SIP tags after SIPTAG_END() are ignored, however.

Definition at line 6610 of file nta.c.

References msg_destroy(), ta_end, ta_start, and ta_tags.

{
  nta_agent_t *agent;
  msg_t *msg;
  sip_t *sip;
  nta_outgoing_t *orq = NULL;
  ta_list ta;

  if (leg == NULL)
    return NULL;

  agent = leg->leg_agent;
  msg = nta_msg_create(agent, 0);
  sip = sip_object(msg);

  if (route_url == NULL)
    route_url = (url_string_t *)agent->sa_default_proxy;

  ta_start(ta, tag, value);

  if (sip_add_tl(msg, sip, ta_tags(ta)) < 0)
    ;
  else if (route_url == NULL && leg->leg_route &&
         leg->leg_loose_route &&
         !(route_url = (url_string_t *)leg->leg_route->r_url))
    ;
  else if (nta_msg_request_complete(msg, leg, method, name, request_uri) < 0)
    ;
  else
    orq = outgoing_create(agent, callback, magic, route_url, NULL, msg,
                    ta_tags(ta));

  ta_end(ta);

  if (!orq)
    msg_destroy(msg);

  return orq;
}


Generated by  Doxygen 1.6.0   Back to index