Re: BUG: pjsip_endpt_send_raw doesn't call pjsip_tp_send_callback

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
at first check, that pjsip_endpt_send_raw return PJ_SUCCESS.
If not, check the return value.
Because the function passed the cb along to send_msg, check the source code snippet taken from pjsip_transport.c
/* Send to transport */
    status = tr->send_msg(tr, tdata, addr, addr_len,
              tdata, &send_raw_callback);

    if (status != PJ_EPENDING) {
    /* callback will not be called, so destroy tdata now. */

So, when reading the docs (https://www.pjsip.org/pjsip/docs/html/group__PJSIP__ENDPT__STATELESS.htm#ga5ebe940444f71bdc00aa1f927a9a3677)

it's clearly stated: (check the Returns section)
This is a low-level function to send raw data to a destination.

See also pjsip_endpt_send_raw_to_uri().

Parameters
    endpt	The SIP endpoint instance.
    tp_type	Transport type.
    sel	Optional pointer to transport selector instance if application wants to use a specific transport instance rather then letting transport manager finds the suitable transport..
    raw_data	The data to be sent.
    data_len	The length of the data.
    addr	Destination address.
    addr_len	Length of destination address.
    token	Arbitrary token to be returned back to callback.
    cb	Optional callback to be called to notify caller about the completion status of the pending send operation.

Returns
    If the message has been sent successfully, this function will return PJ_SUCCESS and the callback will not be called. If message cannot be sent immediately, this function will return PJ_EPENDING, and application will be notified later about the completion via the callback. Any statuses other than PJ_SUCCESS or PJ_EPENDING indicates immediate failure, and in this case the callback will not be called. 


So, you have to check the return value.
If you get "PJ_SUCCESS", then the callback won't be called !

Rgds
Franz


________________________________________
Von: pjsip <pjsip-bounces@xxxxxxxxxxxxxxx> im Auftrag von Oleg Linkin <oleg.linkin@xxxxxxx>
Gesendet: Mittwoch, 22. Jänner 2020 15:14
An: pjsip@xxxxxxxxxxxxxxx
Betreff:  BUG: pjsip_endpt_send_raw doesn't call pjsip_tp_send_callback

Hello, developers

I try to use pjsip_endpt_send_raw with last callback parameter:
pjsip_tp_send_callback but this callback is never called.

```
void TransportPjSipImpl_send_callback(void *token, pjsip_tx_data *tdata,
pj_ssize_t bytes_sent)
{
        csDebug(0, "AAAAAA");
}
...
status = pjsip_endpt_send_raw(m_Endpoint, transportType, &selector, szSip,
length, addr, addrLen, reinterpret_cast<void*>(nCallId),
TransportPjSipImpl_send_callback);
```

Could you possibly help me with this situation?

Sincerely,
Oleg Linkin



_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org




[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux