summaryrefslogtreecommitdiff
path: root/channels/chan_sip.c
AgeCommit message (Collapse)Author
2018-03-12Merge "Replace direct checks of option_debug with DEBUG_ATLEAST macro."Jenkins2
2018-03-07Replace direct checks of option_debug with DEBUG_ATLEAST macro.Corey Farrell
Checking option_debug directly is incorrect as it ignores file/module specific debug settings. This system-wide change replaces nearly all direct checks for option_debug with the DEBUG_ATLEAST macro. Change-Id: Ic342d4799a945dbc40ac085ac142681094a4ebf0
2018-03-07chan_sip: Fix improper RTP framing on outgoing callsJean Aunis
The "ptime" SDP parameter received in a SIP response was not honoured. Moreover, in the abscence of this "ptime" parameter, locally configured framing was lost during response processing. This patch systematically stores the framing information in the ast_rtp_codecs structure, taking it from the response or from the configuration as appropriate. ASTERISK-27674 Change-Id: I828a6a98d27a45a8afd07236a2bd0aa3cbd3fb2c
2018-02-20chan_sip: Emit a second ringing event to ensure channel is found.Joshua Colp
When constructing a dialog-info+xml NOTIFY message a ringing channel is found if the state is ringing and further information is placed into the message. Due to the migration to the Stasis message bus this did not always work as expected. This change raises a second ringing event in such a way to guarantee that the event is received by chan_sip and another lookup is done to find the ringing channel. ASTERISK-24488 Change-Id: I547a458fc59721c918cb48be060cbfc3c88bcf9c
2018-02-12chan_sip.c: Fix crash processing CANCEL.Richard Mudgett
Check if initreq data string exists before using it when processing a CANCEL request. ASTERISK-27666 Change-Id: Id1d0f0fa4ec94e81b332b2973d93e5a14bb4cc97
2018-01-15loader: Add dependency fields to module structures.Corey Farrell
* Declare 'requires' and 'enhances' text fields on module info structure. * Rename 'nonoptreq' to 'optional_modules'. * Update doxygen comments. Still need to investigate dependencies among modules I cannot compile. Change-Id: I3ad9547a0a6442409ff4e352a6d897bef2cc04bf
2018-01-11chan_sip: Check that an iostream exists before accessing.Joshua Colp
Before getting the file descriptor for an iostream check that it is present. ASTERISK-27534 Change-Id: Ie0aa1394007a37c30e337ea1176a6fb3a63bc99c
2017-12-31ice: Increase foundation buffer sizeSean Bright
Per RFC 5245, the foundation specified with an ICE candidate can be up to 32 characters but we are only allowing for 31. ASTERISK-27498 #close Reported by: Michele Prà Change-Id: I05ce7a5952721a76a2b4c90366168022558dc7cf
2017-12-20Fix Common Typo's.Corey Farrell
Fix instances of: * Retreive * Recieve * other then * different then * Repeated words ("the the", "an an", "and and", etc). * othterwise, teh ASTERISK-24198 #close Change-Id: I3809a9c113b92fd9d0d9f9bac98e9c66dc8b2d31
2017-12-19chan_sip: Fix memory leaks.Corey Farrell
In change_redirecting_information variables we use ast_strlen_zero to see if a value should be saved. In the case where the value is not NULL but is a zero length string we leaked. handle_response_subscribe leaked a reference to the ccss monitor instance. Change-Id: Ib11444de69c3d5b2360a88ba2feb54d2c2e9f05f
2017-12-15chan_sip: Add security event for calls to invalid extension.Corey Farrell
Log a message to security events when an INVITE is received to an invalid extension. ASTERISK-25869 #close Change-Id: I0da40cd7c2206c825c2f0d4e172275df331fcc8f
2017-12-14Merge "chan_sip: 3PCC patch for AMI "SIPnotify""Joshua Colp
2017-12-13Merge "chan_sip: Don't crash in Dial on invalid destination"Jenkins2
2017-12-13chan_sip: 3PCC patch for AMI "SIPnotify"Yasuhiko Kamata
A patch for sending in-dialog SIP NOTIFY message with "SIPnotify" AMI action. ASTERISK-27461 Change-Id: I5797ded4752acd966db6b13971284db684cc5ab4
2017-12-12chan_sip: Don't send trailing \0 on keep alive packetsSean Bright
This is a partial fix for ASTERISK~25817 but does not address the comments regarding RFC 5626. Change-Id: I227e2d10c0035bbfa1c6e46ae2318fd1122d8420
2017-12-12chan_sip: Don't crash in Dial on invalid destinationSean Bright
Stripping the DNID in a SIP dial string can result in attempting to call the argument parsing macros on an empty string, causing a crash. ASTERISK-26131 #close Reported by: Dwayne Hubbard Patches: dw-asterisk-master-dnid-crash.patch (license #6257) patch uploaded by Dwayne Hubbard Change-Id: Ib84c1f740a9ec0539d582b09d847fc85ddca1c5e
2017-11-21chan_sip: ICE contained square brackets around IPv6 addresses.Alexander Traud
ASTERISK-27434 Change-Id: Iaeed89b4fa05d94c5f0ec2d3b7cd6e93d2d5a8f7
2017-11-06dtls: Add support for ephemeral DTLS certificates.Sean Bright
This mimics the behavior of Chrome and Firefox and creates an ephemeral X.509 certificate for each DTLS session. Currently, the only supported key type is ECDSA because of its faster generation time, but other key types can be added in the future as necessary. ASTERISK-27395 Change-Id: I5122e5f4b83c6320cc17407a187fcf491daf30b4
2017-10-24chan_sip: Fix SUBSCRIBE with missing "Expires" header.Corey Farrell
When chan_sip receives a SUBSCRIBE request with no "Expires" header it processes the request as an unsubscribe. This is incorrect, per RFC3264 when the "Expires" header is missing a default expiry should be used. ASTERISK-18140 Change-Id: Ibf6dcd4fdd07a32c2bc38be1dd557981f08188b5
2017-10-21chan_sip: Crypto attribute not last but first on SDP media level.Alexander Traud
This matches the behavior of the other SIP channel driver, chan_pjsip. ASTERISK-27365 Change-Id: I8f23a51290a58b75816da2999ed1965441dfc5d6
2017-10-18chan_sip: Fix output of 'sip set debug off'.Corey Farrell
When sip.conf contains 'sipdebug=yes' it is impossible to disable it using CLI 'sip set debug off'. This corrects the output of that CLI command to instruct the user to turn sipdebug off in the configuration file. ASTERISK-23462 #close Change-Id: I1cceade9caa9578e1b060feb832e3495ef5ad318
2017-10-05res_pjsip_caller_id chan_sip: Comply to RFC 3323 values for privacyDaniel Tryba
Currently privacy requests are only granted if the Privacy header value is exactly "id" (defined in RFC 3325). It ignores any other possible value (or a combination there of). This patch reverses the logic from testing for "id" to grant privacy, to testing for "none" and granting privacy for any other value. "none" must not be used in combination with any other value (RFC 3323 section 4.2). ASTERISK-27284 #close Change-Id: If438a21f31a962da32d7a33ff33bdeb1e776fe56
2017-09-08Merge "chan_sip: when getting sip pvt return failure if not found"Jenkins2
2017-09-06chan_sip: when getting sip pvt return failure if not foundScott Griepentrog
In handle_request_invite, when processing a pickup, a call is made to get_sip_pvt_from_replaces to locate the pvt for the subscription. The pvt is assumed to be valid when zero is returned indicating no error, and is dereferenced which can cause a crash if it was not found. This change checks the not found case and returns -1 which allows the calling code to fail appropriately. ASTERISK-27217 #close Reported-by: Bryan Walters Change-Id: I6bee92b8b8b85fcac3fd66f8c00ab18bc1765612
2017-09-06chan_sip: Do not change IP address in SDP origin line (o=) in SIP reINVITEVitezslav Novy
If directmedia=yes is configured, when call is answered, Asterisk sends reINVITE to both parties to set up media path directly between the endpoints. In this reINVITE msg SDP origin line (o=) contains IP address of endpoint instead of IP of asterisk. This behavior violates RFC3264, sec 8: "When issuing an offer that modifies the session, the "o=" line of the new SDP MUST be identical to that in the previous SDP, except that the version in the origin field MUST increment by one from the previous SDP." This patch assures IP address of Asterisk is always sent in SDP origin line. ASTERISK-17540 Reported by: saghul Change-Id: I533a047490c43dcff32eeca8378b2ba02345b64e
2017-08-07chan_sip: Access incoming REFER headers in dialplankkm
This adds a way to access information passed along with SIP headers in a REFER message that initiates a transfer. Headers matching a dialplan variable GET_TRANSFERRER_DATA in the transferrer channel are added to a HASH object TRANSFER_DATA to be accessed with functions HASHKEY and HASH. The variable GET_TRANSFERRER_DATA is interpreted to be a prefix for headers that should be put into the hash. If not set, no headers are included. If set to a string (perhaps 'X-' in a typical case), all headers starting this string are added. Empty string matches all headers. If there are multiple of the same header, only the latest occurrence in the REFER message is available in the hash. Obviously, the variable GET_TRANSFERRER_DATA must be inherited by the referrer channel, and should be set with the '_' or '__' prefix. I avoided a specific reference to SIP or REFER, as in my mind the mechanism can be generalized to other channel techs. ASTERISK-27162 Change-Id: I73d7a1e95981693bc59aa0d5093c074b555f708e
2017-08-02chan_sip: Add dialplan function SIP_HEADERSkkm
Syntax: SIP_HEADERS([prefix]) If the argument is specified, only the headers matching the given prefix are returned. The function returns a comma-separated list of SIP header names from an incoming INVITE message. Multiple headers with the same name are included in the list only once. The returned list can be iterated over using the functions POP() and SIP_HEADER(). For example, '${SIP_HEADERS(Co)}' might return the string 'Contact,Content-Length,Content-Type'. Practical use is rather '${SIP_HEADERS(X-)}' to enumerate optional extended headers sent by a peer. ASTERISK-27163 Change-Id: I2076d3893d03a2f82429f393b5b46db6cf68a267
2017-08-01Fix compiler warnings on Fedora 26 / GCC 7.Corey Farrell
GCC 7 has added capability to produce warnings, this fixes most of those warnings. The specific warnings are disabled in a few places: * app_voicemail.c: truncation of paths more than 4096 chars in many places. * chan_mgcp.c: callid truncated to 80 chars. * cdr.c: two userfields are combined to cdr copy, fix would break ABI. * tcptls.c: ignore use of deprecated method SSLv3_client_method(). ASTERISK-27156 #close Change-Id: I65f280e7d3cfad279d16f41823a4d6fddcbc4c88
2017-07-07Merge "core: Remove 'Data Retrieval API'"Jenkins2
2017-07-05Merge "chan_sip: Fix a typo for tlsbindaddr in autodomain (SIP Domain Support)."Jenkins2
2017-07-05core: Remove 'Data Retrieval API'Sean Bright
This API was not actively maintained, was not added to new modules (such as res_pjsip), and there exist better alternatives to acquire the same information, such as the ARI. Change-Id: I4b2185a83aeb74798b4ad43ff8f89f971096aa83
2017-07-03chan_sip: Only when different, add TCP|TLS in autodomain (SIP Domain Support).Alexander Traud
When sip.conf contained tcpenable=yes and autodomain=yes, the TCP domain was added in any case, because of a local Boolean-negation error of the return value of ast_sockaddr_cmp. After fixing this error for TCP and TLS, the TLS domain was still always added with tlsenable=yes, because the domains were not compared just on the address but also on the port – and TLS is always on a different port than UDP/TCP. ASTERISK-27106 Change-Id: I14fe9e319e238320b094016980445ef3a5b3337c
2017-07-03chan_sip: Fix a typo for tlsbindaddr in autodomain (SIP Domain Support).Alexander Traud
Because of a copy-and-paste error when the struct ast_sockaddr changed, tlsbindaddr was not added, when sip.conf contained autodomain=yes; see "show sip domains" on the command-line interface (CLI) of Asterisk. ASTERISK-27106 Change-Id: I3d0957150017c223136968ef1266f275d0d6695e
2017-05-22chan_sip: Better ICE handling for RTCP-MUXSean Bright
If we are offered or are offering RTCP-MUX, don't consider RTCP ICE candidates. This confuses certain browsers (current Firefox for example) and causes intial audio setup delays. ASTERISK-26982 #close Change-Id: Ifeaf47e83972fe8dbe58b7fb3d6d1823400cfb91
2017-05-12chan_sip: Change sip_get_codec() to return correct codec listVitezslav Novy
Return cahnnel nativeformats to fix bridge technology selection process. Same approach as in pjsip module. ASTERISK-26143 Reported-by: Henning Holtschneider Change-Id: I64e863753954d6ad67a9e722df2ebc328705ad48
2017-05-03Merge "channels/chan_sip.c: use binding IP address for outgoing TCP SIP ↵Joshua Colp
connections"
2017-04-27Merge "chan_sip: Trigger reinvite if the SDP answer is included in the SIP ACK"George Joseph
2017-04-26Merge "res_pjsip_sdp_rtp: No rtpmap for static RTP payload IDs in SDP."Jenkins2
2017-04-26channels/chan_sip.c: use binding IP address for outgoing TCP SIP connectionsThierry Magnien
For outgoing TCP connections, Asterisk uses the first IP address of the interface instead of the IP address we asked him to bind to. ASTERISK-26922 #close Reported-by: Ksenia Change-Id: I43c71ca89211dbf1838e5bcdb9be8d06d98e54eb
2017-04-20chan_sip: Trigger reinvite if the SDP answer is included in the SIP ACKJean Aunis
Some equipments may send a re-INVITE containing an SDP in the final ACK request. If this happens in the context of direct media, the remote end should be updated with a re-INVITE. This patch queues an "update RTP peer" frame to trigger the re-INVITE, instead of the "source change" frame wich was used previously. ASTERISK-26951 Change-Id: I3644d2025f20e086ea9f8f62b486172c52b5b2e6
2017-04-13res_pjsip_sdp_rtp: No rtpmap for static RTP payload IDs in SDP.Alexander Traud
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 compact_headers=yes via the file pjsip.conf. ASTERISK-26932 #close Change-Id: Iaa556ab4c8325cd34c334387ab2847fab07b1689
2017-04-12modules: change module LOAD_FAILUREs to LOAD_DECLINESGeorge Joseph
In all non-pbx modules, AST_MODULE_LOAD_FAILURE has been changed to AST_MODULE_LOAD_DECLINE. This prevents asterisk from exiting if a module can't be loaded. If the user wishes to retain the FAILURE behavior for a specific module, they can use the "require" or "preload-require" keyword in modules.conf. A new API was added to logger: ast_is_logger_initialized(). This allows asterisk.c/check_init() to print to the error log once the logger subsystem is ready instead of just to stdout. If something does fail before the logger is initialized, we now print to stderr instead of stdout. Change-Id: I5f4b50623d9b5a6cb7c5624a8c5c1274c13b2b25
2017-04-03chan_sip: Session Timers required but refused wrongly.Alexander Traud
SIP user-agents indicate which protocol extensions are allowed in headers like Supported and Required. Such protocol extensions are Session Timers (RFC 4028) for example. Session Timers are supported since Mantis-10665. Since ASTERISK-21721, not only the first but multiple Supported/Required headers in a message are parsed. In that change, an existing variable was re-used within a newly added do-loop. Currently, at the end of that loop, that variable is an empty string always. Previously, that variable was used within log output. However, the log output was not changed. ASTERISK-26915 #close Change-Id: I09315f31b4d78fb214bb2a9fb6c0f5e143eae990
2017-03-17chan_sip: Add rtcp-mux supportSean Bright
ASTERISK-26846 #close Change-Id: I541a1602ff55ab73684e9f8002edb9e0e745d639
2017-03-07chan_sip: Call not cancelled after receiving a 422 responseJean Aunis
When receiving a 422 response, the invitestate variable must be reset to INV_CALLING. ASTERISK-26841 Change-Id: Ia0502d6b02192664cefa4e75bafdd2645ce56099
2017-03-02core: Cleanup ast_get_hint() usage.Richard Mudgett
* manager.c:manager_state_cb() Fix potential use of uninitialized hint[] if a hint does not exist for the requested extension. Ran into this when developing a testsuite test. The AMI event ExtensionStatus came out with the hint header value containing garbage. The AMI event PresenceStatus also had the same issue. * manager.c:action_extensionstate() no need to completely initialize the hint[]. Only initialize the first element. * pbx.c:ast_add_hint() Remove unnecessary assignment. * chan_sip.c: Eliminate an unneeded hint[] local variable. We only care about the return value of ast_get_hint() there. Change-Id: Ia9a8786f01f93f1f917200f0a50bead0319af97b
2017-02-14Merge "cli: Fix various CLI documentation and completion issues"zuul
2017-02-13cli: Fix various CLI documentation and completion issuesSean Bright
* app_minivm: Use built-in completion facilities to complete optional arguments. * app_voicemail: Use built-in completion facilities to complete optional arguments. * app_confbridge: Add missing colons after 'Usage' text. * chan_alsa: Use built-in completion facilities to complete optional arguments. * chan_sip: Use built-in completion facilities to complete optional arguments. Add completions for 'load' for 'sip show user', 'sip show peer', and 'sip qualify peer.' * chan_skinny: Correct and extend completions for 'skinny reset' and 'skinny show line.' * func_odbc: Correct completions for 'odbc read' and 'odbc write' * main/astmm: Use built-in completion facilities to complete arguments for 'memory' commands. * main/bridge: Correct completions for 'bridge kick.' * main/ccss: Use built-in completion facilities to complete arguments for 'cc cancel' command. * main/cli: Add 'all' completion for 'channel request hangup.' Correct completions for 'core set debug channel.' Correct completions for 'core show calls.' * main/pbx_app: Remove redundant completions for 'core show applications.' * main/pbx_hangup_handler: Remove unused completions for 'core show hanguphandlers all.' * res_sorcery_memory_cache: Add completion for 'reload' argument of 'sorcery memory cache stale' and properly implement. Change-Id: Iee58c7392f6fec34ad9d596109117af87697bbca
2017-02-10core: Cleanup some channel snapshot staging anomalies.Richard Mudgett
We shouldn't unlock the channel after starting a snapshot staging because another thread may interfere and do its own snapshot staging. * app_dial.c:dial_exec_full() made hold the channel lock while setting up the outgoing channel staging. Made hold the channel lock after the called party answers while updating the caller channel staging. * chan_sip.c:sip_new() completed the channel staging on off-nominal exit. Also we need to use ast_hangup() instead of ast_channel_unref() at that location. * channel.c:__ast_channel_alloc_ap() added a comment about not needing to complete the channel snapshot staging on off-nominal exit paths. * rtp_engine.c:ast_rtp_instance_set_stats_vars() made hold the channel locks while staging the channels for the stats channel variables. Change-Id: Iefb6336893163f6447bad65568722ad5d5d8212a
2017-01-27debug_utilities: Add ast_logescalatorGeorge Joseph
The escalator works by creating a set of startup commands in cli.conf that set up logger channels and issue the debug commands for the subsystems specified. If asterisk is running when it is executed, the same commands will be issued to the running instance. The original cli.conf is saved before any changes are made and can be restored by executing '$prog --reset'. The log output will be stored in... $astlogdir/message.$uniqueid $astlogdir/debug.$uniqueid $astlogdir/dtmf.$uniqueid $astlogdir/fax.$uniqueid $astlogdir/security.$uniqueid $astlogdir/pjsip_history.$uniqueid $astlogdir/sip_history.$uniqueid Some minor tweaks were made to chan_sip, and res_pjsip_history so their history output could be send to a log channel as packets are captured. A minor tweak was also made to manager so events are output to verbose when "manager set debug on" is issued. Change-Id: I799f8e5013b86dc5282961b27383d134bf09e543