Commit Graph

8258 Commits

Author SHA1 Message Date
zuul 947f76a971 Merge "chan_sip: bigger buffers for headers, better failure mode" 2016-06-16 17:59:32 -05:00
zuul 88dfcd21b2 Merge "chan_sip: Support auth username for callbackextension feature" 2016-06-09 21:35:42 -05:00
zuul 0388c40b8c Merge "chan_pjsip: Lock channel when checking for RTP changes." 2016-06-09 13:53:58 -05:00
Mark Michelson cdb7edbe7b chan_pjsip: Lock channel when checking for RTP changes.
bridge_native_rtp can call into an RTP-capable channel driver in order
for the driver to update information about who the channel is
communicating with. For SIP channel drivers, this means deactivating
RTCP and sending a reinvite so that the endpoints can communicate
directly.

bridge_native_rtp does the right thing and has the channel locked when
calling into the channel driver. chan_pjsip can't alter session
properties in this thread, though. chan_pjsip queues a task on the
session serializer in order to update properties there.

The problem is that this queued task was not locking the channel. This
meant that the queued task could attempt to deactivate RTCP at the same
time that the channel thread was attempting to process an incoming RTCP
packet. This could lead to a crash.

This patch fixes the issue by locking the channel in the queued task
when altering RTP properties.

ASTERISK-26092 #close
Reported by Niklas Larsson

Change-Id: I3464e226a3c41f6b915f97891e07fa1599e2a159
2016-06-09 10:43:46 -05:00
George Joseph d21a77b325 build: Fix ast_sockaddr initialization to be more portable
A change to glibc 2.22 changed the order of the sockadddr_storage
members which caused the places where we do an initialization of
ast_sockaddr with '{ { 0, 0, } }' to fail compilation.  Those
initializers (which we shouldn't have been using anyway) have been
replaced with memsets.

Change-Id: Idd1b3b320903d8771bfe221f0b015685de628fa4
2016-06-09 09:50:31 -05:00
Joshua Colp 2525563438 Merge "chan_sip: No rtpmap for static RTP payload IDs in SDP." 2016-06-09 04:40:43 -05:00
Joshua Colp 5c949d009e Merge "Fixes to include signal.h" 2016-06-09 04:40:24 -05:00
Timo Teräs 39b69ab537 Fixes to include signal.h
POSIX defines signal.h. sys/signal.h should not be used as it is
c-library internal header which may or may not exist. Notably with
musl it generates warning of being incorrect.

Change-Id: Ia56b0aa1d84b5c590114867b1b384a624f39a6fc
2016-06-08 20:37:08 +03:00
Alexander Traud 784c18128b chan_sip: No rtpmap for static RTP payload IDs in SDP.
This saves around 100 bytes when G.711, G.722, G.729, and GSM are advertised in
SDP. This reduces the chance to hit the MTU bearer of 1300 bytes for SIP over
UDP, if many codecs are allowed in Asterisk. This new feature is enabled
together with the optional feature compactheaders=yes via the file sip.conf.

ASTERISK-25578 #close

Change-Id: I16491b1937862de26f84fa0ffe679a6bab925044
2016-06-08 09:13:01 +02:00
Vasil Kolev 80ff7912a1 chan_sip: bigger buffers for headers, better failure mode
Currently chan_sip can give weird messages if the contacts don't
fit in the From: or To: headers. This fix changes the from,to and
invite variables to use ast_str, allocates and deallocates them and
resizes them if needed.

ASTERISK-26069 #close

Change-Id: I1b68fcbddca6f6cc7d7a92fe1cb0d5430282b2b3
2016-06-07 15:10:13 +03:00
Richard Mudgett dca052e531 chan_rtp.c: Simplify options to UnicastRTP channel creation.
Change the awkward and not as flexible UnicastRTP options format
From:
Dial(UnicastRTP/127.0.0.1[/[<engine>][/[<codec>]]])
To:
Dial(UnicastRTP/127.0.0.1[/[<options>]])

Where <options> can be standard Asterisk flag options:
c(<codec>) - Specify which codec/format to use such as 'ulaw'.
e(<engine>) - Specify which RTP engine to use such as 'asterisk'.

More option flags can be easily added later such as the codec's RTP
payload type to use when the codec does not have a static payload type
defined.

Change-Id: I0c297aaf09e2ee515536cb7437bb8042ff8ff3c9
2016-06-06 17:05:43 -05:00
Timo Teräs 538c6415c6 chan_sip: Support auth username for callbackextension feature
ASTERISK-20527 #close

Change-Id: I659cf7f00836a09d09d146ad226a40477d731239
2016-06-03 09:35:53 +03:00
Mark Michelson bb0f4a6310 multicast RTP: Add dialing options
This adds a new parameter to the end of a multicast RTP dialing string.
This parameter defines the following options:

* i: Set the interface from which multicast RTP is sent
* l: Set whether multicast packets are looped back to the sender
* t: Set the TTL for multicast packets
* c: Set the codec to use for RTP

ASTERISK-26068 #close
Reported by Mark Michelson

Change-Id: I033b706b533f0aa635c342eb738e0bcefa07e219
2016-05-27 11:00:09 -05:00
Richard Mudgett 2a77af9ed0 chan_rtp.c: Cleanup ast_request() parameter parsing.
* Fixed NULL crash potential if parameters are missing.

* Reordered some operations so further diagnostic messages can be
more helpful.

Change-Id: Ibbdc67a2496508cbfbfef0cf19c35177ae2fbd70
2016-05-20 19:28:05 -05:00
George Joseph 5bd1bf2816 chan_sip: Prevent extra Session-Expires headers from being added
When chan_sip does a re-INVITE to refresh a session and authentication
is required, the INVITE with the Authorization header containes a
second Session-Expires header without the ";refersher=" parameter.
This is causing some proxies to return a 400.  Also, when Asterisk is
the uas and the refresher, it is including the Session-Expires and
Min-SE headers in OPTIONS messages which is not allowed per RFC4028.

This patch (based on the reporter's) Checks to see if a Session-Expires
header is already in the message before adding another one.  It also
checks that the method is INVITE or UPDATE.

ASTERISK-26030 #close

Change-Id: I58a7b07bab5a3177748d8a7034fb8ad8e11ce1d9
2016-05-17 11:59:35 -05:00
Joshua Colp 1e41d14822 Merge "chan_sip: Make autocreated peers send PeerStatus events" 2016-04-29 11:44:11 -05:00
Joshua Colp c480159045 chan_sip: Give more time for TCP/TLS threads to stop.
The unload process currently tells each TCP/TLS to terminate but
does not wait for them to do so. This introduces a race condition
where the container holding the threads may be destroyed before
the threads are able to remove themselves from it. When they
finally do the container is invalid and can't be used causing a
crash.

A previous change existed which waited a bit to wait for any
stranglers to finish. This change extends this and waits longer.

ASTERISK-25961 #close

Change-Id: Idc6262b670ca49ede32061159e323b7b63c6f3c6
2016-04-26 11:16:36 -05:00
kkm 41ecf22587 chan_sip: Make autocreated peers send PeerStatus events
Since Stasis has been introduced, an attempt to send AMI messages by an
autocreated peer caused a crash, and all events from autocreated peers were
semi-inadvertently disabled altogether in 0b83761. This change restores the
disabled functionality.

ASTERISK-25950

Change-Id: Iecc350f23db603fadb2f302064643ebe9664e974
2016-04-22 14:00:55 -07:00
Jaco Kroon f06ce7f90a chan_sip: Don't verify table if rtupdate=no
If rtupdate=no do not verify sipregs/peers table has updatable fields.

ASTERISK-25934 #close

Change-Id: Iaa2c53037b93daccc7e7333c40d61861847b856d
2016-04-18 05:34:59 -05:00
Richard Mudgett 6138a75e8e pbx.h: Make ast_state_cb_type take more const.
This eliminates some casts that I made a note saying v10 and above
would no longer need them.

Better late than never :)

Change-Id: I346cdb3032b6478ceb40eb6fe732978b54035572
2016-04-07 17:20:17 -05:00
zuul a04a62586f Merge "chan_sip: Do not send all codecs on INVITE. Do not break on Session-Timers." 2016-03-31 17:35:23 -05:00
George Joseph c4064727d2 chan_pjsip: Add 'pjsip show channelstats'
Added the ability to show channel statistics to chan_pjsip (cli_functions.c)

Moved the existing 'pjsip show channel(s)' functionality from
pjsip_configuration to cli_functions.c.  The stats needed chan_pjsip's
private header so it made sense to move the existing channel commands as well.

Now using stasis_cache_dump to get the channel snapshots rather than retrieving
all endpoints, then getting each one's channel snapshots.  Much more efficient.

Change-Id: I03b114522126d27434030b285bf6d531ddd79869
2016-03-29 14:35:31 -05:00
Alexander Traud 3f720155b7 chan_sip: Do not send all codecs on INVITE. Do not break on Session-Timers.
Asterisk 13.7.0 included a fix for ASTERISK-24543, not to send all those
codecs, which the caller did not request/support. That fix was not complete
because on the second Session Timer all codecs were sent again. Some VoIP/SIP
clients interpreted that complete codec-list as a change in the SIP session.
Because of that, Asterisk did not send the RTP audio via NAT anymore which
created a non-audio scenario after the second Session Timer fired.

ASTERISK-24543 #close

Change-Id: I1881827816ab7fd47eb4287a95961179b34a0b66
2016-03-24 20:21:22 +01:00
Francesco Castellano ac66999971 chan_sip.c: Space after port causes unnecessary resolution attempt
check_via() already skips leading blanks where the sent-by address (with the
optional port) should be placed.

Since RFC 3261 allows for blanks between the port ant the Via parameters:
> https://tools.ietf.org/html/rfc3261#section-20.42
(actually it allows a lot of blanks more ;-)). I just switched from
ast_skip_blanks() to ast_strip() on the local copy of the string.

ASTERISK-21301 #close

Change-Id: Ie5b8fe5a07067b7c0dc9bcdd1707e99b23b02b06
2016-03-22 10:29:31 -05:00
Kevin Harwell a3c9a74a02 chan_pjsip: ref leak when checking direct_media_glare
Fix the reference leak introduced in the following commit:

c534bd5807

ASTERISK-25849

Change-Id: I5cfefd5ee6c1c3a1715c050330aaa10e4d2a5e85
2016-03-18 15:09:39 -05:00
zuul 4aaf8f2ace Merge "chan_pjsip: transfers with direct media reinvite has wrong address/port" 2016-03-18 12:47:14 -05:00
Kevin Harwell c534bd5807 chan_pjsip: transfers with direct media reinvite has wrong address/port
During a transfer involving direct media a race occurs between when the
transferer channel is swapped out, initiating rtp changes/updates, and the
subsequent reinvites.

When Alice, after speaking with Charlie (Bob is on hold), connects Bob and
Charlie invites are sent to each in order to establish the call between them.
Bob is taken off hold and Charlie is told to have his media flow through
Asterisk. However, if before those invites go out the bridge updates Bob's
and/or Charlie's rtp information with direct media data (i.e. address, port)
then the invite(s) will contain the remote data in the SDP instead of the
Asterisk data.

The race occurs in the native bridge glue code when updating the peer. The
direct_media_address can get set twice before sending out the first invite
during call connection. This can happen because the checking/setting of the
direct_media_address happened in one thread while the sending of the invite(s)
happened in another thread.

This fix removes the race condition by moving the checking/setting of the
direct_media_address to be in the same thread as the sending of the invites(s).
This serializes the checking/setting and sending so they can no longer happen
out of order.

ASTERISK-25849 #close

Change-Id: Idfea590175e74f401929a601dba0c91ca1a7f873
2016-03-18 11:15:56 -05:00
Joshua Colp 7d63b4499e Merge "chan_sip.c: Made sip_reinvite_retry() call sip_pvt_lock_full()." 2016-03-17 11:19:23 -05:00
Richard Mudgett 810f92c9dc chan_sip.c: Fix mwi resub deadlock potential.
This patch is part of a series to resolve deadlocks in chan_sip.c.

