[pjsip] RTP encryption

anass kartit anassk at gmail.com
Fri Sep 28 10:57:32 EDT 2007


Hi Benny,
I have been experimenting with streamutil example with encrypting packets. I
decrypt packets on_rx_rtp as the following but I receive
Invalid_RTP_Version.


/* Simulate packet lost on RX direction */

if (udp->rx_drop_pct) {

if ((pj_rand() % 100) <= (int)udp->rx_drop_pct) {

PJ_LOG(5,(udp->base.name,

"RX RTP packet dropped because of pkt lost "

"simulation"));

goto read_next_packet;

}

}

encrypt_decrypt(udp->rtp_pkt,udp->rtp_pkt,key);

......and here

read_next_packet:

encrypt_decrypt(udp->rtp_pkt,udp->rtp_pkt,key);

bytes_read = sizeof(udp->rtp_pkt);

udp->rtp_addrlen = sizeof(pj_sockaddr_in);

and I encrypt the packets in transport_send_rtp as the following:

if (udp->tx_drop_pct) {

if ((pj_rand() % 100) <= (int)udp->tx_drop_pct) {

PJ_LOG(5,(udp->base.name,

"TX RTP packet dropped because of pkt lost "



"simulation"));

return PJ_SUCCESS;

}

}



id = udp->rtp_write_op_id;

pw = &udp->rtp_pending_write[id];

/* We need to copy packet to our buffer because when the

* operation is pending, caller might write something else

* to the original buffer.

*/



///crypto



encrypt_decrypt(pkt,cryptbuf,key);

///////////



pj_memcpy(pw->buffer, cryptbuf, size);

sent = size;



what is the problem ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20070928/e8221751/attachment.html>


More information about the pjsip mailing list