diff options
author | Benny Prijono <bennylp@teluu.com> | 2009-05-29 13:04:03 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2009-05-29 13:04:03 +0000 |
commit | 08640cc9411ca092e6456304bcce41f81b3bd3ce (patch) | |
tree | 6d1ad4e6304b1fb8d95b00858648cfbcd829a2ea /pjsip/src/pjsip/sip_transport.c | |
parent | ad8907b8ea9f5715c05b19b41ea7b85509591153 (diff) |
Integration of Sipit24 branch, many tickets involved:
- #793: AMR encoder should regard 'mode-set' param specified by remote decoder.
- #831: Automatically switch to TCP transport when sending large request
- #832: Support for outbound proxy setting without using Route header
- #849: Modify conference audio switch behavior in connecting ports.
- #850: Remove 'Require=replaces' param in 'Refer-To' header (in call transfer with replaces).
- #851: Support for regular nomination in ICE
- #852: --ip-addr support for IPv6 for media transport in pjsua
- #854: Adding SOFTWARE attribute in all outgoing requests may cause compatibility problem with older STUN server (thanks Alexei Kuznetsov for the report)
- #855: Bug in digit map frequencies for DTMF digits (thanks FCCH for the report)
- #856: Put back the ICE candidate priority values according to the default values in the draft-mmusic-ice
- #857: Support for ICE keep-alive with Binding indication
- #858: Do not authenticate STUN 438 response
- #859: AMR-WB format param in the SDP is not negotiated correctly.
- #867: Return error instead of asserting when PJSUA-LIB fails to open log file
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2724 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/pjsip/sip_transport.c')
-rw-r--r-- | pjsip/src/pjsip/sip_transport.c | 72 |
1 files changed, 40 insertions, 32 deletions
diff --git a/pjsip/src/pjsip/sip_transport.c b/pjsip/src/pjsip/sip_transport.c index 84b45a67..f34699be 100644 --- a/pjsip/src/pjsip/sip_transport.c +++ b/pjsip/src/pjsip/sip_transport.c @@ -434,6 +434,45 @@ PJ_DEF(void) pjsip_tx_data_invalidate_msg( pjsip_tx_data *tdata ) tdata->info = NULL; } +/* + * Print the SIP message to transmit data buffer's internal buffer. + */ +PJ_DEF(pj_status_t) pjsip_tx_data_encode(pjsip_tx_data *tdata) +{ + /* Allocate buffer if necessary. */ + if (tdata->buf.start == NULL) { + PJ_USE_EXCEPTION; + + PJ_TRY { + tdata->buf.start = (char*) + pj_pool_alloc(tdata->pool, PJSIP_MAX_PKT_LEN); + } + PJ_CATCH_ANY { + return PJ_ENOMEM; + } + PJ_END + + tdata->buf.cur = tdata->buf.start; + tdata->buf.end = tdata->buf.start + PJSIP_MAX_PKT_LEN; + } + + /* Do we need to reprint? */ + if (!pjsip_tx_data_is_valid(tdata)) { + pj_ssize_t size; + + size = pjsip_msg_print( tdata->msg, tdata->buf.start, + tdata->buf.end - tdata->buf.start); + if (size < 0) { + return PJSIP_EMSGTOOLONG; + } + pj_assert(size != 0); + tdata->buf.cur[size] = '\0'; + tdata->buf.cur += size; + } + + return PJ_SUCCESS; +} + PJ_DEF(pj_bool_t) pjsip_tx_data_is_valid( pjsip_tx_data *tdata ) { return tdata->buf.cur != tdata->buf.start; @@ -567,38 +606,7 @@ static void transport_send_callback(pjsip_transport *transport, */ static pj_status_t mod_on_tx_msg(pjsip_tx_data *tdata) { - /* Allocate buffer if necessary. */ - if (tdata->buf.start == NULL) { - PJ_USE_EXCEPTION; - - PJ_TRY { - tdata->buf.start = (char*) - pj_pool_alloc(tdata->pool, PJSIP_MAX_PKT_LEN); - } - PJ_CATCH_ANY { - return PJ_ENOMEM; - } - PJ_END - - tdata->buf.cur = tdata->buf.start; - tdata->buf.end = tdata->buf.start + PJSIP_MAX_PKT_LEN; - } - - /* Do we need to reprint? */ - if (!pjsip_tx_data_is_valid(tdata)) { - pj_ssize_t size; - - size = pjsip_msg_print( tdata->msg, tdata->buf.start, - tdata->buf.end - tdata->buf.start); - if (size < 0) { - return PJSIP_EMSGTOOLONG; - } - pj_assert(size != 0); - tdata->buf.cur[size] = '\0'; - tdata->buf.cur += size; - } - - return PJ_SUCCESS; + return pjsip_tx_data_encode(tdata); } /* |