From 51f0bc5a46378786d98caf84df2cf31bb169e45b Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Sun, 19 Feb 2006 15:37:19 +0000 Subject: SIMPLE test with FWD, and added more info in UI git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@201 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip/src/pjsip-simple/evsub.c | 14 ++++++++++++++ pjsip/src/pjsip-simple/xpidf.c | 14 +++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) (limited to 'pjsip/src/pjsip-simple') diff --git a/pjsip/src/pjsip-simple/evsub.c b/pjsip/src/pjsip-simple/evsub.c index c1b8db83..be27db39 100644 --- a/pjsip/src/pjsip-simple/evsub.c +++ b/pjsip/src/pjsip-simple/evsub.c @@ -127,6 +127,8 @@ enum timer_id */ TIMER_TYPE_UAC_WAIT_NOTIFY, + /* Max nb of timer types. */ + TIMER_TYPE_MAX }; static const char *timer_names[] = @@ -136,6 +138,7 @@ static const char *timer_names[] = "UAS_TIMEOUT" "UAC_TERMINATE", "UAC_WAIT_NOTIFY", + "INVALID_TIMER" }; /* @@ -249,6 +252,10 @@ static pj_status_t mod_evsub_unload(void) PJ_DEF(pj_status_t) pjsip_evsub_init_module(pjsip_endpoint *endpt) { pj_status_t status; + pj_str_t method_tags[] = { + { "SUBSCRIBE", 9}, + { "NOTIFY", 6} + }; PJ_ASSERT_RETURN(endpt != NULL, PJ_EINVAL); PJ_ASSERT_RETURN(mod_evsub.mod.id == -1, PJ_EINVALIDOP); @@ -275,6 +282,11 @@ PJ_DEF(pj_status_t) pjsip_evsub_init_module(pjsip_endpoint *endpt) /* Register SIP-event specific headers parser: */ pjsip_evsub_init_parser(); + /* Register new methods SUBSCRIBE and NOTIFY in Allow-ed header */ + pjsip_endpt_add_capability(endpt, &mod_evsub.mod, PJSIP_H_ALLOW, NULL, + 2, method_tags); + + /* Done. */ return PJ_SUCCESS; on_error: @@ -436,6 +448,8 @@ static void set_timer( pjsip_evsub *sub, int timer_id, pj_time_val timeout; PJ_ASSERT_ON_FAIL(seconds > 0, return); + PJ_ASSERT_ON_FAIL(timer_id>TIMER_TYPE_NONE && timer_id */ if (pj_stricmp(&pres->name, &PRESENCE) != 0) return NULL; - if (pj_xml_find_attr(pres, &URI, NULL) == NULL) - return NULL; /* Validate */ node = pj_xml_find_node(pres, &PRESENTITY); if (node == NULL) return NULL; + if (pj_xml_find_attr(node, &URI, NULL) == NULL) + return NULL; /* Validate */ node = pj_xml_find_node(pres, &ATOM); if (node == NULL) return NULL; - if (pj_xml_find_attr(node, &ATOMID, NULL) == NULL) + if (pj_xml_find_attr(node, &ATOMID, NULL) == NULL && + pj_xml_find_attr(node, &ID, NULL) == NULL) + { return NULL; + } /* Address */ node = pj_xml_find_node(node, &ADDRESS); @@ -246,7 +250,7 @@ PJ_DEF(pj_bool_t) pjxpidf_get_status(pjxpidf_pres *pres) pj_assert(0); return PJ_FALSE; } - status = pj_xml_find_node(atom, &STATUS); + status = pj_xml_find_node(addr, &STATUS); if (!status) { pj_assert(0); return PJ_FALSE; @@ -257,7 +261,7 @@ PJ_DEF(pj_bool_t) pjxpidf_get_status(pjxpidf_pres *pres) return PJ_FALSE; } - return pj_stricmp(&attr->value, &OPEN) ? PJ_TRUE : PJ_FALSE; + return pj_stricmp(&attr->value, &OPEN)==0 ? PJ_TRUE : PJ_FALSE; } -- cgit v1.2.3