Stopping a scheduled event can result in a deadlock if the scheduled event
is running when you try to stop the event.  If you hold a lock needed by
the scheduled event while trying to stop the scheduled event then a
deadlock can happen.  The general strategy for resolving the deadlock
potential is to push the actual starting and stopping of the scheduled
events off onto the scheduler/do_monitor() thread by scheduling an
immediate one shot scheduled event.  Some restructuring may be needed
because the code may assume that the start/stop of the scheduled events is
immediate.

ASTERISK-25023 #close

Change-Id: I96d429c57a48861fd8bde63dd93db4e92dc3adb6
2016-03-16 14:44:52 -05:00
Richard Mudgett 72c444ba37 chan_sip.c: Fix registration timeout and expire deadlock potential.
This patch is part of a series to resolve deadlocks in chan_sip.c.

Stopping a scheduled event can result in a deadlock if the scheduled event
is running when you try to stop the event.  If you hold a lock needed by
the scheduled event while trying to stop the scheduled event then a
deadlock can happen.  The general strategy for resolving the deadlock
potential is to push the actual starting and stopping of the scheduled
events off onto the scheduler/do_monitor() thread by scheduling an
immediate one shot scheduled event.  Some restructuring may be needed
because the code may assume that the start/stop of the scheduled events is
immediate.

ASTERISK-25023

Change-Id: I2e40de89efc8ae6e8850771d089ca44bc604b508
2016-03-16 14:44:52 -05:00
Richard Mudgett 7ea1e181dc chan_sip.c: Fix waitid deadlock potential.
This patch is part of a series to resolve deadlocks in chan_sip.c.

Stopping a scheduled event can result in a deadlock if the scheduled event
is running when you try to stop the event.  If you hold a lock needed by
the scheduled event while trying to stop the scheduled event then a
deadlock can happen.  The general strategy for resolving the deadlock
potential is to push the actual starting and stopping of the scheduled
events off onto the scheduler/do_monitor() thread by scheduling an
immediate one shot scheduled event.  Some restructuring may be needed
because the code may assume that the start/stop of the scheduled events is
immediate.

* Made always run check_pendings() under the scheduler thread so scheduler
ids can be checked safely.

ASTERISK-25023

Change-Id: Ia834d6edd5bdb47c163e4ecf884428a4a8b17d52
2016-03-16 14:44:51 -05:00
Richard Mudgett fbf8e04aed chan_sip.c: Fix t38id deadlock potential.
This patch is part of a series to resolve deadlocks in chan_sip.c.

Stopping a scheduled event can result in a deadlock if the scheduled event
is running when you try to stop the event.  If you hold a lock needed by
the scheduled event while trying to stop the scheduled event then a
deadlock can happen.  The general strategy for resolving the deadlock
potential is to push the actual starting and stopping of the scheduled
events off onto the scheduler/do_monitor() thread by scheduling an
immediate one shot scheduled event.  Some restructuring may be needed
because the code may assume that the start/stop of the scheduled events is
immediate.

ASTERISK-25023

Change-Id: If595e4456cd059d7171880c7f354e844c21b5f5f
2016-03-16 14:44:51 -05:00
Richard Mudgett 02458cc6fd chan_sip.c: Fix session timers deadlock potential.
This patch is part of a series to resolve deadlocks in chan_sip.c.

Stopping a scheduled event can result in a deadlock if the scheduled event
is running when you try to stop the event.  If you hold a lock needed by
the scheduled event while trying to stop the scheduled event then a
deadlock can happen.  The general strategy for resolving the deadlock
potential is to push the actual starting and stopping of the scheduled
events off onto the scheduler/do_monitor() thread by scheduling an
immediate one shot scheduled event.  Some restructuring may be needed
because the code may assume that the start/stop of the scheduled events is
immediate.

ASTERISK-25023

Change-Id: I6d65269151ba95e0d8fe4e9e611881cde2ab4900
2016-03-16 14:44:51 -05:00
Richard Mudgett c7fdff2e37 chan_sip.c: Fix reinviteid deadlock potential.
This patch is part of a series to resolve deadlocks in chan_sip.c.

