diff options
author | Benny Prijono <bennylp@teluu.com> | 2006-02-19 15:37:19 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2006-02-19 15:37:19 +0000 |
commit | 51f0bc5a46378786d98caf84df2cf31bb169e45b (patch) | |
tree | e17a65e4ebdf98d4f46857f51d26afe7f1fb2aa7 /pjsip/src/pjsip-simple | |
parent | c1fa8a21eda0357a8c25a63b634615f6785e4d48 (diff) |
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
Diffstat (limited to 'pjsip/src/pjsip-simple')
-rw-r--r-- | pjsip/src/pjsip-simple/evsub.c | 14 | ||||
-rw-r--r-- | pjsip/src/pjsip-simple/xpidf.c | 14 |
2 files changed, 23 insertions, 5 deletions
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<TIMER_TYPE_MAX, + return); timeout.sec = seconds; timeout.msec = 0; diff --git a/pjsip/src/pjsip-simple/xpidf.c b/pjsip/src/pjsip-simple/xpidf.c index 12024827..1bd719c4 100644 --- a/pjsip/src/pjsip-simple/xpidf.c +++ b/pjsip/src/pjsip-simple/xpidf.c @@ -29,6 +29,7 @@ static pj_str_t CLOSED = { "closed", 6 }; static pj_str_t URI = { "uri", 3 }; static pj_str_t ATOM = { "atom", 4 }; static pj_str_t ATOMID = { "atomid", 6 }; +static pj_str_t ID = { "id", 2 }; static pj_str_t ADDRESS = { "address", 7 }; static pj_str_t SUBSCRIBE_PARAM = { ";method=SUBSCRIBE", 17 }; static pj_str_t PRESENTITY = { "presentity", 10 }; @@ -126,20 +127,23 @@ PJ_DEF(pjxpidf_pres*) pjxpidf_parse(pj_pool_t *pool, char *text, pj_size_t len) /* Validate <presence> */ if (pj_stricmp(&pres->name, &PRESENCE) != 0) return NULL; - if (pj_xml_find_attr(pres, &URI, NULL) == NULL) - return NULL; /* Validate <presentity> */ node = pj_xml_find_node(pres, &PRESENTITY); if (node == NULL) return NULL; + if (pj_xml_find_attr(node, &URI, NULL) == NULL) + return NULL; /* Validate <atom> */ 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; } |