summaryrefslogtreecommitdiff
path: root/res/res_pjsip_pubsub.c
AgeCommit message (Collapse)Author
2015-09-10res_pjsip_pubsub.c: Fix one byte buffer overrun error.Richard Mudgett
ast_sip_pubsub_register_body_generator() did not account for the null terminator set by sprintf() in the allocated output buffer. Change-Id: I388688a132e479bca6ad1c19275eae0070969ae2
2015-09-10res_pjsip_pubsub.c: Use ast_alloca() instead of alloca().Richard Mudgett
Change-Id: Ia396096b4fedc2874649ca11137612c3f55e83e3
2015-09-10res_pjsip_pubsub.c: Add missing error return in load_module().Richard Mudgett
Change-Id: I15debd0f717f16ee2f78e7f56151c3b3b97b72fc
2015-09-01res_pjsip_pubsub: re-re-fix persistent subscription storage.Mark Michelson
A recent change to res_pjsip_pubsub switched to using pjsip_msg_print as a means of writing an appropriate packet to persistent storage. While this partially solved the issue, it had its own problems. pjsip_msg_print will always add a Content-Length header to the message it prints. Frequent restarts of Asterisk can result in persistent subscriptions being written with five or more Content-Length headers. In addition, sometimes some apparent corruption of individual headers could be seen. This aims to fix the problem by not running a parsed message through an interpreter but rather by taking the raw message and saving it. The logic for what to save is going to be different depending on whether a SUBSCRIBE was received from the wire or if it was pulled from persistence. When receiving a packet from the wire, when using a streaming transport, the rdata->pkt_info.packet may contain multiple SIP messages or fragments. However, the rdata->msg_info.msg_buf will always contain the current SIP message to be processed. When pulling from persistence, though, the rdata->msg_info.msg_buf will be NULL since no transport actually handled the packet. However, since we know that we will always ever pull one SIP message from persistence, we are free to save directly from rdata->pkt_info.packet instead. ASTERISK-25365 #close Reported by Mark Michelson Change-Id: I33153b10d0b4dc8e3801aaaee2f48173b867855b
2015-08-24res_pjsip_pubsub: On recreated notify fail deleted sub_tree is referencedJoshua Colp
When recreating a subscription it is possible for a freed sub_tree to be referenced when the initial NOTIFY fails to be created. Change-Id: I681c215309aad01b21d611c2de47b3b0a6022788
2015-08-06res_pjsip_pubsub: More accurately persist packet.Mark Michelson
The pjsip_rx_data structure has a pkt_info.packet field on it that is the packet that was read from the transport. For datagram transports, the packet read from the transport will correspond to the SIP message that arrived. For streamed transports, however, it is possible to read multiple SIP messages in one packet. In a recent case, Asterisk crashed on a system where TCP was being used. This is because at some point, a read from the TCP socket resulted in a 200 OK response as well as an incoming SUBSCRIBE request being stored in rdata->pkt_info.packet. When the SUBSCRIBE was processed, the combination 200 OK and SUBSCRIBE was saved in persistent storage. Later, a restart of Asterisk resulted in the crash because the persistent subscription recreation code ended up building the 200 OK response instead of a SUBSCRIBE request, and we attempted to access request-specific data. The fix here is to use the pjsip_msg_print() function in order to persist SUBSCRIBE requests. This way, rather than using the raw socket data, we use the parsed SIP message that PJSIP has given us. If we receive multiple SIP messages from a single read, we will be sure only to save off the relevant SIP message. There also is a safeguard put in place to make sure that if we do end up reconstructing a SIP response, it will not cause a crash. ASTERISK-25306 #close Reported by Mark Michelson Change-Id: I4bf16f7b76a2541d10b55de82bcd14c6e542afb2
2015-07-06PJSIP XML, XPIDF: Fix buffer size overwrite memory corruption error.Richard Mudgett
When res_pjsip body generator modules were generating XML or XPIDF response bodies, there was a chance that the generated body would be the exact size of the supplied buffer. Adding the nul string terminator would then write beyond the end of the buffer and potentially corrupt memory. * Fix MALLOC_DEBUG high fence violations caused by adding a nul string terminator on the end of a buffer for XML or XPIDF response bodies. * Made calls to pj_xml_print() safer if the XML prolog is requested. Due to a bug in pjproject, the return value could be -1 _or_ AST_PJSIP_XML_PROLOG_LEN if the supplied buffer is not large enough. * Updated the doxygen comment of AST_PJSIP_XML_PROLOG_LEN to describe the return value of pj_xml_print() when the supplied buffer is not large enough. ASTERISK-25168 Reported by: Carl Fortin Change-Id: Id70e1d373a6a2b2bd9e678b5cbc5e55b308981de
2015-05-22res/res_pjsip_pubsub: Note that 'dialog' is also a valid event type for RLSMatt Jordan
In addition to specifying lists of 'presence' and 'message-summary', users can also create lists of type 'dialog'. These should be treated in the same fashion as 'presence'. Change-Id: I583bb69cd9f88b0b29bf09ddaddeac4e84189f6e
2015-05-13AST_MODULE_INFO: Format corrections to the usages of AST_MODULE_INFO macro.Rodrigo Ramírez Norambuena
Change-Id: Icf88f9f861c6b2a16e5f626ff25795218a6f2723
2015-05-07res_pjsip_exten_state: Fix race condition between sending NOTIFY and terminationJoshua Colp
The res_pjsip_exten_state module currently has a race condition between processing the extension state callback from the PBX core and processing the subscription shutdown callback from res_pjsip_pubsub. There is currently no synchronization between the two. This can present a problem as while the SIP subscription will remain valid the tree it points to may not. This is in particular a problem as a task to send a NOTIFY may get queued which will try to use the tree that may no longer be valid. This change does the following to fix this problem: 1. All access to the subscription tree is done within the task that sends the NOTIFY to ensure that no other thread is modifying or destroying the tree. This task executes on the serializer for the subscriptions. 2. A reference to the subscription serializer is kept to ensure it remains valid for the lifetime of the extension state subscription. 3. The NOTIFY task has been changed so it will no longer attempt to send a NOTIFY if the subscription has already been terminated. ASTERISK-25057 #close Reported by: Matt Jordan Change-Id: I0b3cd2fac5be8d9b3dc5e693aaa79846eeaf5643
2015-04-22Merge "res_pjsip_pubsub: Set the endpoint on SUBSCRIBE dialogs."Joshua Colp
2015-04-21res_pjsip_pubsub: Set the endpoint on SUBSCRIBE dialogs.Mark Michelson
When SUBSCRIBE dialogs were established, we never associated the endpoint that created the subscription with the dialog we end up creating. In most cases, this ended up not causing any problems. The actual bug that was observed was that when a device that was behind NAT established a subscription with Asterisk, Asterisk would end up sending in-dialog NOTIFY requests to the device's private IP addres instead of the public address of the NAT router. When Asterisk receives the initial SUBSCRIBE from the device, res_pjsip_nat rewrites the contact to the public address on which the SUBSCRIBE was received. This allows for the dialog to have its target address set to the proper public address. Asterisk then would send a 200 OK response to the SUBSCRIBE, then a NOTIFY with the initial subscription state. The device would then send a 200 OK response to Asterisk's NOTIFY. Here's where things went wrong. When the 200 OK arrived, res_pjsip_nat did not rewrite the address in the Contact header. Then, when the PJSIP dialog layer processed the 200 OK, PJSIP would perform a comparison between the IP address in the Contact header and its saved target address for the dialog. Since they differed, PJSIP would update the target dialog address to be the address in the Contact header. From this point, if Asterisk needed to send a NOTIFY to the device, the result was that the NOTIFY would be sent to the private address that the device placed in the Contact header. The reason why res_pjsip_nat did not rewrite the address when it received the 200 OK response was that it could not associate the incoming response with a configured endpoint. This is because on a response, the only way to associate the response to an endpoint is by finding the dialog that the response is associated with and then finding the endpoint that is associated with that dialog. We do not perform endpoint lookups on responses. res_pjsip_pubsub skipped the step of associating the endpoint with the dialog we created, so res_pjsip_nat could not find the associated endpoint and therefore couldn't rewrite the contact. This commit message is like 50x longer than the actual fix. ASTERISK 24981 #close Reported by Mark Michelson Change-Id: I2b963c58c063bae293e038406f7d044a8a5377cd
2015-04-16res_pjsip_pubsub: On notify fail deleted sub_tree is then referencedScott Griepentrog
This change makes the send_notify of the sub_tree not happen when the sub_tree has been deleted due to the notify call failing, which avoids a crash. ASTERISK-24970 #close Change-Id: I1f20ffc08b192f59c457293b218025a693992cbf
2015-03-26res_pjsip: Enable unload of all modules at shutdown.Corey Farrell
* Move most of res_pjsip:module_unload to unload_pjsip to resolve crashes caused by running PJSIP functions from non-PJSIP threads. * Remove call to pjsip_endpt_destroy(ast_pjsip_endpoint), it was causing crashes in some cases. In theory pj_shutdown() should take care of this. * Mark res_pjsip_keepalive and res_pjsip_session as allowed to unload at shutdown. * Resolve leaked config global in res_pjsip_notify. * Unregister pubsub pjsip service module. * Implement cleanup for res_pjsip_session. ASTERISK-24731 #close Reported by: Corey Farrell Review: https://reviewboard.asterisk.org/r/4498/ ........ Merged revisions 433469 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433470 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-11HTTP: Stop accepting requests on final system shutdown.Richard Mudgett
There are three CLI commands to stop and restart Asterisk each. 1) core stop/restart now - Hangup all calls and stop or restart Asterisk. New channels are prevented while the shutdown request is pending. 2) core stop/restart gracefully - Stop or restart Asterisk when there are no calls remaining in the system. New channels are prevented while the shutdown request is pending. 3) core stop/restart when convenient - Stop or restart Asterisk when there are no calls in the system. New calls are not prevented while the shutdown request is pending. ARI has made stopping/restarting Asterisk more problematic. While a shutdown request is pending it is desirable to continue to process ARI HTTP requests for current calls. To handle the current calls while a shutdown request is pending, a new committed to shutdown phase is needed so ARI applications can deal with the calls until the system is fully committed to shutdown. * Added a new shutdown committed phase so ARI applications can deal with calls until the final committed to shutdown phase is reached. * Made refuse new HTTP requests when the system has reached the final system shutdown phase. Starting anything while the system is actively releasing resources and unloading modules is not a good thing. * Split the bridging framework shutdown to not cleanup the global bridging containers when shutting down in a hurry. This is similar to how other modules prevent crashes on rapid system shutdown. * Moved ast_begin_shutdown(), ast_cancel_shutdown(), and ast_shutting_down(). You should not have to include channel.h just to access these system functions. ASTERISK-24752 #close Reported by: Matthew Jordan Review: https://reviewboard.asterisk.org/r/4399/ ........ Merged revisions 431692 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431694 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-23Investigate and fix memory leaks in AsteriskKevin Harwell
Fixed memory leaks that were found in Asterisk. ASTERISK-24693 #close Reported by: Kevin Harwell Review: https://reviewboard.asterisk.org/r/4347/ ........ Merged revisions 430999 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431010 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-12Revert -r430452 It needs to be redone for the next major AMI version change ↵Richard Mudgett
instead. ASTERISK-24049 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430509 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-09AMI: Remove no longer used parameter from astman_send_listack().Richard Mudgett
Follow-up issue to -r430435 from reviewboard review. ASTERISK-24049 Review: https://reviewboard.asterisk.org/r/4315/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430452 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-09AMI: Make AMI actions that generate event lists consistent.Richard Mudgett
* Made the following AMI actions use list API calls for consistency: Agents BridgeInfo BridgeList BridgeTechnologyList ConfbridgeLIst ConfbridgeLIstRooms CoreShowChannels DAHDIShowChannels DBGet DeviceStateList ExtensionStateList FAXSessions Hangup IAXpeerlist IAXpeers IAXregistry MeetmeList MeetmeListRooms MWIGet ParkedCalls Parkinglots PJSIPShowEndpoint PJSIPShowEndpoints PJSIPShowRegistrationsInbound PJSIPShowRegistrationsOutbound PJSIPShowResourceLists PJSIPShowSubscriptionsInbound PJSIPShowSubscriptionsOutbound PresenceStateList PRIShowSpans QueueStatus QueueSummary ShowDialPlan SIPpeers SIPpeerstatus SIPshowregistry SKINNYdevices SKINNYlines Status VoicemailUsersList * Incremented the AMI version to 2.7.0. * Changed astman_send_listack() to not use the listflag parameter and always set the value to "Start" so the start capitalization is consistent. i.e., The FAXSessions used "Start" while the rest of the system used "start". The corresponding complete event always used "Complete". * Fixed ami_show_resource_lists() "PJSIPShowResourceLists" to output the AMI ActionID for all of its list events. * Fixed off-nominal AMI protocol error in manager_bridge_info(), manager_parking_status_single_lot(), and manager_parking_status_all_lots(). Use of astman_send_error() after responding to the original AMI action request violates the action response pattern by sending two responses. * Fixed minor protocol error in action_getconfig() when no requested categories are found. Each line needs to be formatted as "Header: text". * Fixed off-nominal memory leak in manager_build_parked_call_string(). * Eliminated unnecessary use of RAII_VAR() in ami_subscription_detail(). ASTERISK-24049 #close Reported by: Jonathan Rose Review: https://reviewboard.asterisk.org/r/4315/ ........ Merged revisions 430434 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430435 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-08res_pjsip_pubsub: Fix persistent subscriptions not surviving graceful shutdownGeorge Joseph
If you do a 'core (shutdown|restart) graceful' persistent subscriptions won't survive. If you do a 'core (shutdown|restart) now' or asterisk terminates for some reason, they do. Here's why... When asterisk shuts down gracefully, it sends a 'NOTIFY/terminated' to subscribers for each subscription. This not only tells the subscribers that the dialog/state machine is done, it also frees the last reference to the subscription tree which causes the persistent subscription to get deleted from astdb. When asterisk restarts, nothing's left. Just preventing the delete from astdb doesn't work because we already told the subscriber to terminate the dialog so we can't restart it even if it was still in astdb. Everything works OK if asterisk terminates unexpectedly because we never send the 'terminated' message so on restart, the subscription is still in astdb and the subscriber is none the wiser. This patch suppresses the sending of 'NOTIFY/terminated' on shutdown for persistent connections. Tested-by: George Joseph Review: https://reviewboard.asterisk.org/r/4318/ ........ Merged revisions 430397 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430398 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-12-15Activate persistent subscriptions when they are recreated.Mark Michelson
Prior to this change, recreating persistent subscriptions would create the subscription but would not activate it. This led to subscriptions being listed in the "NULL" state by diagnostics and not sending NOTIFYs when expected. Review: https://reviewboard.asterisk.org/r/4261 ........ Merged revisions 429571 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@429573 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-12-01main/stasis: Allow subscriptions to use a threadpool for message deliveryMatthew Jordan
Prior to this patch, all Stasis subscriptions would receive a dedicated thread for servicing published messages. In contrast, prior to r400178 (see review https://reviewboard.asterisk.org/r/2881/), the subscriptions shared a thread pool. It was discovered during some initial work on Stasis that, for a low subscription count with high message throughput, the threadpool was not as performant as simply having a dedicated thread per subscriber. For situations where a subscriber receives a substantial number of messages and is always present, the model of having a dedicated thread per subscriber makes sense. While we still have plenty of subscriptions that would follow this model, e.g., AMI, CDRs, CEL, etc., there are plenty that also fall into the following two categories: * Large number of subscriptions, specifically those tied to endpoints/peers. * Low number of messages. Some subscriptions exist specifically to coordinate a single message - the subscription is created, a message is published, the delivery is synchronized, and the subscription is destroyed. In both of the latter two cases, creating a dedicated thread is wasteful (and in the case of a large number of peers/endpoints, harmful). In those cases, having shared delivery threads is far more performant. This patch adds the ability of a subscriber to Stasis to choose whether or not their messages are dispatched on a dedicated thread or on a threadpool. The threadpool is configurable through stasis.conf. Review: https://reviewboard.asterisk.org/r/4193 ASTERISK-24533 #close Reported by: xrobau Tested by: xrobau ........ Merged revisions 428681 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 428687 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@428688 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-11-14Fix race condition where duplicated requests may be handled by multiple threads.Mark Michelson
This is the Asterisk 13 version of the patch. The main difference is in the pubsub code since it was completely refactored between Asterisk 12 and 13. Review: https://reviewboard.asterisk.org/r/4175 ........ Merged revisions 427841 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@427842 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-16PJSIP: Enforce module load dependenciesKinsey Moore
This enforces that res_pjsip, res_pjsip_session, and res_pjsip_pubsub have loaded properly before attempting to load any modules that depend on them since the module loader system is not currently capable of resolving module dependencies on its own. ASTERISK-24312 #close Reported by: Dafi Ni Review: https://reviewboard.asterisk.org/r/4062/ ........ Merged revisions 425690 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 425691 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@425700 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-07res/res_pjsip_pubsub: Fix typo in WARNING messageMatthew Jordan
........ Merged revisions 424713 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@424714 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-06res/res_pjsip_pubsub: Gracefully handle errors when re-creating subscriptionsMatthew Jordan
A subscription that has been persisted can - for various reasons - fail to be re-created on startup. This patch resolves a number of crashes that occurred when a subscription cannot be re-created on several off-nominal paths. #SIPit31 ASTERISK-24368 #close Reported by: Matt Jordan ........ Merged revisions 424601 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@424602 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-29Simplify UUID generation in several places.Richard Mudgett
Replace code using ast_uuid_generate() with simpler and faster code using ast_uuid_generate_str(). The new code avoids a malloc(), free(), and copy. ........ Merged revisions 424103 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 424105 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@424109 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-18Add subscription state test events.Mark Michelson
These are needed for a set of batched notification RLS tests that are about to be committed to the testsuite. Review: https://reviewboard.asterisk.org/r/3967 ........ Merged revisions 423462 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@423463 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-18res_pjsip_pubsub: Add some type safety when generating NOTIFY bodies.Mark Michelson
res_pjsip_pubsub has two separate checks that it makes when a SUBSCRIBE arrives. * It checks that there is a subscription handler for the Event * It checks that there are body generators for the types in the Accept header The problem is, there's nothing that ensures that these two things will actually mesh with each other. For instance, Asterisk will accept a subscription to MWI that accepts pidf+xml bodies. That doesn't make sense. With this commit, we add some type information to the mix. Subscription handlers state they generate data of type X, and body generators state that they consume data of type X. This way, Asterisk doesn't end up in some hilariously mismatched situation like the one in the previous paragraph. ASTERISK-24136 #close Reported by Mark Michelson Review: https://reviewboard.asterisk.org/r/3877 Review: https://reviewboard.asterisk.org/r/3878 ........ Merged revisions 423344 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 423348 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@423350 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-08Pre-allocate transmission data buffer for RLS NOTIFY requests.Mark Michelson
PJSIP, unless a constant is modified at compilation time, limits SIP requests to 4000 bytes. Full-state RLS notifications can easily exceed this limit with moderately small lists. This changeset allows for Asterisk to work around this size limit by performing its own allocation of the transmission data buffer. This way, Asterisk can allocate a buffer that exceeds the built-in maximum. We still impose our own limit of 64000 bytes, mainly because making allocations larger than that is a bit absurd. ASTERISK-24181 #close Reported by Mark Michelson Review: https://reviewboard.asterisk.org/r/3977 ........ Merged revisions 422851 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422852 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-08res_pjsip_pubsub: Check supported headers for eventlist when subscribing toJonathan Rose
resource list https://wiki.asterisk.org/wiki/display/AST/Resource+List+Subscription+Test+Plan According to the off-nominal plan, if evenlist support is not specified in a SUBSCRIBE's supported header(s), that subscription should be rejected with an error. ASTERISK-23871 Reported by: Mark Michelson Review: https://reviewboard.asterisk.org/r/3960/diff/#index_header ........ Merged revisions 422836 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422837 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-28Fix bug that did not allow for multiple batched RLS notifications to be sent.Mark Michelson
A misunderstanding of how the scheduler worked caused further batched notifications beyond the first not to get scheduled. Now we reset our scheduler ID to -1 after the batched notification is sent. This way, further notifications can be scheduled when they arise. ........ Merged revisions 422239 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422240 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-20Set the role for inbound subscriptions correctly.Mark Michelson
This was causing the AMI show_subscriptions test in the testsuite to fail since all subscriptions were being seen as subscribers instead of notifiers. ........ Merged revisions 421585 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@421586 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-18Improve call forwarding reporting, especially with regards to ARI.Matthew Jordan
This patch addresses a few issues: 1) The order of Dial events have been changed when performing a call forward. The order has now been altered to 1) Dial begins dialing channel A. 2) When A forwards the call to B, we issue the dial end event to channel A, indicating the dial is being canceled due to a forward to B. 3) When the call to channel B occurs, we then issue a new dial begin to channel B. 2) Call forwards are now reported on the calling channel, not the peer channel. 3) AMI DialEnd events have been altered to display the extension the call is being forwarded to when relevant. 4) You can now get the values of channel variables for channels that are not currently in the Stasis application. This brings the retrieval of channel variables more in line with the rest of channel read operations since they may be performed on channels not in Stasis. ASTERISK-24134 #close Reported by Matt Jordan ASTERISK-24138 #close Reported by Matt Jordan Patches: forward-shenanigans.diff uploaded by Matt Jordan (License #6283) Review: https://reviewboard.asterisk.org/r/3899 ........ Merged revisions 420794 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@421310 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-11Fix crashing unit tests with regards to RLS.Mark Michelson
The unit tests require a sorcery.conf file that has been set up to store resource lists in memory rather than retrieving from configuration. With a setup that is not conducive to running the tests, a fault in sorcery currently causes Asterisk to crash when attempting to run any of the tests. To get around the crash, this adds a function that verifies the current environment and marks the tests as "not run" if the setup is not correct. ........ Merged revisions 420779 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420780 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-11Fix crash encountered by the testsuite.Mark Michelson
Running testsuite tests locally produced no errors, but when run using the continuous integration framework, crashes occurred. The crashes occurred due to a refcounting error that had been fixed for a similar situation. ........ Merged revisions 420758 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420759 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-07Fix build in dev modeKinsey Moore
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420389 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-07Add support for RFC 4662 resource list subscriptions.Mark Michelson
This commit adds the ability for a user to configure a resource list in pjsip.conf. Subscribing to this list simultaneously subscribes the subscriber to all resources listed. This has the potential to reduce the amount of SIP traffic when loads of subscribers on a system attempt to subscribe to each others' states. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420384 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-07res_pjsip_publish_asterisk: Add support for exchanging device and mailbox ↵Joshua Colp
state using SIP. This module uses the inbound and outbound PUBLISH support to exchange device and mailbox state between Asterisk instances. Each instance is configured to publish to the other and requires no intermediary server. The functionality provided is similar to the XMPP and Corosync support. Review: https://reviewboard.asterisk.org/r/3780/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420315 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-25Add module support level to ast_module_info structure. Print it in CLI ↵Mark Michelson
"module show" . ASTERISK-23919 #close Reported by Malcolm Davenport Review: https://reviewboard.asterisk.org/r/3802 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419592 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-18astobj2: assert on invalid ref and backtrace cleanupScott Griepentrog
If a reference count goes negative, instead of just logging that fact, be more helpful with a backtrace and an assert that will DO_CRASH. This patch also removes the duplicate ao2_bt() function and cleans up extraneous usage of the ast_log_backtrace() call. Review: https://reviewboard.asterisk.org/r/3765/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@418963 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-30Reverse logic during subscription persistence recreation.Mark Michelson
In the abstraction effort, this bit of logic got messed up. We want to recreate the persistence if things go well, not if things fail. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417663 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-27res_pjsip: Add ActionID to events created as a result of PJSIP AMI actionsMatthew Jordan
A number of various PJSIP AMI actions were failing to parse out and place the ActionID into their responses. This patch updates the various PJSIP actions such that the passed in ActionID is emitted on any event list complete events, as well as any intermediate events created as a result of the action. #ASTERISK-23947 #close Reported by: Mark Michelson Review: https://reviewboard.asterisk.org/r/3675/ ........ Merged revisions 417460 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417461 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-25Abstract PJSIP-specific elements from the pubsub API.Mark Michelson
This helps to pave the way for RLS work that is to come. Since this is a self-contained change and subscription tests still pass, this work is being committed directly to trunk instead of a working branch. ASTERISK-23865 #close Review: https://reviewboard.asterisk.org/r/3628 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417233 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-12Fix build in devmode for GCC 4.10Kinsey Moore
........ Merged revisions 415980 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415982 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-12res_pjsip_pubsub: unauthenticated remote crash in PJSIP pub/sub frameworkKevin Harwell
A remotely exploitable crash vulnerability exists in the PJSIP channel driver's pub/sub framework. If an attempt is made to unsubscribe when not currently subscribed and the endpoint's "sub_min_expiry" is set to zero, Asterisk tries to create an expiration timer with zero seconds, which is not allowed, so an assertion raised. The fix was to reject a subscription that is attempting to unsubscribe when not being already subscribed. Asterisk now checks for this situation appropriately and responds with a 400 instead of crashing. AST-2014-005 ASTERISK-23489 #close ........ Merged revisions 415812 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415813 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-12res_pjsip_pubsub: Persist subscriptions in sorcery so they are recreated on ↵Joshua Colp
startup. This change makes res_pjsip_pubsub persist inbound subscriptions in sorcery. By default this uses the local astdb but it can also be configured to store within an outside database. When Asterisk is started these subscriptions are recreated if they have not expired. Notifications are sent to the devices which have subscribed and they are none the wiser that the system has restarted. Review: https://reviewboard.asterisk.org/r/3598/ ........ Merged revisions 415766 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415767 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-09Allow Asterisk to compile under GCC 4.10Kinsey Moore
This resolves a large number of compiler warnings from GCC 4.10 which cause the build to fail under dev mode. The vast majority are signed/unsigned mismatches in printf-style format strings. ........ Merged revisions 413586 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 413587 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 413588 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413589 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-10res_pjsip_pubsub: Set the body generation result to 0 for a valid pathKevin Harwell
The result of the "ast_sip_pubsub_generate_body_content" was not set/initialized. Consequently, the nominal path potentially returned an invalid value, thus not sending mwi notifications. ........ Merged revisions 412074 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412075 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-07PJSIP: Ensure test event has new stateKinsey Moore
The change that fixed the pubsub test event's use of a dangling pointer also changed when it was processed relative to the pjsip subscription state change processing. This change corrects the order of events while holding a reference to the pointer that was previously dangling. ........ Merged revisions 411883 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411884 65c4cc65-6c06-0410-ace0-fbb531ad65f3