diff options
author | Benny Prijono <bennylp@teluu.com> | 2007-02-24 15:33:54 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2007-02-24 15:33:54 +0000 |
commit | 3692bfe973fa350b52445119e3270199b88dfa7e (patch) | |
tree | c191a2ceed128544943513b6bb6f4bcb08b27d8f /pjsip | |
parent | 5f6cdb084e8b59382b53945c4e42ab20b55fe1b2 (diff) |
Fixed ticket #136: Invalid presence entity ID when URI is specified in name-addr format
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1000 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_pres.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_pres.c b/pjsip/src/pjsua-lib/pjsua_pres.c index da6f291d..ae451b19 100644 --- a/pjsip/src/pjsua-lib/pjsua_pres.c +++ b/pjsip/src/pjsua-lib/pjsua_pres.c @@ -622,6 +622,9 @@ static pj_status_t send_publish(int acc_id, pj_bool_t active) /* Create PUBLISH request */ if (active) { + char *bpos; + pj_str_t entity; + status = pjsip_publishc_publish(acc->publish_sess, PJ_TRUE, &tdata); if (status != PJ_SUCCESS) { pjsua_perror(THIS_FILE, "Error creating PUBLISH request", status); @@ -633,9 +636,25 @@ static pj_status_t send_publish(int acc_id, pj_bool_t active) pres_status.info_cnt = 1; pres_status.info[0].basic_open = acc->online_status; + /* Be careful not to send PIDF with presence entity ID containing + * "<" character. + */ + if ((bpos=pj_strchr(&acc_cfg->id, '<')) != NULL) { + char *epos = pj_strchr(&acc_cfg->id, '>'); + if (epos - bpos < 2) { + pj_assert(!"Unexpected invalid URI"); + status = PJSIP_EINVALIDURI; + goto on_error; + } + entity.ptr = bpos+1; + entity.slen = epos - bpos - 1; + } else { + entity = acc_cfg->id; + } + /* Create and add PIDF message body */ status = pjsip_pres_create_pidf(tdata->pool, &pres_status, - &acc_cfg->id, &tdata->msg->body); + &entity, &tdata->msg->body); if (status != PJ_SUCCESS) { pjsua_perror(THIS_FILE, "Error creating PIDF for PUBLISH request", status); |