Commit Graph

27623 Commits

Author SHA1 Message Date
Joshua Colp
f09f923514 Merge "res_pjsip_outbound_publishing: After unloading the library won't load again" into 13 2016-05-19 13:33:08 -05:00
Joshua Colp
4e4a991d90 Merge "res_pjsip: Endpoint IP Access Controls" into 13 2016-05-19 11:54:03 -05:00
Joshua Colp
7d986ff3f6 Merge "res_pjsip_outbound_publish: Ref leak in off nominal callback paths" into 13 2016-05-19 05:56:31 -05:00
Joshua Colp
1b7ba9bb00 Merge "udptl: Don't eat sequence numbers until OK is received" into 13 2016-05-19 05:33:35 -05:00
Joshua Colp
4a04a5a3ec Merge "res/res_hep_pjsip: Fix reported local IP address when bound to 'any'" into 13 2016-05-19 05:18:32 -05:00
Joshua Colp
811a54836d Merge "res_pjsip_outbound_publish: state potential dropped on reloads/realtime fetches" into 13 2016-05-19 05:13:38 -05:00
Joshua Colp
cceccd68ad Merge "res_pjsip_outbound_publish: Potential crash due to off nominal path" into 13 2016-05-19 05:12:46 -05:00
Joshua Colp
4509aa890f Merge "res_pjsip_outbound_publish: Won't unload if condition wait times out" into 13 2016-05-18 19:17:43 -05:00
Joshua Colp
480b8cda30 Merge "chan_sip: Prevent extra Session-Expires headers from being added" into 13 2016-05-18 15:37:59 -05:00
George Joseph
935e0496c4 udptl: Don't eat sequence numbers until OK is received
Scenario:
Local fax -> Asterisk w/ firewall -> Provider -> Remote fax

* Local fax starts rtp call to remote fax
* Remote fax starts t38 call back to local fax.
* Local fax sends t38 no-signal to Asterisk before sending an OK.
* udptl processes the frame and increments the expected sequence number.
* chan_sip drops the frame because the call isn't up so nothing goes out
  the external interface to open the port for incoming packets.
* Local fax sends OK and Asterisk sends OK to the remote fax.
* Remote fax sends t38 packets which are dropped by the firewall.
* Local fax re-sends t38 no-signal with the same sequence number.
* udptl drops the frame because it thinks it's a dup.
* Still no outgoing packets to open the firewall.
* t38 negotiation fails.

The patch drops frames t38 received before udptl sequence processing
when the call hasn't been answered yet.  The second no-signal frame
is then seen as new and is relayed out the external interface which
opens the port and allows negotiation to continue.

ASTERISK-26034 #close

Change-Id: I11744b39748bd2ecbbe8ea84cdb4f3c5943c5af9
2016-05-18 14:05:47 -05:00
George Joseph
77e8ec162b 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:58:18 -05:00
George Joseph
3f6ef63099 res_pjsip_outbound_registration: Clean up state when registration is deleted
Nothing was cleaning up the registration state object when ast_sorcery_delete
was called on a registration.  So, the registration was deleted from sorcery
but the state object went right on refreshing the registration (or failing
to refresh the registration) with the peer.

* Added a 'deleted' observer on registration that removes the state object.

ASTERISK-25964 #close
Reported-by Matt Jordan

Change-Id: I2db792145cdb1f72ebbf57dd9099596dbbf12c23
2016-05-16 20:43:54 -05:00
zuul
bcb133ce93 Merge "configs/samples/pjsip.conf.sample: Fix typo" into 13 2016-05-16 13:53:02 -05:00
George Joseph
b6f9392a12 res_pjsip: Set TCP_NODELAY on TCP transports
Although it's perfectly legal to place multiple SIP messages in the same packet,
it can cause problems because the Linux default is to enable Path MTU Discovery
which sets the Don't Fragment bit on the packets. If adding a second message to
the packet causes the MTU to be exceeded, and the destination isn't equipped to
send a FRAGMENTATION NEEDED response to a large packet, the packet will just be
dropped.

We can't specifically tell the stack to send only 1 message per packet, but we
can turn on TCP_NODELAY when we create the transport. This will at least tell
the stack to send packets as soon as possible.

ASTERISK-26005 #close
Reported-by: Ross Beer

Change-Id: I820f23227183f2416ca5e393bec510e8fe1c8fbd
2016-05-15 18:05:34 -06:00
Matt Jordan
361a16f316 configs/samples/pjsip.conf.sample: Fix typo
A ':' is not a valid token for starting a comment.

