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

SOFIAPUBFUN nta_outgoing_t* nta_outgoing_mcreate ( nta_agent_t agent,
nta_response_f callback,
nta_outgoing_magic_t magic,
url_string_t const *  route_url,
msg_t msg,
tag_type_t  tag,
tag_value_t  value,
  ... 
)

Create an outgoing client transaction.

Create an outgoing transaction object. The request message is passed to the transaction object, which sends the request to the network. 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:
agent NTA agent object
callback callback function (may be NULL)
magic application context pointer
route_url optional URL used to route transaction requests
msg request message
tag,value,... tagged parameter list
Returns:
Returns a pointer to newly created outgoing transaction object if successful, and NULL otherwise.
Note:
The caller is responsible for destroying the request message msg upon failure.

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_tcreate(), 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 6698 of file nta.c.

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

{
  nta_outgoing_t *orq = NULL;
  int cleanup = 0;

  if (msg == NONE)
    msg = nta_msg_create(agent, 0), cleanup = 1;

  if (msg && agent) {
    ta_list ta;
    ta_start(ta, tag, value);
    if (sip_add_tl(msg, sip_object(msg), ta_tags(ta)) >= 0)
      orq = outgoing_create(agent, callback, magic, route_url, NULL, msg,
                      ta_tags(ta));
    ta_end(ta);
  }

  if (!orq && cleanup)
    msg_destroy(msg);

  return orq;
}


Generated by  Doxygen 1.6.0   Back to index