When the PJSIP pubsub framework was created, subscription handlers were required
to state what event they handled along with what body types they knew how to
generate. While this serves well when implementing a base RFC, it has problems
when trying to extend the body to support non-standard or proprietary body
elements. The code also was NOTIFY-specific, meaning that when the time comes
that we start writing code to send out PUBLISH requests with MWI or presence
bodies, we would likely find ourselves duplicating code that had previously been
written.
This changeset introduces the concept of body generators and body supplements. A
body generator is responsible for allocating a native structure for a given body
type, providing the primary body content, converting the native structure to a
string, and deallocating resources. A body supplement takes the primary body
content (the native structure, not a string) generated by the body generator and
adds nonstandard elements to the body. With these elements living in their own
module, it becomes easy to extend our support for body types and to re-use
resources when sending a PUBLISH request.
Body generators and body supplements register themselves with the pubsub core,
similar to how subscription and publish handlers had done. Now, subscription
handlers do not need to know what type of body content they generate, but they
still need to inform the pubsub core about what the default body type for a
given event package is. The pubsub core keeps track of what body generators and
body supplements have been registered. When a SUBSCRIBE arrives, the pubsub core
will check that there is a subscription handler for the event in the SUBSCRIBE,
then it will check that there is a body generator that can provide the content
specified in the Accept header(s).
Because of the nature of body generators and supplements, it means
res_pjsip_exten_state and res_pjsip_mwi have been completely gutted. They no
longer worry about body types, instead calling
ast_sip_pubsub_generate_body_content() when they need to generate a NOTIFY body.
Review: https://reviewboard.asterisk.org/r/3150
........
Merged revisions 407016 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407030 65c4cc65-6c06-0410-ace0-fbb531ad65f3
A couple of the scripts had errors that would not allow a full migration to
take place. The extensions table needed to make its 'id' column a primary
key in order to work with mysql. The other script ...add_endpoints... was
missing tables that it was trying to add columns to.
Added the primary key on id for extensions and added the tables in for the
missing pjsip configuration options. While it is not ideal to modify already
released scripts this was a case where it had to be done due to errors in
the script and lacking a better alternative.
Review: https://reviewboard.asterisk.org/r/3167/
........
Merged revisions 407019 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407029 65c4cc65-6c06-0410-ace0-fbb531ad65f3
When subscribing to MWI (res_pjsip_mwi) and the sip uri did not contain a name
(ex: sip:<ip address>) then the subscription would fail since it would be unable
to locate an associated aor. This patch makes it so that when a subscribe comes
with no aor name then it will subscribe to all aors on the located endpoint.
(closes issue ASTERISK-23072)
Reported by: Bob M
Review: https://reviewboard.asterisk.org/r/3164/
........
Merged revisions 407014 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407015 65c4cc65-6c06-0410-ace0-fbb531ad65f3
In NAT scenarios where a call is placed to a Grandstream phone,
res_pjsip will sometimes send the ACK to a 200 OK to the private
address of the device behind the NAT instead of the address of the NAT
device. This corrects that behavior by rewriting the address in the
Contact header in the incoming 200 OK and the dialog's target address
if necessary (since it has already been rewritten to the incorrect
private address).
(closes issue ASTERISK-23106)
Review: https://reviewboard.asterisk.org/r/3168/
Reported by: Matt Jordan
........
Merged revisions 407000 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407001 65c4cc65-6c06-0410-ace0-fbb531ad65f3
What seems to be happening is if a subscription has been terminated and the
subscription timeout/expires is less than the time it takes for all pending
transactions (currently on the subscription) to end then the subscription
timer will not have been canceled yet and sub will be null. Since the
subscription has already been canceled nothing needs to be done so a null
check in the asterisk code is sufficient in working around this problem.
(closes issue ASTERISK-23129)
Reported by: Dan Jenkins
........
Merged revisions 406847 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406848 65c4cc65-6c06-0410-ace0-fbb531ad65f3
On some systems the values for INFINITY and NAN are not defined thus causing
a build error on those systems. Added definitions for those if they had
not previously been defined.
(closes issue ASTERISK-23056)
Reported by: capouch
Patches:
inf-nan-patch.txt uploaded by capouch (license 6564)
........
Merged revisions 406788 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406789 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Currently, attempting to subscribe an application to a device state
that it has already subscribed to will generate a 500 error response.
This will now be treated as a subscription refresh even though ARI
subscriptions don't currently support lifetimes and will respond with
the normal response for a successful subscription (200 OK).
(closes issue ASTERISK-23143)
Reported by: Matt Jordan
........
Merged revisions 406775 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406778 65c4cc65-6c06-0410-ace0-fbb531ad65f3
* Fixed the test_cel_attended_transfer_bridges_link unit test to also
account for the local channel link being destroyed now that the bridges
are actually destroyed.
* Made CDR unit test use its own version of do_sleep() from the CEL unit
tests.
........
Merged revisions 406707 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406710 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Added a note in the changes file about the new 'StatusText' field that was
added to the 'ExtensionStatus' event.
(issue ASTERISK-23154)
Reported by: Jonathan Rose
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406696 65c4cc65-6c06-0410-ace0-fbb531ad65f3
When an 'ExtensionStatus' event was raised it included the status as a
numerical value, but did not include a text description of the status.
Added a 'StatusText' field to the event which is a string representation
of the extension status. Also added this to the 'Extension State' command
response.
(closes issue ASTERISK-23154)
Reported by: Jonathan Rose
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406647 65c4cc65-6c06-0410-ace0-fbb531ad65f3
The core may (depending on circumstances) request a single codec on outgoing
calls. Many channel drivers ignore or treat this as a suggestion while still
including configured codecs. The res_pjsip_session logic treated this as
an explicit request, leaving out other configured codecs.
This change makes res_pjsip_session behave like other channel driver and simply
adds the requested codec to the list.
(closes issue ASTERISK-23082)
Reported by: xrobau
Review: https://reviewboard.asterisk.org/r/3140/
........
Merged revisions 406489 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406490 65c4cc65-6c06-0410-ace0-fbb531ad65f3
The CEL data structures need to be protected during a configuration reload
and shutdown. Asterisk crashed during a shutdown because CEL events were
still in flight and the CEL data structures were already destroyed.
* Protected the cel_backends, cel_dialstatus_store, and cel_linkedids ao2
containers with a global ao2 object wrapper.
* Added NULL checks before use of the cel_backends, cel_dialstatus_store,
and cel_linkedids ao2 containers in case the CEL module is already
shutdown.
* Fixed overloading of the cel_linkedids held objects reference count.
During shutdown any held objects would be leaked.
* Fixed memory leak of cel_linkedids held objects if the LINKEDID_END is
not being tracked. The objects in the cel_linkedids container were not
removed if the LINKEDID_END event is not used.
* Added access protection to the cel_backends container during the CLI
"cel show status" command.
* Made cel_backends, cel_dialstatus_store, and cel_linkedids use the
standard ao2 callback templates for the hash and cmp functions.
* Eliminated unnecessary uses of RAII_VAR().
* Made ast_cel_engine_init() cleanup alocated resources on failure.
(closes issue AST-1253)
Reported by: Guenther Kelleter
Review: https://reviewboard.asterisk.org/r/3128/
........
Merged revisions 406417 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 406418 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 406465 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406466 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Occasionally, the manager module would get an "INTERNAL_OBJ: bad magic
number" error on a "core restart gracefully" command if an AMI connection
is established.
* Added ao2_global_obj protection to the sessions global container.
* Fixed the order of unreferencing a session object in session_destroy().
* Removed unnecessary container traversals of the white/black filters
during session_destructor().
(closes issue AST-1242)
Reported by: Guenther Kelleter
Review: https://reviewboard.asterisk.org/r/3144/
........
Merged revisions 406341 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 406342 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406343 65c4cc65-6c06-0410-ace0-fbb531ad65f3
When support for a realtime sorcery module was added in revision 386731, the
wrong property was accidentally used for setting the column name to be updated
in the database table. This patch fixes the typo.
(closes issue ASTERISK-23177)
Reported by: Denis
Tested by: Denis
Patches:
asterisk-23177-use-field-name.diff by Michael L. Young (license 5026)
........
Merged revisions 406311 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406312 65c4cc65-6c06-0410-ace0-fbb531ad65f3
........
r406294 | mmichelson | 2014-01-23 15:00:24 -0600 (Thu, 23 Jan 2014) | 11 lines
Fix presence body errors found during testing:
* PIDF bodies were reporting an "open" state in many cases where
it should have been reporting "closed"
* XPIDF bodies had XML nodes placed incorrectly within the hierarchy.
* SIP URIs in XPIDF bodies did not go through XML sanitization
* XML sanitization had some errors:
* Right angle bracket was being replaced with "&rt;" instead of ">"
* Double quote, apostrophe, and ampersand were not being escaped.
........
r406295 | mmichelson | 2014-01-23 15:09:35 -0600 (Thu, 23 Jan 2014) | 11 lines
Fix presence body errors found during testing:
* PIDF bodies were reporting an "open" state in many cases where
it should have been reporting "closed"
* XPIDF bodies had XML nodes placed incorrectly within the hierarchy.
* SIP URIs in XPIDF bodies did not go through XML sanitization
* XML sanitization had some errors:
* Right angle bracket was being replaced with "&rt;" instead of ">"
* Double quote, apostrophe, and ampersand were not being escaped.
........
Merged revisions 406294-406295 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406298 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Several of the playback error messages for invalid media input in
res_stasis_playback.c had the media name and channel name reversed.
They now correctly identify the channel name and media name.
Reported by: skrusty
........
Merged revisions 406152 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406153 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Making the help text for both more explicit regarding the format of mailbox identifiers. i.e. clarifying the format for app_voicemail mailboxes vs mailboxes from external MWI sources through modules such as res_external_mwi.
........
Merged revisions 406133 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406134 65c4cc65-6c06-0410-ace0-fbb531ad65f3
The PJSIP header parsing function (pjsip_parse_hdr) can generate more
than one header instance from a single header field. These header
instances exist as a list attached to the returned header and must be
handled appropriately when they are added to a message or else only the
first header instance will be used. This changes the linked list
functions used in outbound proxy code to merge the lists properly.
........
Merged revisions 406020 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406022 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This adds back in support for specifying channel variables during an
originate without compromising the ability to specify query parameters
in the JSON body. This was accomplished by generating the body-parsing
code in a separate function instead of being integrated with the URI
query parameter parsing code such that it could be called by paths with
body parameters. This is transparent to the user of the API and
prevents manual duplication of code or data structures.
(closes issue ASTERISK-23051)
Review: https://reviewboard.asterisk.org/r/3122/
Reported by: Matt Jordan
........
Merged revisions 406003 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406006 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This change adds improvements to support for allow=all in
pjsip.conf so that it functions as intended. Previously,
the allow/disallow socery configuration would set & clear
codecs from the media.codecs and media.prefs list, but if
all was specified the prefs list was not updated. Then a
call would fail when create_outgoing_sdp_stream() created
an SDP with no audio codecs.
A new function ast_codec_pref_append_all() is provided to
add all codecs to the prefs list - only those not already
on the list. This enables the configuration to specify a
codec preference, but still add all codecs, and even then
remove some codecs, as shown in this example:
allow = ulaw, alaw, all, !g729, !g723
Also, the display order of allow in cli output is updated
to match the configuration by using prefs instead of caps
when generating a human readable string.
Finally, a change to create_outgoing_sdp_stream() skips a
codec when it does not have a payload code instead of the
call failing.
(closes issue ASTERISK-23018)
Reported by: xrobau
Review: https://reviewboard.asterisk.org/r/3131/
........
Merged revisions 405875 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@405876 65c4cc65-6c06-0410-ace0-fbb531ad65f3