Change-Id: I123592d93a83d1bdde3e352822881eb9da85e5ad
2016-05-14 21:48:56 -05:00
Matt Jordan
f91a7dc993 res/res_hep_pjsip: Fix reported local IP address when bound to 'any'
When bound to an 'any' address, e.g., 0.0.0.0, PJSIP reports as its
local address the 'any' address, as opposed to the IP address we
actually received the packet on. This can cause some confusion in Homer,
as it will dutifully report what we send it.

This patch uses the PJSIP inspection routines to determine which IP
address we probably received the packet on based on the remote party's
IP address. In the event that this fails, it falls back to the IP
address natively reported by the transport.

Change-Id: I076f835d2aef489e1ee1d01595b211eb2ce62da3
2016-05-14 19:54:11 -05:00
zuul
12db14b9b1 Merge "logger: Add PID to syslog messages." into 13 2016-05-14 19:50:44 -05:00
Sean Bright
9de5cd209e res_ari: Correct Location headers returned by some ARI resources
The Location headers returned by:

 * /bridges/{bridgeId}/play
 * /bridges/{bridgeId}/record
 * /channels/{channelId}/play
 * /channels/{channelId}/record

Did not have the '/ari' prefix, and in the case of the 'play' resources, were
using 'playback' instead of 'playbacks.'

Change-Id: I957c58a3a1471bf477dae7c67faa1b74fcd9241c
2016-05-14 13:46:56 -04:00
zuul
e6a946400f Merge "res_hep: Provide an option to pick the UUID type" into 13 2016-05-14 09:47:33 -05:00
zuul
c735ce1a05 Merge "config_transport: Tell pjproject to allow all SSL/TLS protocols" into 13 2016-05-13 17:57:52 -05:00
Alexei Gradinari
524a302974 res_pjsip: Endpoint IP Access Controls
With the old SIP module we can use IP access controls per peer.
PJSIP module missing this feature.

This patch added next configuration Endpoint options:
    "acl" - list of IP ACL section names in acl.conf
    "deny" - List of IP addresses to deny access from
    "permit" - List of IP addresses to permit access from
    "contact_acl" - List of Contact ACL section names in acl.conf
    "contact_deny" - List of Contact header addresses to deny
    "contact_permit" - List of Contact header addresses to permit

This patch also better logging failed request:
    add custom message instead of "No matching endpoint found"
    add SIP method to logging

ASTERISK-25900

Change-Id: I456dea3909d929d413864fb347d28578415ebf02
2016-05-13 12:38:20 -04:00
Matt Jordan
89ae4466ea res_hep: Provide an option to pick the UUID type
At one point in time, it seemed like a good idea to use the Asterisk
channel name as the HEP correlation UUID. In particular, it felt like
this would be a useful identifier to tie PJSIP messages and RTCP
messages together, along with whatever other data we may eventually send
to Homer. This also had the benefit of keeping the correlation UUID
channel technology agnostic.

In practice, it isn't as useful as hoped, for two reasons:
1) The first INVITE request received doesn't have a channel. As a
   result, there is always an 'odd message out', leading it to be
   potentially uncorrelated in Homer.
2) Other systems sending capture packets (Kamailio) use the SIP Call-ID.
   This causes RTCP information to be uncorrelated to the SIP message
   traffic seen by those capture nodes.

In order to support both (in case someone is trying to use res_hep_rtcp
with a non-PJSIP channel), this patch adds a new option, uuid_type, with
two valid values - 'call-id' and 'channel'. The uuid_type option is used
by a module to determine the preferred UUID type. When available, that
source of a correlation UUID is used; when not, the more readily available
source is used.

For res_hep_pjsip:
 - uuid_type = call-id: the module uses the SIP Call-ID header value
 - uuid_type = channel: the module uses the channel name if available,
                        falling back to SIP Call-ID if not
For res_hep_rtcp:
 - uuid_type = call-id: the module uses the SIP Call-ID header if the
                        channel type is PJSIP and we have a channel,
                        falling back to the Stasis event provided
                        channel name if not
 - uuid_type = channel: the module uses the channel name

ASTERISK-25352 #close