Stopping a scheduled event can result in a deadlock if the scheduled event
is running when you try to stop the event.  If you hold a lock needed by
the scheduled event while trying to stop the scheduled event then a
deadlock can happen.  The general strategy for resolving the deadlock
potential is to push the actual starting and stopping of the scheduled
events off onto the scheduler/do_monitor() thread by scheduling an
immediate one shot scheduled event.  Some restructuring may be needed
because the code may assume that the start/stop of the scheduled events is
immediate.

ASTERISK-25023

Change-Id: I9c11b9d597468f63916c99e1dabff9f4a46f84c1
2016-03-16 14:44:51 -05:00
Richard Mudgett 69810b306d chan_sip.c: Fix autokillid deadlock potential.
This patch is part of a series to resolve deadlocks in chan_sip.c.

Stopping a scheduled event can result in a deadlock if the scheduled event
is running when you try to stop the event.  If you hold a lock needed by
the scheduled event while trying to stop the scheduled event then a
deadlock can happen.  The general strategy for resolving the deadlock
potential is to push the actual starting and stopping of the scheduled
events off onto the scheduler/do_monitor() thread by scheduling an
immediate one shot scheduled event.  Some restructuring may be needed
because the code may assume that the start/stop of the scheduled events is
immediate.

* Fix clearing autokillid in __sip_autodestruct() even though we could
reschedule.

ASTERISK-25023

Change-Id: I450580dbf26e2e3952ee6628c735b001565c368f
2016-03-16 14:44:51 -05:00
Richard Mudgett f484ddbdfe chan_sip.c: Fix packet retransid deadlock potential.
This patch is part of a series to resolve deadlocks in chan_sip.c.

Stopping a scheduled event can result in a deadlock if the scheduled event
is running when you try to stop the event.  If you hold a lock needed by
the scheduled event while trying to stop the scheduled event then a
deadlock can happen.  The general strategy for resolving the deadlock
potential is to push the actual starting and stopping of the scheduled
events off onto the scheduler/do_monitor() thread by scheduling an
immediate one shot scheduled event.  Some restructuring may be needed
because the code may assume that the start/stop of the scheduled events is
immediate.

* Fix retrans_pkt() to call check_pendings() with both the owner channel
and the private objects locked as required.

* Refactor dialog retransmission packet list to safely remove packet
nodes.  The list nodes are now ao2 objects.  The list has a ref and the
scheduled entry has a ref.

ASTERISK-25023

Change-Id: I50926d81be53f4cd3d572a3292cd25f563f59641
2016-03-16 14:44:51 -05:00
Richard Mudgett 67c79c326d chan_sip.c: Fix provisional_keepalive_sched_id deadlock.
This patch is part of a series to resolve deadlocks in chan_sip.c.

Stopping a scheduled event can result in a deadlock if the scheduled event
is running when you try to stop the event.  If you hold a lock needed by
the scheduled event while trying to stop the scheduled event then a
deadlock can happen.  The general strategy for resolving the deadlock
potential is to push the actual starting and stopping of the scheduled
events off onto the scheduler/do_monitor() thread by scheduling an
immediate one shot scheduled event.  Some restructuring may be needed
because the code may assume that the start/stop of the scheduled events is
immediate.

ASTERISK-25023

Change-Id: I98a694fd42bc81436c83aa92de03226e6e4e3f48
2016-03-16 14:44:51 -05:00
Richard Mudgett 76be7093cd chan_sip.c: Adjust how dialog_unlink_all() stops scheduled events.
This patch is part of a series to resolve deadlocks in chan_sip.c.

* Make dialog_unlink_all() unschedule all items at once in the sched
thread.

ASTERISK-25023

Change-Id: I7743072fb228836e8228b72f6dc46c8cc50b3fb4
2016-03-16 14:44:50 -05:00
Richard Mudgett 52f0932e4c chan_sip.c: Clear scheduled immediate events on unload.
This patch is part of a series to resolve deadlocks in chan_sip.c.

The reordering of chan_sip's shutdown is to handle any immediate events
that get put onto the scheduler so resources aren't leaked.  The typical
immediate events at this time are going to be concerned with stopping
other scheduled events.

