Author: mmichelson Date: Fri Apr 3 16:59:48 2015 New Revision: 433970 URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=433970 Log: res_pjsip_messaging: Serialize outbound SIP MESSAGEs
Outbound SIP MESSAGEs had the potential to be sent out of order from how they were specified in a set of dialplan steps. This change creates a serializer for sending outbound MESSAGE requests on. This ensures that the MESSAGEs are sent by Asterisk in the same order that they were sent from the dialplan. ASTERISK-24937 #close Reported by Mark Michelson Review: https://reviewboard.asterisk.org/r/4579 ........ Merged revisions 433968 from http://svn.asterisk.org/svn/asterisk/branches/13 Modified: certified/branches/13.1/ (props changed) certified/branches/13.1/res/res_pjsip_messaging.c Propchange: certified/branches/13.1/ ------------------------------------------------------------------------------ Binary property 'branch-13-merged' - no diff available. Modified: certified/branches/13.1/res/res_pjsip_messaging.c URL: http://svnview.digium.com/svn/asterisk/certified/branches/13.1/res/res_pjsip_messaging.c?view=diff&rev=433970&r1=433969&r2=433970 ============================================================================== --- certified/branches/13.1/res/res_pjsip_messaging.c (original) +++ certified/branches/13.1/res/res_pjsip_messaging.c Fri Apr 3 16:59:48 2015 @@ -42,12 +42,15 @@ #include "asterisk/pbx.h" #include "asterisk/res_pjsip.h" #include "asterisk/res_pjsip_session.h" +#include "asterisk/taskprocessor.h" const pjsip_method pjsip_message_method = {PJSIP_OTHER_METHOD, {"MESSAGE", 7} }; #define MAX_HDR_SIZE 512 #define MAX_BODY_SIZE 1024 #define MAX_USER_SIZE 128 + +static struct ast_taskprocessor *message_serializer; /*! * \internal @@ -593,7 +596,7 @@ } if (!(mdata = msg_data_create(msg, to, from)) || - ast_sip_push_task(NULL, msg_send, mdata)) { + ast_sip_push_task(message_serializer, msg_send, mdata)) { ao2_ref(mdata, -1); return -1; } @@ -743,6 +746,13 @@ return AST_MODULE_LOAD_DECLINE; } + message_serializer = ast_sip_create_serializer(); + if (!message_serializer) { + ast_sip_unregister_service(&messaging_module); + ast_msg_tech_unregister(&msg_tech); + return AST_MODULE_LOAD_DECLINE; + } + ast_sip_session_register_supplement(&messaging_supplement); return AST_MODULE_LOAD_SUCCESS; } @@ -752,6 +762,7 @@ ast_sip_session_unregister_supplement(&messaging_supplement); ast_msg_tech_unregister(&msg_tech); ast_sip_unregister_service(&messaging_module); + ast_taskprocessor_unreference(message_serializer); return 0; } -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- svn-commits mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/svn-commits
