[asterisk-commits] file: branch group/pimp_my_sip r389535 - /team/group/pimp_my_sip/res/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed May 22 16:45:32 CDT 2013
Author: file
Date: Wed May 22 16:45:28 2013
New Revision: 389535
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=389535
Log:
Remove limitation preventing different accept type handlers of the same event being registered individually.
This change causes res_sip_pubsub to only register an event type once with the pjsip event subscription core.
Further registrations simply cause the accept types to be added to the global Accept header. This all works
because all subscriptions flow through res_sip_pubsub and it ultimately delegates to the implementation.
Modified:
team/group/pimp_my_sip/res/res_sip_pubsub.c
Modified: team/group/pimp_my_sip/res/res_sip_pubsub.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/res/res_sip_pubsub.c?view=diff&rev=389535&r1=389534&r2=389535
==============================================================================
--- team/group/pimp_my_sip/res/res_sip_pubsub.c (original)
+++ team/group/pimp_my_sip/res/res_sip_pubsub.c Wed May 22 16:45:28 2013
@@ -340,7 +340,6 @@
int ast_sip_register_subscription_handler(struct ast_sip_subscription_handler *handler)
{
- pj_str_t event;
pj_str_t accept[AST_SIP_MAX_ACCEPT];
int i;
@@ -354,29 +353,31 @@
return -1;
}
- if (handler_exists_for_event_name(handler->event_name)) {
- ast_log(LOG_ERROR, "A subscription handler for event %s already exists. Not registering "
- "new subscription handler\n", handler->event_name);
- return -1;
- }
-
- pj_cstr(&event, handler->event_name);
for (i = 0; i < AST_SIP_MAX_ACCEPT && !ast_strlen_zero(handler->accept[i]); ++i) {
pj_cstr(&accept[i], handler->accept[i]);
}
- 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());
+ if (!handler_exists_for_event_name(handler->event_name)) {
+ pj_str_t event;
+
+ pj_cstr(&event, handler->event_name);
+
+ 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);
+ }
} else {
- pjsip_evsub_register_pkg(&sub_module, &event, DEFAULT_EXPIRES, i, accept);
+ pjsip_endpt_add_capability(ast_sip_get_pjsip_endpoint(), &sub_module, PJSIP_H_ACCEPT, NULL,
+ i, accept);
}
add_handler(handler);
return 0;
}
-
+
void ast_sip_unregister_subscription_handler(struct ast_sip_subscription_handler *handler)
{
struct ast_sip_subscription_handler *iter;
More information about the asterisk-commits
mailing list