ASTERISK-25023

Change-Id: I3f6540717634f6f2e84d8531a054976f2bbb9d20
2016-03-16 14:44:43 -05:00
Richard Mudgett 0987a11cce sip/dialplan_functions.c: Fix /channels/chan_sip/test_sip_rtpqos crash.
This patch is part of a series to resolve deadlocks in chan_sip.c.

Delaying destruction of the chan_sip sip_pvt structures caused the
/channels/chan_sip/test_sip_rtpqos unit test to crash.  That test
registers a special test ast_rtp_engine with the rtp engine module.  When
the unit test completes it cleans up by unregistering the test
ast_rtp_engine and exits.  Since the delayed destruction of the sip_pvt
happens after the unit test returns, the destructor tries to call the rtp
engine destroy callback of the test ast_rtp_engine auto variable which no
longer exists on the stack.

* Change the test ast_rtp_engine auto variable to a static variable.  Now
the variable can still exist after the unit test exits so the delayed
sip_pvt destruction can complete successfully.

ASTERISK-25023

Change-Id: I61e34a12d425189ef7e96fc69ae14993f82f3f13
2016-03-16 14:22:19 -05:00
Richard Mudgett cb97198ca6 chan_sip.c: Simplify sip_pvt destructor call levels.
Remove destructor calling destroy_it calling really_destroy_it
for no benefit.  Just make the destructor the really_destroy_it
function.

Change-Id: Idea0d47b27dd74f2488db75bcc7f353d8fdc614a
2016-03-14 14:10:10 -05:00
Richard Mudgett 8be01398d9 chan_sip.c: Made sip_reinvite_retry() call sip_pvt_lock_full().
Change-Id: I90f04208a089f95488a2460185a8dbc3f6acca12
2016-03-14 12:57:52 -06:00
George Joseph d2eb65f71e res_pjsip: Strip spaces from items parsed from comma-separated lists
Configurations like "aors = a, b, c" were either ignoring everything after "a"
or trying to look up " b".  Same for mailboxes,  ciphers, contacts and a few
others.

To fix, all the strsep(&copy, ",") calls have been wrapped in ast_strip.  To
facilitate this, ast_strip, ast_skip_blanks and ast_skip_nonblanks were
updated to handle null pointers.

In some cases, an ast_strlen_zero() test was added to skip consecutive commas.

There was also an attempt to ast_free an ast_strdupa'd string in
ast_sip_for_each_aor which was causing a SEGV.  I removed it.

Although this issue was reported for realtime, the issue was in the res_pjsip
modules so all config mechanisms were affected.

ASTERISK-25829 #close
Reported-by: Mateusz Kowalski

Change-Id: I0b22a2cf22a7c1c50d4ecacbfa540155bec0e7a2
2016-03-07 13:16:41 -06:00
Richard Mudgett 25de01f301 SIP diversion: Fix REDIRECTING(reason) value inconsistencies.
Previous chan_sip behavior:

Before this patch chan_sip would always strip any quotes from an incoming
reason and pass that value up as the REDIRECTING(reason).  For an outgoing
reason value, chan_sip would check the value against known values and
quote any it didn't recognize.  Incoming 480 response message reason text
was just assigned to the REDIRECTING(reason).

Previous chan_pjsip behavior:

Before this patch chan_pjsip would always pass the incoming reason value
up as the REDIRECTING(reason).  For an outgoing reason value, chan_pjsip
would send the reason value as passed down.

With this patch:

Both channel drivers match incoming reason values with values documented
by REDIRECTING(reason) and values documented by RFC5806 regardless of
whether they are quoted or not.  RFC5806 values are mapped to the
equivalent REDIRECTING(reason) documented value and is set in
REDIRECTING(reason).  e.g., an incoming RFC5806 'unconditional' value or a
quoted string version ('"unconditional"') is converted to
REDIRECTING(reason)'s 'cfu' value.  The user's dialplan only needs to deal
with 'cfu' instead of any of the aliases.

The incoming 480 response reason text supported by chan_sip checks for
known reason values and if not matched then puts quotes around the reason
string and assigns that to REDIRECTING(reason).

