summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-04-22Remove reference to non-existent sip.conf optionLeif Madsen
Option was removed in commit 7f883ef495b57ae9182e47213d01d5e8009dbf3f ASTERISK-25927 #close Change-Id: I92f9b0196d9fc41d1d58354c07340c465ef1fcf8
2016-04-21Merge "res_pjsip_callerid: Clear out display name if id->name is not valid" ↵Joshua Colp
into 13
2016-04-21lock.c: Check *lt before dereferencing itDiederik de Groot
*lt is NULL if t->tracking == 0 ASTERISK-25948 #close Change-Id: I4a81af28f9c82a74aa82413d772a7dc8fa6f45ba
2016-04-20res_stasis: Handle re-enter stasis bridge with swap channel.Richard Mudgett
We lose the fact that there is a swap channel if there is one. We currently wind up rejoining the stasis bridge as a normal join after the swap channel has already been kicked from the bridge. This patch preserves the swap channel so the AMI/ARI events can note that the channel joining the bridge is swapping with another channel. Another benefit to swaqpping in one operation is if there are any channels that get lonely (MOH, bridge playback, and bridge record channels). The lonely channels won't leave before the joining channel has a chance to come back in under stasis if the swap channel is the only reason the lonely channels are staying in the bridge. ASTERISK-25947 #close Reported by: Richard Mudgett ASTERISK-24649 Reported by: John Bigelow ASTERISK-24782 Reported by: John Bigelow Change-Id: If37ea508831d1fed6dbfac2f191c638fc0a850ee
2016-04-20bridge: Hold off more than one imparting channel at a time.Richard Mudgett
An earlier patch blocked the ast_bridge_impart() call until the channel either entered the target bridge or it failed. Unfortuantely, if the target bridge is stasis and the imprted channel is not a stasis channel, stasis bounces the channel out of the bridge to come back into the bridge as a proper stasis channel. When the channel is bounced out, that released the block on ast_bridge_impart() to continue. If the impart was a result of a transfer, then it became a race to see if the swap channel would get hung up before the imparted channel could come back into the stasis bridge. If the imparted channel won then everything is fine. If the swap channel gets hung up first then the transfer will fail because the swap channel is leaving the bridge. * Allow a chain of ast_bridge_impart()'s to happen before any are unblocked to prevent the race condition described above. When the channel finally joins the bridge or completely fails to join the bridge then the ast_bridge_impart() instances are unblocked. ASTERISK-25947 Reported by: Richard Mudgett ASTERISK-24649 Reported by: John Bigelow ASTERISK-24782 Reported by: John Bigelow Change-Id: I8fef369171f295f580024ab4971e95c799d0dde1
2016-04-20Merge "pjproject: Add patch for removing strip of '[]' from header params" ↵Joshua Colp
into 13
2016-04-19res_pjsip_callerid: Clear out display name if id->name is not validGeorge Joseph
When create_new_id_hdr creates a new RPID or PAI header, it starts by cloning the From header, then it overwrites the display name and uri from the channel's connected.id. If the connected.id.name wasn't valid, create_new_id_hdr was leaving the display name from the From header in the new RPID or PAI header. On an attended transfer where the originator had a caller id number set but not a display name, the re-INVITE to the final transferee had the number of the originator but the display name of the transferer. Added a check to clear out the display name in the new header if connected.id.name was invalid. ASTERISK-25942 #close Change-Id: I60b4bf7a7ece9b7425eba74151c0b4969cd2738b
2016-04-19Merge "PJSIP: Remove PJSIP parsing functions from uri length validation." ↵Joshua Colp
into 13
2016-04-19app_talkdetect: Make the module core supported.Joshua Colp
This module is used as part of testsuite tests to confirm stuff works. I'm accordingly marking it as core as it is required by those tests. Change-Id: I558e7af7679b22b8ed641d7dd37ee4ca35b11e88
2016-04-19PJSIP: Remove PJSIP parsing functions from uri length validation.Mark Michelson
The PJSIP parsing functions provide a nice concise way to check the length of a hostname in a SIP URI. The problem is that in order to use those parsing functions, it's required to use them from a thread that has registered with PJLib. On startup, when parsing AOR configuration, the permanent URI handler may not be run from a PJLib-registered thread. Specifically, this could happen when Asterisk was started in daemon mode rather than console-mode. If PJProject were compiled with assertions enabled, then this would cause Asterisk to crash on startup. The solution presented here is to do our own parsing of the contact URI in order to ensure that the hostname in the URI is not too long. The parsing does not attempt to perform a full SIP URI parse/validation, since the hostname in the URI is what is important. ASTERISK-25928 #close Reported by Joshua Colp Change-Id: Ic3d6c20ff3502507c17244a8b7e2ca761dc7fb60
2016-04-19Merge "app_queue: Frequent segfaults in function can_ring_entry()" into 13Joshua Colp
2016-04-19Merge "stasis_bridge.c: Update stasis bridge push diagnostic messages." into 13Joshua Colp
2016-04-19Merge "res_pjsip_transport_management: Allow unload to occur." into 13Joshua Colp
2016-04-19Merge "bridge_channel.c: Ignore role setup failure in channel push." into 13Joshua Colp
2016-04-19res_pjsip_registrar: Fix bad memory-ness with user_agent.Mark Michelson
Recent changes to the PJSIP registrar resulted in tests failing due to missing AOR_CONTACT_ADDED test events. The reason for this was that the user_agent string had junk values in it, resulting in being unable to generate the event. I'm going to be honest here, I have no idea why this was happening. Here are the steps needed for the user_agent variable to get messed up: * REGISTER is received * First contact in the REGISTER results in a contact being removed * Second contact in the REGISTER results in a contact being added * The contact, AOR, expiration, and user agent all have to be passed as format parameters to the creation of a string. Any subset of those parameters would not be enough to cause the problem. Looking into what was happening, the thing that struck me as odd was that the user_agent variable was meant to be set to the value of the User-Agent SIP header in the incoming REGISTER. However, when removing a contact, the user_agent variable would be set (via ast_strdupa inside a loop) to the stored contact's user_agent. This means that the user_agent's value would be incorrect when attempting to process further contacts in the incoming REGISTER. The fix here is to use a different variable for the stored user agent when removing a contact. Correcting the behavior to be correct also means the memory usage is less weird, and the issue no longer occurs. ASTERISK-25929 #close Reported by Joshua Colp Change-Id: I7cd24c86a38dec69ebcc94150614bc25f46b8c08
2016-04-18res_pjsip_transport_management: Allow unload to occur.Joshua Colp
At shutdown it is possible for modules to be unloaded that wouldn't normally be unloaded. This allows the environment to be cleaned up. The res_pjsip_transport_management module did not have the unload logic in it to clean itself up causing the res_pjsip module to not get unloaded. As a result the res_pjsip monitor thread kept going processing traffic and timers when it shouldn't. Change-Id: Ic8cadee131e3b2c436a81d3ae8bb5775999ae00a
2016-04-18bridge_channel.c: Ignore role setup failure in channel push.Richard Mudgett
We have to setup the channel roles after the bridge class push is called because the bridge class push callback may have set roles on the incoming channel. Since we have already partially pushed the channel into the bridge and reversing what we have already done could be problematic, the only thing we can do is press on to complete pushing the channel into the bridge. * Ignore any channel role setup errors after pushing the channel into a bridge. The channel may behave incorrectly in the bridge but we can no longer abort the push at this time. Change-Id: I08a97082b729052ee65cdca6bb730cf1289ede00
2016-04-18chan_sip: Don't verify table if rtupdate=noJaco Kroon
If rtupdate=no do not verify sipregs/peers table has updatable fields. ASTERISK-25934 #close Change-Id: Iaa2c53037b93daccc7e7333c40d61861847b856d
2016-04-18Merge "Codecs: strip codec name while parsing allow/disallow options" into 13Joshua Colp
2016-04-18app_queue: Frequent segfaults in function can_ring_entry()ibercom
ASTERISK-25888 #close Change-Id: I007a2f2dd99823e04fb5be3ff01f02b0a2956117
2016-04-15stasis_bridge.c: Update stasis bridge push diagnostic messages.Richard Mudgett
Change-Id: I195b14994c9dcccb9452491ca20a885d2a54605a
2016-04-15Merge "app_voicemail/IMAP: function 'save_to_folder' creates wrong folder" ↵Joshua Colp
into 13
2016-04-14transport management: Register thread with PJProject.Mark Michelson
The scheduler thread that kills idle TCP connections was not registering with PJProject properly and causing assertions if PJProject was built in debug mode. This change registers the thread with PJProject the first time that the scheduler callback executes. AST-2016-005 Change-Id: I5f7a37e2c80726a99afe9dc2a4a69bdedf661283
2016-04-14res_pjsip: Add serialized scheduler (res_pjsip/pjsip_scheduler.c)George Joseph
There are several places that do scheduled tasks or periodic housecleaning, each with its own implementation: * res_pjsip_keepalive has a thread that sends keepalives. * pjsip_distributor has a thread that cleans up expired unidentified requests. * res_pjsip_registrar_expire has a thread that cleans up expired contacts. * res_pjsip_pubsub uses ast_sched directly and then calls ast_sip_push_task. * res_pjsip_sdp_rtp also uses ast_sched to send keepalives. There are also places where we should be doing scheduled work but aren't. A good example are the places we have sorcery observers to start registration or qualify. These don't work when changes are made to a backend database without a pjsip reload. We need to check periodically. As a first step to solving these issues, a new ast_sip_sched facility has been created. ast_sip_sched wraps ast_sched but only uses ast_sched as a scheduled queue. When a task is ready to run, ast_sip_task_pusk is called for it. This ensures that the task is executed in a PJLIB registered thread and doesn't hold up the ast_sched thread so it can immediately continue processing the queue. The serializer used by ast_sip_sched is one of your choosing or a random one from the res_pjsip pool if you don't choose one. Another feature is the ability to automatically clean up the task_data when the task expires (if ever). If it's an ao2 object, it will be dereferenced, if it's a malloc'd object it will be freed. This is selectable when the task is scheduled. Even if you choose to not auto dereference an ao2 task data object, the scheduler itself maintains a reference to it while the task is under it's control. This prevents the data from disappearing out from under the task. There are two scheduling models. AST_SIP_SCHED_TASK_PERIODIC specifies that the invocations of the task occur at the specific interval. That is, every "interval" milliseconds, regardless of how long the task takes. If the task takes longer than the interval, it will be scheduled at the next available multiple of interval. For exmaple: If the task has an interval of 60 secs and the task takes 70 secs (it better not), the next invocation will happen at 120 seconds. AST_SIP_SCHED_TASK_DELAY specifies that the next invocation of the task should start "interval" milliseconds after the current invocation has finished. Also, the same ast_sched facility for fixed or variable intervals exists. The task's return code in conjunction with the AST_SIP_SCHED_TASK_FIXED or AST_SIP_SCHED_TASK_VARIABLE flags controls the next invocation start time. One res_pjsip.h housekeeping change was made. The pjsip header files were added to the top. There have been a few cases lately where I've needed res_pjsip.h just for ast_sip calls and had compiles fail spectacularly because I didn't add the pjsip header files to my source even though I never referenced any pjsip calls. Finally, a few new convenience APIs were added to astobj2 to make things a little easier in the scheduler. ao2_ref_and_lock() calls ao2_ref() and ao2_lock() in one go. ao2_unlock_and_unref() does the reverse. A few macros were also copied from res_phoneprov because I got tired of having to duplicate the same hash, sort and compare functions over and over again. The AO2_STRING_FIELD_(HASH|SORT|CMP)_FN macros will insert functions suitable for aor_container_alloc into your source. This facility can be used immediately for the situations where we already have a thread that wakes up periodically or do some scheduled work. For the registration and qualify issues, additional sorcery and schema changes would need to be made so that we can easily detect changed objects on a periodic basis without having to pull the entire database back to check. I'm thinking of a last-updated timestamp on the rows but more on this later. Change-Id: I7af6ad2b2d896ea68e478aa1ae201d6dd016ba1c
2016-04-14Merge "res_pjsip_transport_management: Kill idle TCP connections." into 13Joshua Colp
2016-04-14Merge "Rename res_pjsip_keepalive res_pjsip_transport_management" into 13Joshua Colp
2016-04-14Merge "AST-2016-004: Fix crash on REGISTER with long URI." into 13Joshua Colp
2016-04-14res_pjsip_transport_management: Kill idle TCP connections.Mark Michelson
"Idle" here means that someone connects to us and does not send a SIP request. PJProject will not automatically time out such connections, so it's up to Asterisk to do it instead. When we receive an incoming TCP connection, we will start a timer (equivalent to transaction timer D) waiting to receive an incoming request. If we do not receive a request in that timeframe, then we will shut down the TCP connection. ASTERISK-25796 #close Reported by George Joseph AST-2016-005 Change-Id: I7b0d303e5d140d0ccaf2f7af562071e3d1130ac6
2016-04-14Rename res_pjsip_keepalive res_pjsip_transport_managementMark Michelson
ASTERISK-25796 Reported by George Joseph AST-2016-005 Change-Id: Id322a05f927392293570599730050bc677d99433
2016-04-14AST-2016-004: Fix crash on REGISTER with long URI.Mark Michelson
Due to some ignored return values, Asterisk could crash if processing an incoming REGISTER whose contact URI was above a certain length. ASTERISK-25707 #close Reported by George Joseph Patches: 0001-res_pjsip-Validate-that-URIs-don-t-exceed-pjproject-.patch AST-2016-004 Change-Id: I0ed3898fe7ab10121b76c8c79046692de3a1be55
2016-04-13bridge_softmix.c: Fix crash if could not allocate the dsp.Richard Mudgett
Fix off nominal crash where we could not setup the channel to process frames for the softmix bridge technology because of allocation failure. Change-Id: Ic307a8386e46bf551e48fcd1eb97276714d56372
2016-04-13Merge "app_voicemail: Fix test_voicemail_notify_endl test." into 13Joshua Colp
2016-04-12pjproject: Add patch for removing strip of '[]' from header paramsGeorge Joseph
From the patch submitted to Teluu on 4/12/2016 <<<<<<<<< The wholesale stripping of '[]' from header parameters causes issues if something (like a port) occurs after the final ']'. '[2001:a::b]' will correctly parse to '2001:a::b' '[2001:a::b]:8080' will correctly parse to '2001:a::b' but the scanner is left with ':8080' and parsing stops with a syntax error. I can't even find a case where stripping the '[]' is a good thing anyway. Even if you continued to parse and resulted in a string that looks like this... '2001:a::b:8080', it's not valid. This came up in Asterisk because Kamailio sends us a Contact with an alias URI parameter that has an IPv6 address in it like this: Contact: <sip:1171@127.0.0.1:5080;alias=[2001:1:2::3]~43691~6> which should be legal but causes a syntax error because of the characters after the final ']'. Even if it didn't, the '[]' should still not be stripped. I've run the Asterisk Test Suite for PJSIP (252 tests) many of which are IPv6 enabled. No issues were caused by removing the code that strips the '[]'. >>>>>>>>>>> ASTERISK-25123 #close Reported-by: Anthony Messina Change-Id: I5cb33f4ebf07ee1f2b26d07caae715e2ec65595a
2016-04-12Merge "res_pjsip_dialog_info: Add missing "direction" attribute in NOTIFY ↵Joshua Colp
event" into 13
2016-04-12app_voicemail: Fix test_voicemail_notify_endl test.Joshua Colp
The test_voicemail_notify_endl test checks the end-of-line characters of an email message to confirm that they are consistent. The test wrongfully assumed that reading from the email message into a buffer will always result in more than 1 character being read. This is incorrect. If only 1 character was read the test would go outside of the buffer and access other memory causing a crash. The test now checks to ensure that 2 or more characters are read in ensuring the test stays within the buffer. ASTERISK-25874 #close Change-Id: Ic2c89cea6e90f2c0bc2d8138306ebbffd4f8b710
2016-04-12Merge "res_pjsip: Add headers to AMI Event ContactStatusDetail" into 13zuul
2016-04-11app_voicemail/IMAP: function 'save_to_folder' creates wrong folderAlexei Gradinari
If try to move message to Cust1 (number 5) the function 'save_to_folder' tries to create Greeting folder instead of Cust1. This patch fixed it by setting GREETINGS_FOLDER = -1 ASTERISK-24927 #close Change-Id: I03d1a761894bcc2d130ec9b003bbcddc28e25c51
2016-04-11res_pjsip: Add headers to AMI Event ContactStatusDetailAlexei Gradinari
* Added Useragent and RegExpire headers to AMI Event ContactStatusDetail with associated documentation. ASTERISK-25903 #close Change-Id: If3d121e943e588d016ba51d4eb9c6a421a562239
2016-04-11Merge "res_pjsip_outbound_publish: Add transport for outbound PUBLISH" into 13zuul
2016-04-11Merge "alembic: Remove batch operations (and sqlite support)" into 13zuul
2016-04-11Merge "core_unreal: Fix hangupcauses not getting set on Local channels" into 13Joshua Colp
2016-04-11Merge "res_pjsip contact: Lock expiration/addition of contacts" into 13zuul
2016-04-11Codecs: strip codec name while parsing allow/disallow optionsAlexei Gradinari
Failed registration using PJSIP/Realtime if one of the codec name in allow/disallow option is wrong or contains space. This patch strip codec name. ASTERISK-25914 Change-Id: Ifdf02de94e5ddbce305640f6f0666084a3b9283d
2016-04-11core_unreal: Fix hangupcauses not getting set on Local channelsJaco Kroon
ASTERISK-25912 #close Change-Id: I8e72e6894feaf36c9450f2788d205d07baec23aa
2016-04-11Merge "app_voicemail/IMAP: IMAP access FATAL error: Out of memory" into 13zuul
2016-04-11res_pjsip contact: Lock expiration/addition of contactsGeorge Joseph
Contact expiration can occur in several places: res_pjsip_registrar, res_pjsip_registrar_expire, and automatically when anyone calls ast_sip_location_retrieve_aor_contact. At the same time, res_pjsip_registrar may also be attempting to renew or add a contact. Since none of this was locked it was possible for one thread to be renewing a contact and another thread to expire it immediately because it was working off of stale data. This was the casue of intermittent registration/inbound/nominal/multiple_contacts test failures. Now, the new named lock functionality is used to lock the aor during contact expire and add operations and res_pjsip_registrar_expire now checks the expiration with the lock held before deleting the contact. ASTERISK-25885 #close Reported-by: Josh Colp Change-Id: I83d413c46a47796f3ab052ca3b349f21cca47059
2016-04-11Merge "lock: Add named lock capability" into 13zuul
2016-04-10pjproject: Add patch to fix Via IPv6 parsingGeorge Joseph
There's a bug in pjproject's sip_parser where the ":" wasn't correctly interpreted. This is causing IPv6 addresses in the "received" parameter of the Via header to cause a syntax check failure. This patch was submitted to Teluu on 4/10/2016. ASTERISK-25910 #close Reported-by: Anthony Messina Change-Id: Ic7e4c4aa14ded61860401ec349f5177568c4d922
2016-04-08lock: Add named lock capabilityGeorge Joseph
Locking some objects like sorcery objects can be tricky because the underlying ao2 object may not be the same for all callers. For instance, two threads that call ast_sorcery_retrieve_by_id on the same aor name might actually get 2 different ao2 objects if the underlying wizard had to rehydrate the aor from a database. Locking one ao2 object doesn't have any effect on the other even if those objects had locks in the first place. Named locks allow access control by keyspace and key strings. Now an "aor" named "1000" can be locked and any other thread attempting to lock "aor" "1000" will wait regardless of whether the underlying ao2 object is the same or not. Mutex and rwlocks are supported. This capability will initially be used to lock an aor when multiple threads may be attempting to prune expired contacts from it. Change-Id: If258c0b7f92b02d07243ce70e535821a1ea7fb45
2016-04-08res_pjsip_outbound_publish: Add transport for outbound PUBLISHAlexei Gradinari
The first available transport of the appropriate type is used now. This patch adds new config option 'transport' for outbound-publish. If transport is set then outbound PUBLISH requests will use this transport. ASTERISK-25901 #close Change-Id: Ib389130489b70e36795b0003fa5fd386e2680151