diff options
author | Benny Prijono <bennylp@teluu.com> | 2008-04-15 10:37:19 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2008-04-15 10:37:19 +0000 |
commit | 8c50bcffcb9c15bd1575f88296534048b540ce7c (patch) | |
tree | e9885fffb590909c7b8c77c9b25993691b2918a8 /pjsip/src/pjsua-lib/pjsua_pres.c | |
parent | e91435553f8ef0d86f5ac01c298071dd3ea28bb2 (diff) |
Use the smart Contact header for TCP/TLS
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1931 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/pjsua-lib/pjsua_pres.c')
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_pres.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_pres.c b/pjsip/src/pjsua-lib/pjsua_pres.c index d41e1ddc..7a6d928c 100644 --- a/pjsip/src/pjsua-lib/pjsua_pres.c +++ b/pjsip/src/pjsua-lib/pjsua_pres.c @@ -552,12 +552,17 @@ static pj_bool_t pres_on_rx_request(pjsip_rx_data *rdata) acc_id)); /* Create suitable Contact header */ - status = pjsua_acc_create_uas_contact(rdata->tp_info.pool, &contact, - acc_id, rdata); - if (status != PJ_SUCCESS) { - pjsua_perror(THIS_FILE, "Unable to generate Contact header", status); - PJSUA_UNLOCK(); - return PJ_TRUE; + if (acc->contact.slen) { + contact = acc->contact; + } else { + status = pjsua_acc_create_uas_contact(rdata->tp_info.pool, &contact, + acc_id, rdata); + if (status != PJ_SUCCESS) { + pjsua_perror(THIS_FILE, "Unable to generate Contact header", + status); + PJSUA_UNLOCK(); + return PJ_TRUE; + } } /* Create UAS dialog: */ @@ -1123,12 +1128,19 @@ static void subscribe_buddy_presence(unsigned index) PJ_LOG(4,(THIS_FILE, "Using account %d for buddy %d subscription", acc_id, index)); - /* Generate suitable Contact header */ - status = pjsua_acc_create_uac_contact(pjsua_var.pool, &contact, - acc_id, &buddy->uri); - if (status != PJ_SUCCESS) { - pjsua_perror(THIS_FILE, "Unable to generate Contact header", status); - return; + /* Generate suitable Contact header unless one is already set in + * the account + */ + if (acc->contact.slen) { + contact = acc->contact; + } else { + status = pjsua_acc_create_uac_contact(pjsua_var.pool, &contact, + acc_id, &buddy->uri); + if (status != PJ_SUCCESS) { + pjsua_perror(THIS_FILE, "Unable to generate Contact header", + status); + return; + } } /* Create UAC dialog */ |