[asterisk-commits] kharwell: branch kharwell/pimp_sip_state r387999 - in /team/kharwell/pimp_sip...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed May 8 12:52:22 CDT 2013
Author: kharwell
Date: Wed May 8 12:52:20 2013
New Revision: 387999
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=387999
Log:
initial progress on extension state - won't compile
Modified:
team/kharwell/pimp_sip_state/res/res_sip_exten_state.c
team/kharwell/pimp_sip_state/res/res_sip_providers/res_sip_pidf.c
team/kharwell/pimp_sip_state/res/res_sip_pubsub.c
Modified: team/kharwell/pimp_sip_state/res/res_sip_exten_state.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_state/res/res_sip_exten_state.c?view=diff&rev=387999&r1=387998&r2=387999
==============================================================================
--- team/kharwell/pimp_sip_state/res/res_sip_exten_state.c (original)
+++ team/kharwell/pimp_sip_state/res/res_sip_exten_state.c Wed May 8 12:52:20 2013
@@ -194,32 +194,32 @@
enum ast_sip_subscription_role role, pjsip_rx_data *rdata)
{
struct ast_sip_subscription_handler *handler;
- struct state_sub *sub;
-
- if (!(sub = ao2_alloc(sizeof(*sub), state_sub_destructor))) {
+ struct state_sub *ssub;
+
+ if (!(ssub = ao2_alloc(sizeof(*ssub), state_sub_destructor))) {
return NULL;
}
if (!(handler = sub_handler_by_req(rdata))) {
ast_log(LOG_WARNING, "Handler not found for subscription event\n");
- ao2_cleanup(sub);
- return NULL;
- }
-
- if (!(sub->provider = provider_by_req(rdata))) {
+ ao2_cleanup(ssub);
+ return NULL;
+ }
+
+ if (!(ssub->provider = provider_by_req(rdata))) {
ast_log(LOG_WARNING, "Unable to locate subscription handler provider\n");
- ao2_cleanup(sub);
- return NULL;
- }
-
- if (!(sub->sip_sub = ast_sip_create_subscription(handler, role, endpoint, rdata))) {
+ ao2_cleanup(ssub);
+ return NULL;
+ }
+
+ if (!(ssub->sip_sub = ast_sip_create_subscription(handler, role, endpoint, rdata))) {
ast_log(LOG_WARNING, "Unable to create SIP subscription for endpoint %s\n",
ast_sorcery_object_get_id(endpoint));
- ao2_cleanup(sub);
- return NULL;
- }
-
- return sub;
+ ao2_cleanup(ssub);
+ return NULL;
+ }
+
+ return ssub;
}
/*!
@@ -428,8 +428,8 @@
ssub->context = endpoint->context;
ast_copy_pj_str(ssub->exten, &sip_uri->user, sizeof(ssub->exten));
- if (ast_extension_state_add(ssub->context, ssub->exten, state_changed, ssub)) {
- ast_log(LOG_WARNING, "Unable to subscribe extension %s updates\n",
+ if (ast_extension_state_add(ssub->context, ssub->exten, state_changed, ssub) < 0) {
+ ast_log(LOG_WARNING, "Unable to subscribe extension %s\n",
ssub->exten);
ao2_cleanup(ssub);
return NULL;
@@ -626,7 +626,7 @@
struct ast_sip_subscription_handler *handler = obj;
int *count = arg;
- if (ast_sip_register_subscription_handler(obj)) {
+ if (ast_sip_register_subscription_handler(handler)) {
ast_log(LOG_WARNING, "Unable to register subscription handler %s",
handler->event_name);
} else {
Modified: team/kharwell/pimp_sip_state/res/res_sip_providers/res_sip_pidf.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_state/res/res_sip_providers/res_sip_pidf.c?view=diff&rev=387999&r1=387998&r2=387999
==============================================================================
--- team/kharwell/pimp_sip_state/res/res_sip_providers/res_sip_pidf.c (original)
+++ team/kharwell/pimp_sip_state/res/res_sip_providers/res_sip_pidf.c Wed May 8 12:52:20 2013
@@ -77,7 +77,11 @@
case AST_EXTENSION_NOT_INUSE:
default:
/* Default setting */
+ *statestring = "terminated";
*local_state = NOTIFY_OPEN;
+ *pidfstate = "--";
+ *pidfnote ="Ready";
+
break;
}
}
@@ -135,7 +139,7 @@
static struct ast_exten_state_provider _pidf_xml_provider = {
.event_name = "presence",
- .accept = "pidf+xml",
+ .accept = "application/pidf+xml",
.create_body = pidf_xml_create_body
};
@@ -171,7 +175,7 @@
static struct ast_exten_state_provider _xml_pidf_provider = {
.event_name = "presence",
- .accept = "xml+pidf",
+ .accept = "application/xml+pidf",
.create_body = xml_pidf_create_body
};
@@ -181,7 +185,7 @@
static struct ast_exten_state_provider _cpim_pidf_xml_provider = {
.event_name = "presence",
- .accept = "cpim+pidf+xml",
+ .accept = "application/cpim+pidf+xml",
.create_body = xml_pidf_create_body
};
Modified: team/kharwell/pimp_sip_state/res/res_sip_pubsub.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_state/res/res_sip_pubsub.c?view=diff&rev=387999&r1=387998&r2=387999
==============================================================================
--- team/kharwell/pimp_sip_state/res/res_sip_pubsub.c (original)
+++ team/kharwell/pimp_sip_state/res/res_sip_pubsub.c Wed May 8 12:52:20 2013
@@ -149,16 +149,12 @@
if (role == AST_SIP_NOTIFIER) {
if (!strcmp(event, "message-summary")) {
pjsip_mwi_create_uas(dlg, &pubsub_cb, rdata, &evsub);
- } else if (!strcmp(event, "presence")) {
- pjsip_pres_create_uas(dlg, &pubsub_cb, rdata, &evsub);
} else {
pjsip_evsub_create_uas(dlg, &pubsub_cb, rdata, 0, &evsub);
}
} else {
if (!strcmp(event, "message-summary")) {
pjsip_mwi_create_uac(dlg, &pubsub_cb, 0, &evsub);
- } else if (!strcmp(event, "presence")) {
- pjsip_pres_create_uac(dlg, &pubsub_cb, 0, &evsub);
} else {
pj_str_t pj_event;
pj_cstr(&pj_event, event);
@@ -372,8 +368,6 @@
if (!strcmp(handler->event_name, "message-summary")) {
pjsip_mwi_init_module(ast_sip_get_pjsip_endpoint(), pjsip_evsub_instance());
- } else if (!strcmp(handler->event_name, "presence")) {
- pjsip_pres_init_module(ast_sip_get_pjsip_endpoint(), pjsip_evsub_instance());
} else {
pjsip_evsub_register_pkg(&sub_module, &event, DEFAULT_EXPIRES, i, accept);
}
More information about the asterisk-commits
mailing list