diff options
author | Benny Prijono <bennylp@teluu.com> | 2010-11-10 12:13:46 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2010-11-10 12:13:46 +0000 |
commit | b0b535bf4c71c8b9c54ca6186a2bcd3b5f790fb5 (patch) | |
tree | 656196469d1d60f2fd142ce900577763258c8818 /pjsip/src | |
parent | 324711515d7bbd4f5470c54e081bfc0091c8848a (diff) |
Fixed #1156: New option to ignore bad NOTIFY presence message body (thanks Johan Lantz for the suggestion)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3363 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src')
-rw-r--r-- | pjsip/src/pjsip-simple/presence.c | 54 |
1 files changed, 35 insertions, 19 deletions
diff --git a/pjsip/src/pjsip-simple/presence.c b/pjsip/src/pjsip-simple/presence.c index b2f48262..59a6bc8b 100644 --- a/pjsip/src/pjsip-simple/presence.c +++ b/pjsip/src/pjsip-simple/presence.c @@ -35,6 +35,12 @@ #define THIS_FILE "presence.c" #define PRES_DEFAULT_EXPIRES PJSIP_PRES_DEFAULT_EXPIRES +#if PJSIP_PRES_BAD_CONTENT_RESPONSE < 200 || \ + PJSIP_PRES_BAD_CONTENT_RESPONSE > 699 || \ + PJSIP_PRES_BAD_CONTENT_RESPONSE/100 == 3 +# error Invalid PJSIP_PRES_BAD_CONTENT_RESPONSE value +#endif + /* * Presence module (mod-presence) */ @@ -759,25 +765,35 @@ static pj_status_t pres_process_rx_notify( pjsip_pres *pres, if (status != PJ_SUCCESS) { /* Unsupported or bad Content-Type */ - pjsip_accept_hdr *accept_hdr; - pjsip_warning_hdr *warn_hdr; - - *p_st_code = PJSIP_SC_NOT_ACCEPTABLE_HERE; - - /* Add Accept header */ - accept_hdr = pjsip_accept_hdr_create(rdata->tp_info.pool); - accept_hdr->values[accept_hdr->count++] = STR_APP_PIDF_XML; - accept_hdr->values[accept_hdr->count++] = STR_APP_XPIDF_XML; - pj_list_push_back(res_hdr, accept_hdr); - - /* Add Warning header */ - warn_hdr = pjsip_warning_hdr_create_from_status( - rdata->tp_info.pool, - pjsip_endpt_name(pres->dlg->endpt), - status); - pj_list_push_back(res_hdr, warn_hdr); - - return status; + if (PJSIP_PRES_BAD_CONTENT_RESPONSE >= 300) { + pjsip_accept_hdr *accept_hdr; + pjsip_warning_hdr *warn_hdr; + + *p_st_code = PJSIP_PRES_BAD_CONTENT_RESPONSE; + + /* Add Accept header */ + accept_hdr = pjsip_accept_hdr_create(rdata->tp_info.pool); + accept_hdr->values[accept_hdr->count++] = STR_APP_PIDF_XML; + accept_hdr->values[accept_hdr->count++] = STR_APP_XPIDF_XML; + pj_list_push_back(res_hdr, accept_hdr); + + /* Add Warning header */ + warn_hdr = pjsip_warning_hdr_create_from_status( + rdata->tp_info.pool, + pjsip_endpt_name(pres->dlg->endpt), + status); + pj_list_push_back(res_hdr, warn_hdr); + + return status; + } else { + pj_assert(PJSIP_PRES_BAD_CONTENT_RESPONSE/100 == 2); + PJ_PERROR(4,(THIS_FILE, status, + "Ignoring presence error due to " + "PJSIP_PRES_BAD_CONTENT_RESPONSE setting [%d]", + PJSIP_PRES_BAD_CONTENT_RESPONSE)); + *p_st_code = PJSIP_PRES_BAD_CONTENT_RESPONSE; + status = PJ_SUCCESS; + } } /* If application calls pres_get_status(), redirect the call to |