Skip to content

Commit

Permalink
Merge pull request #3 from traviscross/master
Browse files Browse the repository at this point in the history
Add zrtp-hash SDP media attribute to INVITE and 200 OK
  • Loading branch information
wernerd committed Apr 6, 2012
2 parents 49e737c + c0ab47f commit df2c040
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions zsrtp/transport_zrtp.c
Expand Up @@ -1270,6 +1270,28 @@ static pj_status_t transport_encode_sdp(pjmedia_transport *tp,
/* Do checking stuffs here.. */
}

{
/* Add zrtp-hash attribute to both INVITE and 200 OK. */
char *zrtp_hello_hash = zrtp_getHelloHash(zrtp->zrtpCtx);
if (zrtp_hello_hash && *zrtp_hello_hash) {
int zrtp_hello_hash_len = strlen(zrtp_hello_hash);
pj_str_t *zrtp_hash_str = PJ_POOL_ALLOC_T(sdp_pool, pj_str_t);
pjmedia_sdp_attr *zrtp_hash = NULL;

zrtp_hash_str->ptr = zrtp_hello_hash;
zrtp_hash_str->slen = zrtp_hello_hash_len;
zrtp_hash = pjmedia_sdp_attr_create(sdp_pool, "zrtp-hash", zrtp_hash_str);
if (zrtp_hash &&
pjmedia_sdp_attr_add(&local_sdp->media[media_index]->attr_count,
local_sdp->media[media_index]->attr,
zrtp_hash)) {
PJ_LOG(4, (THIS_FILE, "attribute added: a=zrtp-hash:%s", zrtp_hello_hash));
} else {
PJ_LOG(4, (THIS_FILE, "error adding attribute: a=zrtp-hash:%s", zrtp_hello_hash));
}
}
}

/* You may do anything to the local_sdp, e.g. adding new attributes, or
* even modifying the SDP if you want.
*/
Expand Down

0 comments on commit df2c040

Please sign in to comment.