Both channel drivers send outgoing known REDIRECTING(reason) values as the
unquoted RFC5806 equivalent.  User custom values are either sent as is or
with added quotes if SIP doesn't allow a character within the value as
part of a RFC3261 Section 25.1 token.  Note that there are still
limitations on what characters can be put in a custom user value.  e.g.,
embedding quotes in the middle of the reason string is silly and just
going to cause you grief.

* Setting a REDIRECTING(reason) value now recognizes RFC5806 aliases.
e.g., Setting REDIRECTING(reason) to 'unconditional' is converted to the
'cfu' value.

* Added missing malloc() NULL return check in res_pjsip_diversion.c
set_redirecting_reason().

* Fixed potential read from a stale pointer in res_pjsip_diversion.c
add_diversion_header().  The reason string needed to be copied into the
tdata memory pool to ensure that the string would always be available.
Otherwise, if the reason string returned by reason_code_to_str() was a
user's reason string then the string could be freed later by another
thread.

Change-Id: Ifba83d23a195a9f64d55b9c681d2e62476b68a87
2016-03-01 20:21:58 -06:00
Richard Mudgett 2dae4a1ccf chan_sip.c: Fix T.38 issues caused by leaving a bridge.
chan_sip could not handle AST_T38_TERMINATED frames being sent to it when
the channel left the bridge.  The action resulted in overlapping outgoing
reINVITEs.  The testsuite tests/fax/sip/directmedia_reinvite_t38 was not
happy.

* Force T.38 to be remembered as locally bridged.  Now when the channel
leaves the native RTP bridge after T.38, the channel remembers that it has
already reINVITEed the media back to Asterisk.  It just needs to terminate
T.38 when the AST_T38_TERMINATED arrives.

* Prevent redundant AST_T38_TERMINATED from causing problems.  Redundant
AST_T38_TERMINATED frames could cause overlapping outgoing reINVITEs if
they happen before the T.38 state changes to disabled.  Now the T.38 state
is set to disabled before the reINVITE is sent.

ASTERISK-25582 #close

Change-Id: I53f5c6ce7d90b3f322a942af1a9bcab6d967b7ce
2016-02-29 12:56:20 -06:00
zuul 170941990b Merge "chan_sip: Optionally supply fromuser/fromdomain in SIP dial string." 2016-02-25 17:56:42 -06:00
Richard Mudgett 886ee09471 chan_sip.c: Suppress T.38 SDP c= line if addr is the same.
Use the correct comparison function since we only care if the address
without the port is the same.

Change-Id: Ibf6c485f843a1be6dee58a47b33d81a7a8cbe3b0
2016-02-23 16:40:32 -06:00
Walter Doekes c00082329e chan_sip: Optionally supply fromuser/fromdomain in SIP dial string.
Previously you could add [!dnid] to the SIP dial string to alter the To:
header. This change allows you to alter the From header as well.

SIP dial string extra options now look like this:

    [![touser[@todomain]][![fromuser][@fromdomain]]]

INCOMPATIBLE CHANGE: If you were using an exclamation mark in your To:
header, that is no longer possible.

ASTERISK-25803 #close

Change-Id: I2457e9ba7a89eb1da22084bab5a4d4328e189db7
2016-02-19 11:30:15 +01:00
George Joseph b69729dde5 chan_misdn: Fix a few issues causing compile errors
Change-Id: I54b48c24d7ca88ed80496fdfd142d08772a7ab98
2016-02-05 11:58:54 -06:00
Richard Mudgett a877e0d94b AST-2016-002 chan_sip.c: Fix retransmission timeout integer overflow.
Setting the sip.conf timert1 value to a value higher than 1245 can cause
an integer overflow and result in large retransmit timeout times.  These
large timeout times hold system file descriptors hostage and can cause the
system to run out of file descriptors.

NOTE: The default sip.conf timert1 value is 500 which does not expose the
vulnerability.

* The overflow is now detected and the previous timeout time is
calculated.

ASTERISK-25397 #close
Reported by: Alexander Traud

Change-Id: Ia7231f2f415af1cbf90b923e001b9219cff46290
2016-02-03 15:04:08 -06:00