Change-Id: Ide67e59a52d9c806e3cc0a797ea1a4b88a00122c
2016-05-13 07:44:20 -05:00
zuul
1705c5d2ba Merge "pjsip_distributor: Add missing newline to NOTICE" into 13 2016-05-13 06:21:34 -05:00
Joshua Colp
dd9900849b Merge "basic-cfg: asterisk.conf: don't set languages" into 13 2016-05-13 04:54:06 -05:00
zuul
8143a00c69 Merge "basic-cfg: asterisk.conf: defaults of options" into 13 2016-05-12 23:18:43 -05:00
zuul
515f49747c Merge "basic-cfg: asterisk.conf: remove [directories]" into 13 2016-05-12 23:18:41 -05:00
zuul
bf3c7a891a Merge "basic-cfg: asterisk.conf: debug level 5 spams" into 13 2016-05-12 22:20:41 -05:00
zuul
25db2a8bf5 Merge "followme: delete the right recorded name file" into 13 2016-05-12 22:03:40 -05:00
Joshua Colp
a83bf5dabd Merge "Use doubles instead of floats for conversions when comparing strings." into 13 2016-05-12 19:20:07 -05:00
Tzafrir Cohen
a73d79c22f basic-cfg: asterisk.conf: remove [directories]
A minimal configuration does not need to explicitly spell out the
directories. The built-in defaults will do just fine. In many cases
they are wrong.

Change-Id: Id1a671e5c5e9923765a4156b57f9f7e263fdd26c
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2016-05-12 16:53:23 -05:00
Tzafrir Cohen
1c56de9453 basic-cfg: asterisk.conf: defaults of options
Note the default of remmed-out options. To clarify that those values are
not the defaults.

Change-Id: I849c29b7a710f0abc37355fcb5bfee335ae30738
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2016-05-12 16:53:14 -05:00
Tzafrir Cohen
d7af591c59 basic-cfg: asterisk.conf: debug level 5 spams
Don't suggest users to use debug level 5, which spews (usually
non-useful) debug information. Reduce the suggestion to (an
arbitrarily-selected) level 2.

Change-Id: Ib53195f78945970956ff59ef13fa89b90e0fcd60
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2016-05-12 16:53:06 -05:00
Tzafrir Cohen
9b7db18fc1 basic-cfg: asterisk.conf: don't set languages
* No need to set language in a miniml configuration. 'en' will do just
  fine.
* It would be useful to have an example of setting it to a different
  language.
* Setting the documentation language explicitly is likewise not
  required. Setting it to a different value is not common. At least
  until there is a set of translated documentation.

Change-Id: I94d91ea34e129925f25af81ef8dc0906fb568cb7
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2016-05-12 16:52:59 -05:00
Tzafrir Cohen
eec539a46e followme: delete the right recorded name file
FollowMe with the option a records the name of the caller and plays it
to the callee. However it has failed to clean up that recorded file
as it tried to delete the file name without the '.sln' extension.

ASTERISK-26008 #close

Change-Id: I79d7b1be7d5cde57bf076d9389e2a8a4422776ec
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2016-05-12 16:52:50 -05:00
zuul
95285c6d23 Merge "res_pjsip_outbound_registration: generate correct Contact URI for TLS" into 13 2016-05-12 15:05:42 -05:00
Mark Michelson
02d30e171e Use doubles instead of floats for conversions when comparing strings.
In 13.9.0, there was an issue where PJSIP contacts added to an AOR would
be deleted at seemingly random times.

One reason this was happening was because of an operation to retrieve
the contacts whose expiration time was less than or equal to the current
time. When retrieving existing contacts, the contact's expiration time
and the current time were converted from a string to a float, and those
two floats were compared.

On some systems, including mine, this conversion was horribly off. For
instance, I could regularly see the string "1463079214" get converted
into 1463079168.000000. When switching from using a float to using a
double, the conversion was as expected.

Why was the conversion to float off? My best guess is that the
conversion to float was attempting to store the entire value in the 23
bit significand of the IEEE-754 floating point number. In particular, if
you take only the 23 most significant bits of 1463079214, you get the
messed up 1463079168 that we were seeing in the conversion. It likely
was possible to get a more precise value by composing the number using
an exponent, but the conversion did not work that way. With a double,
you have a 52 bit significand, allowing the entire value to fit there,
and thereby allowing an accurate conversion.

ASTERISK-26007 #close
Reported by Greg Siemon

Change-Id: I83ca7944aae8b7cd994b254c78ec02411d321070
2016-05-12 14:36:25 -05:00
George Joseph
e2df15bae9 pjsip_distributor: Add missing newline to NOTICE
There was a newline missing from the end of the "no matching endpoint" notice.

Change-Id: Idc11fe5bc0354072291663dbffe648c471e39181
2016-05-12 08:15:24 -06:00
Sebastian Damm
a94a12bbf7 res_pjsip_outbound_registration: generate correct Contact URI for TLS
There are two types of SIP URIs indicating a secure transport:
* sips:user@example.org
* sip:user@example.org;transport=tls

When using a sips URI, Asterisk checks incoming INVITEs and answers from
the other side for sips URIs, and rejects the packet if there are only
sip URIs. So Asterisk should only generate a sips Contact URI if the
other side supports it.

This patch makes Asterisk generate either a sip or sips Contact URI
depending on the format of the server URI.

If you want a sip URI, use:
server_uri=sip:example.org\;transport=tls

If you want a sips URI, use:
server_uri=sips:example.org

ASTERISK-25990 #close
Reported-by: Sebastian Damm

Change-Id: I5ae57d6531ce940b5fc64d5cd2673e60db0f9ba2
2016-05-12 05:34:24 -05:00
Alexei Gradinari
36d66a23e0 logger: Add PID to syslog messages.
During refactoring of this support the addition of
the PID to messages was removed. This change adds it
back in.

ASTERISK-25538 #close

Change-Id: Ie2d43b0652e59b7ac319a7dba94501540d70ba36
2016-05-12 05:12:05 -05:00
Matt Jordan
37214b0bdf configure: Fix errors with AST_UNDEFINED_SANITIZER/AST_LEAK_SANITIZER
When running on a system that does not support or use AST_UNDEFINED_SANITIZER
or AST_LEAK_SANITIZER, the configure script would incorrectly set those
constants to a blank value, e.g., 'AST_UNDEFINED_SANITIZER='. This would
cause menuselect to error out, complaining that a blank value is not a
valid option. This patch corrects the issue by setting the value to 0 if
the options that those constants enable/disable is not found.

Change-Id: Ib39814aaf940f308d500c1e026edb3d70de47fba
2016-05-11 14:07:17 -05:00
zuul
a01ce2b889 Merge "res_pjsip: improve realtime performance" into 13 2016-05-11 12:22:10 -05:00
Kevin Harwell
49b25a0956 res_pjsip_outbound_publish: state potential dropped on reloads/realtime fetches
When reloading, or fetching realtime data, if the "apply" failed for any
numerous reasons the current state object would not be maintained. This
potentially resulted in publishes being stopped for some states/clients when
they should not have been.

This patch makes it so the current state object is kept upon any type of reload/
fetch failures.

Change-Id: Iab6020c116d628ed2ae81183e987e2eaa3c90b30
2016-05-11 11:42:02 -05:00
Kevin Harwell
1b5c91b7be res_pjsip_outbound_publish: Potential crash due to off nominal path
It was possible for the explicit publish destroy function to be called without
the pjsip client ever being initialized. This fix checks to make sure there is
a client to destroy before attempting.

Change-Id: I8eea1bfa3bd472149bfc255310be2a6248688f5c
2016-05-11 11:41:39 -05:00
Kevin Harwell
10de553c9d res_pjsip_outbound_publishing: After unloading the library won't load again
The same thing was happening in res_pjsip_publish_asterisk. When the library
was unloaded it did not unregister the object type from sorcery. Subsequent
loads resulted in a failed load due to the sorcery type already existing.

Change-Id: Ifdc25e94e4cd40bc5a19eb4d0a00b86c2e9fedc9
2016-05-11 11:41:21 -05:00
Kevin Harwell
1a833b9739 res_pjsip_outbound_publish: Ref leak in off nominal callback paths
There were a few spots where the client object's reference was being leaked in
sip_outbound_publish_callback. This patch cleans up those leaks.

Change-Id: I485d0bc9335090f373026f77c548042e258461df
2016-05-11 11:41:06 -05:00
Kevin Harwell
4752ef02e0 res_pjsip_outbound_publish: Won't unload if condition wait times out
When res_pjsip_outbound_publish unloads it has to wait for all current
publishing objects to get done. However if the wait condition times out
then it does not fail the unload. This sometimes results in an infinite
loop check while unloading. This patch now fails the unload operation if
the condition times out.

Change-Id: Id57b8cbed9d61222690fcba1e4f18e259df4c7ec
2016-05-11 11:40:42 -05:00
zuul
81773ceb9c Merge "res_fax/t38_gateway: Peer V.21 session is created on wrong channel" into 13 2016-05-11 10:19:50 -05:00
Joshua Colp
2d4c818ac1 Merge "app_confbridge: Add a regcontext option for confbridge bridge profiles." into 13 2016-05-10 04:48:44 -05:00
zuul
577d65b701 Merge "res_pjsip_authenticator_digest: Don't use source port in nonce verification" into 13 2016-05-09 22:34:39 -05:00
Joshua Colp
7561ffa64a Merge "pjproject_bundled: Check for python-dev and TEST_FRAMEWORK" into 13 2016-05-09 20:11:30 -05:00